| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ | 5 #ifndef UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ |
| 6 #define UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ | 6 #define UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // This is a base class for platforms where PlatformCursor is an SkBitmap | 41 // This is a base class for platforms where PlatformCursor is an SkBitmap |
| 42 // combined with a gfx::Point for the hotspot. | 42 // combined with a gfx::Point for the hotspot. |
| 43 // | 43 // |
| 44 // Subclasses need only implement SetBitmapCursor() as everything else is | 44 // Subclasses need only implement SetBitmapCursor() as everything else is |
| 45 // implemented here. | 45 // implemented here. |
| 46 class UI_BASE_EXPORT BitmapCursorFactoryOzone : public CursorFactoryOzone { | 46 class UI_BASE_EXPORT BitmapCursorFactoryOzone : public CursorFactoryOzone { |
| 47 public: | 47 public: |
| 48 BitmapCursorFactoryOzone(); | 48 BitmapCursorFactoryOzone(); |
| 49 virtual ~BitmapCursorFactoryOzone(); | 49 virtual ~BitmapCursorFactoryOzone(); |
| 50 | 50 |
| 51 // Convert PlatformCursor to BitmapCursorOzone. |
| 52 static scoped_refptr<BitmapCursorOzone> GetBitmapCursor( |
| 53 PlatformCursor platform_cursor); |
| 54 |
| 51 // CursorFactoryOzone: | 55 // CursorFactoryOzone: |
| 52 virtual PlatformCursor GetDefaultCursor(int type) OVERRIDE; | 56 virtual PlatformCursor GetDefaultCursor(int type) OVERRIDE; |
| 53 virtual PlatformCursor CreateImageCursor(const SkBitmap& bitmap, | 57 virtual PlatformCursor CreateImageCursor(const SkBitmap& bitmap, |
| 54 const gfx::Point& hotspot) OVERRIDE; | 58 const gfx::Point& hotspot) OVERRIDE; |
| 55 virtual void RefImageCursor(PlatformCursor cursor) OVERRIDE; | 59 virtual void RefImageCursor(PlatformCursor cursor) OVERRIDE; |
| 56 virtual void UnrefImageCursor(PlatformCursor cursor) OVERRIDE; | 60 virtual void UnrefImageCursor(PlatformCursor cursor) OVERRIDE; |
| 57 virtual void SetCursor(gfx::AcceleratedWidget widget, | |
| 58 PlatformCursor cursor) OVERRIDE; | |
| 59 | |
| 60 // Set a bitmap cursor for the given window. This must be overridden by | |
| 61 // subclasses. If the cursor is hidden (kCursorNone) then cursor is NULL. | |
| 62 virtual void SetBitmapCursor(gfx::AcceleratedWidget window, | |
| 63 scoped_refptr<BitmapCursorOzone> cursor); | |
| 64 | 61 |
| 65 private: | 62 private: |
| 66 // Default cursors are cached & owned by the factory. | 63 // Default cursors are cached & owned by the factory. |
| 67 typedef std::map<int, scoped_refptr<BitmapCursorOzone> > DefaultCursorMap; | 64 typedef std::map<int, scoped_refptr<BitmapCursorOzone> > DefaultCursorMap; |
| 68 DefaultCursorMap default_cursors_; | 65 DefaultCursorMap default_cursors_; |
| 69 | 66 |
| 70 DISALLOW_COPY_AND_ASSIGN(BitmapCursorFactoryOzone); | 67 DISALLOW_COPY_AND_ASSIGN(BitmapCursorFactoryOzone); |
| 71 }; | 68 }; |
| 72 | 69 |
| 73 } // namespace ui | 70 } // namespace ui |
| 74 | 71 |
| 75 #endif // UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ | 72 #endif // UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_ |
| OLD | NEW |