Home | History | Annotate | Download | only in public
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_
      6 #define UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_
      7 
      8 #include "ui/gfx/native_widget_types.h"
      9 #include "ui/ozone/ozone_base_export.h"
     10 
     11 namespace gfx {
     12 class Point;
     13 }
     14 
     15 namespace ui {
     16 
     17 typedef void* PlatformCursor;
     18 
     19 class OZONE_BASE_EXPORT CursorFactoryOzone {
     20  public:
     21   CursorFactoryOzone();
     22   virtual ~CursorFactoryOzone();
     23 
     24   // Returns the singleton instance.
     25   static CursorFactoryOzone* GetInstance();
     26 
     27   // Return the default cursor of the specified type. The types are listed in
     28   // ui/base/cursor/cursor.h. Default cursors are managed by the implementation
     29   // and must live indefinitely; there's no way to know when to free them.
     30   virtual PlatformCursor GetDefaultCursor(int type);
     31 
     32   // Return a image cursor from the specified image & hotspot. Image cursors
     33   // are referenced counted and have an initial refcount of 1. Therefore, each
     34   // CreateImageCursor call must be matched with a call to UnrefImageCursor.
     35   virtual PlatformCursor CreateImageCursor(const SkBitmap& bitmap,
     36                                            const gfx::Point& hotspot);
     37 
     38   // Increment platform image cursor refcount.
     39   virtual void RefImageCursor(PlatformCursor cursor);
     40 
     41   // Decrement platform image cursor refcount.
     42   virtual void UnrefImageCursor(PlatformCursor cursor);
     43 
     44   // Change the active cursor for an AcceleratedWidget.
     45   // TODO(spang): Move this.
     46   virtual void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor cursor);
     47 
     48   // Returns the window on which the cursor is active.
     49   // TODO(dnicoara) Move this once the WindowTreeHost refactoring finishes and
     50   // WindowTreeHost::CanDispatchEvent() is no longer present.
     51   virtual gfx::AcceleratedWidget GetCursorWindow();
     52 
     53  private:
     54   static CursorFactoryOzone* impl_;  // not owned
     55 };
     56 
     57 }  // namespace ui
     58 
     59 #endif  // UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_
     60