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.
5 #ifndef UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_
6 #define UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_
8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/ozone/ozone_base_export.h"
17 typedef void* PlatformCursor
;
19 class OZONE_BASE_EXPORT CursorFactoryOzone
{
22 virtual ~CursorFactoryOzone();
24 // Returns the singleton instance.
25 static CursorFactoryOzone
* GetInstance();
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
);
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
);
38 // Increment platform image cursor refcount.
39 virtual void RefImageCursor(PlatformCursor cursor
);
41 // Decrement platform image cursor refcount.
42 virtual void UnrefImageCursor(PlatformCursor cursor
);
44 // Change the active cursor for an AcceleratedWidget.
45 // TODO(spang): Move this.
46 virtual void SetCursor(gfx::AcceleratedWidget widget
, PlatformCursor cursor
);
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();
54 static CursorFactoryOzone
* impl_
; // not owned
59 #endif // UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_