| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_AURA_CURSOR_MANAGER_H_ | 5 #ifndef ASH_WM_CURSOR_MANAGER_H_ |
| 6 #define UI_AURA_CURSOR_MANAGER_H_ | 6 #define ASH_WM_CURSOR_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 9 #include "ui/aura/aura_export.h" | 10 #include "ui/aura/aura_export.h" |
| 11 #include "ui/aura/client/cursor_client.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 11 | 13 |
| 12 namespace aura { | 14 namespace ash { |
| 13 class CursorDelegate; | 15 class CursorDelegate; |
| 14 | 16 |
| 15 // This class controls the visibility and the type of the cursor. | 17 // This class controls the visibility and the type of the cursor. |
| 16 // The cursor type can be locked so that the type stays the same | 18 // The cursor type can be locked so that the type stays the same |
| 17 // until it's unlocked. | 19 // until it's unlocked. |
| 18 class AURA_EXPORT CursorManager { | 20 class CursorManager : public aura::client::CursorClient { |
| 19 public: | 21 public: |
| 20 CursorManager(); | 22 CursorManager(); |
| 21 ~CursorManager(); | 23 ~CursorManager(); |
| 22 | 24 |
| 23 void set_delegate(CursorDelegate* delegate) { delegate_ = delegate; } | 25 void set_delegate(CursorDelegate* delegate) { delegate_ = delegate; } |
| 24 | 26 |
| 25 // Locks/Unlocks the cursor change. | 27 // Locks/Unlocks the cursor change. |
| 26 void LockCursor(); | 28 void LockCursor(); |
| 27 void UnlockCursor(); | 29 void UnlockCursor(); |
| 28 | 30 |
| 29 void SetCursor(gfx::NativeCursor); | 31 bool cursor_visible() const { return cursor_visible_; } |
| 30 | 32 |
| 31 // Shows or hides the cursor. | 33 // Overridden from aura::CursorClient: |
| 32 void ShowCursor(bool show); | 34 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
| 33 bool cursor_visible() const { return cursor_visible_; } | 35 virtual void ShowCursor(bool visible) OVERRIDE; |
| 36 virtual bool GetVisible() const OVERRIDE; |
| 34 | 37 |
| 35 private: | 38 private: |
| 36 CursorDelegate* delegate_; | 39 CursorDelegate* delegate_; |
| 37 | 40 |
| 38 // Number of times LockCursor() has been invoked without a corresponding | 41 // Number of times LockCursor() has been invoked without a corresponding |
| 39 // UnlockCursor(). | 42 // UnlockCursor(). |
| 40 int cursor_lock_count_; | 43 int cursor_lock_count_; |
| 41 | 44 |
| 42 // Set to true if UpdateCursor() is invoked while |cursor_lock_count_| == 0. | 45 // Set to true if UpdateCursor() is invoked while |cursor_lock_count_| == 0. |
| 43 bool did_cursor_change_; | 46 bool did_cursor_change_; |
| 44 | 47 |
| 45 // Cursor to set once |cursor_lock_count_| is set to 0. Only valid if | 48 // Cursor to set once |cursor_lock_count_| is set to 0. Only valid if |
| 46 // |did_cursor_change_| is true. | 49 // |did_cursor_change_| is true. |
| 47 gfx::NativeCursor cursor_to_set_on_unlock_; | 50 gfx::NativeCursor cursor_to_set_on_unlock_; |
| 48 | 51 |
| 49 // Is cursor visible? | 52 // Is cursor visible? |
| 50 bool cursor_visible_; | 53 bool cursor_visible_; |
| 51 | 54 |
| 52 DISALLOW_COPY_AND_ASSIGN(CursorManager); | 55 DISALLOW_COPY_AND_ASSIGN(CursorManager); |
| 53 }; | 56 }; |
| 54 | 57 |
| 55 } // namespace aura | 58 } // namespace ash |
| 56 | 59 |
| 57 #endif // UI_AURA_CURSOR_MANAGER_H_ | 60 #endif // ASH_WM_CURSOR_MANAGER_H_ |
| 58 | 61 |
| OLD | NEW |