| 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_IMAGE_CURSORS_H_ | 5 #ifndef UI_BASE_CURSOR_IMAGE_CURSORS_H_ |
| 6 #define UI_BASE_CURSOR_IMAGE_CURSORS_H_ | 6 #define UI_BASE_CURSOR_IMAGE_CURSORS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 12 #include "ui/base/cursor/cursor.h" | 13 #include "ui/base/cursor/cursor.h" |
| 13 #include "ui/base/ui_base_export.h" | 14 #include "ui/base/ui_base_export.h" |
| 14 #include "ui/display/display.h" | 15 #include "ui/display/display.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 | 19 |
| 19 class CursorLoader; | 20 class CursorLoader; |
| 20 | 21 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 // Sets the display the cursors are loaded for. |scale_factor| determines the | 33 // Sets the display the cursors are loaded for. |scale_factor| determines the |
| 33 // size of the image to load. Returns true if the cursor image is reloaded. | 34 // size of the image to load. Returns true if the cursor image is reloaded. |
| 34 bool SetDisplay(const display::Display& display, float scale_factor); | 35 bool SetDisplay(const display::Display& display, float scale_factor); |
| 35 | 36 |
| 36 // Sets the size of the mouse cursor icon. | 37 // Sets the size of the mouse cursor icon. |
| 37 void SetCursorSize(CursorSize cursor_size); | 38 void SetCursorSize(CursorSize cursor_size); |
| 38 | 39 |
| 39 // Sets the platform cursor based on the native type of |cursor|. | 40 // Sets the platform cursor based on the native type of |cursor|. |
| 40 void SetPlatformCursor(gfx::NativeCursor* cursor); | 41 void SetPlatformCursor(gfx::NativeCursor* cursor); |
| 41 | 42 |
| 43 base::WeakPtr<ImageCursors> GetWeakPtr(); |
| 44 |
| 42 private: | 45 private: |
| 43 // Reloads the all loaded cursors in the cursor loader. | 46 // Reloads the all loaded cursors in the cursor loader. |
| 44 void ReloadCursors(); | 47 void ReloadCursors(); |
| 45 | 48 |
| 46 std::unique_ptr<CursorLoader> cursor_loader_; | 49 std::unique_ptr<CursorLoader> cursor_loader_; |
| 47 CursorSize cursor_size_; | 50 CursorSize cursor_size_; |
| 51 base::WeakPtrFactory<ImageCursors> weak_ptr_factory_; |
| 48 | 52 |
| 49 DISALLOW_COPY_AND_ASSIGN(ImageCursors); | 53 DISALLOW_COPY_AND_ASSIGN(ImageCursors); |
| 50 }; | 54 }; |
| 51 | 55 |
| 52 } // namespace ui | 56 } // namespace ui |
| 53 | 57 |
| 54 #endif // UI_BASE_CURSOR_IMAGE_CURSORS_H_ | 58 #endif // UI_BASE_CURSOR_IMAGE_CURSORS_H_ |
| OLD | NEW |