Roll WebRTC 9745:9761, Libjingle 9742:9761
[chromium-blink-merge.git] / ui / ozone / public / cursor_factory_ozone.h
blob4950a3186ee6fd7911dc7024b8123f8ab5ca73df
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 <vector>
10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/ozone/ozone_base_export.h"
13 namespace gfx {
14 class Point;
17 namespace ui {
19 typedef void* PlatformCursor;
21 class OZONE_BASE_EXPORT CursorFactoryOzone {
22 public:
23 CursorFactoryOzone();
24 virtual ~CursorFactoryOzone();
26 // Returns the singleton instance.
27 static CursorFactoryOzone* GetInstance();
29 // Return the default cursor of the specified type. The types are listed in
30 // ui/base/cursor/cursor.h. Default cursors are managed by the implementation
31 // and must live indefinitely; there's no way to know when to free them.
32 virtual PlatformCursor GetDefaultCursor(int type);
34 // Return a image cursor from the specified image & hotspot. Image cursors
35 // are referenced counted and have an initial refcount of 1. Therefore, each
36 // CreateImageCursor call must be matched with a call to UnrefImageCursor.
37 virtual PlatformCursor CreateImageCursor(const SkBitmap& bitmap,
38 const gfx::Point& hotspot);
40 // Return a animated cursor from the specified image & hotspot. Animated
41 // cursors are referenced counted and have an initial refcount of 1.
42 // Therefore, each CreateAnimatedCursor call must be matched with a call to
43 // UnrefImageCursor.
44 virtual PlatformCursor CreateAnimatedCursor(
45 const std::vector<SkBitmap>& bitmaps,
46 const gfx::Point& hotspot,
47 int frame_delay_ms);
49 // Increment platform image cursor refcount.
50 virtual void RefImageCursor(PlatformCursor cursor);
52 // Decrement platform image cursor refcount.
53 virtual void UnrefImageCursor(PlatformCursor cursor);
55 private:
56 static CursorFactoryOzone* impl_; // not owned
59 } // namespace ui
61 #endif // UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_