Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: ui/views/corewm/cursor_manager.h

Issue 12263050: Rework ash::CursorManager into a corewm object, to share code with desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 ASH_WM_CURSOR_MANAGER_H_ 5 #ifndef UI_VIEWS_COREWM_CURSOR_MANAGER_H_
6 #define ASH_WM_CURSOR_MANAGER_H_ 6 #define UI_VIEWS_COREWM_CURSOR_MANAGER_H_
7 7
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h" 8 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
12 #include "ui/aura/client/cursor_client.h" 11 #include "ui/aura/client/cursor_client.h"
13 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/point.h" 13 #include "ui/gfx/point.h"
14 #include "ui/views/corewm/native_cursor_manager_delegate.h"
15 #include "ui/views/views_export.h"
15 16
16 namespace ash { 17 namespace views {
18 namespace corewm {
17 19
18 namespace internal { 20 namespace internal {
19 class CursorState; 21 class CursorState;
20 } 22 }
21 23
22 namespace test { 24 class NativeCursorManager;
23 class CursorManagerTestApi;
24 }
25 25
26 class ImageCursors; 26 // This class receives requests to change cursor properties, as well as
27 27 // requests to queue any further changes until a later time. It sends changes
28 // This class controls the visibility and the type of the cursor. 28 // to the NativeCursorManager, which communicates back to us when these changes
29 // The cursor type can be locked so that the type stays the same 29 // were made through the NativeCursorManagerDelegate interface.
30 // until it's unlocked. 30 class VIEWS_EXPORT CursorManager : public aura::client::CursorClient,
31 class ASH_EXPORT CursorManager : public aura::client::CursorClient { 31 public NativeCursorManagerDelegate {
32 public: 32 public:
33 CursorManager(); 33 CursorManager(scoped_ptr<NativeCursorManager> delegate);
34 virtual ~CursorManager(); 34 virtual ~CursorManager();
35 35
36 bool is_cursor_locked() const { return cursor_lock_count_ > 0; } 36 bool is_cursor_locked() const { return cursor_lock_count_ > 0; }
37 37
38 // Overridden from aura::client::CursorClient: 38 // Overridden from aura::client::CursorClient:
39 virtual void SetCursor(gfx::NativeCursor) OVERRIDE; 39 virtual void SetCursor(gfx::NativeCursor) OVERRIDE;
40 virtual void ShowCursor() OVERRIDE; 40 virtual void ShowCursor() OVERRIDE;
41 virtual void HideCursor() OVERRIDE; 41 virtual void HideCursor() OVERRIDE;
42 virtual bool IsCursorVisible() const OVERRIDE; 42 virtual bool IsCursorVisible() const OVERRIDE;
43 virtual void EnableMouseEvents() OVERRIDE; 43 virtual void EnableMouseEvents() OVERRIDE;
44 virtual void DisableMouseEvents() OVERRIDE; 44 virtual void DisableMouseEvents() OVERRIDE;
45 virtual bool IsMouseEventsEnabled() const OVERRIDE; 45 virtual bool IsMouseEventsEnabled() const OVERRIDE;
46 virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE; 46 virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE;
47 virtual void LockCursor() OVERRIDE; 47 virtual void LockCursor() OVERRIDE;
48 virtual void UnlockCursor() OVERRIDE; 48 virtual void UnlockCursor() OVERRIDE;
49 49
50 private: 50 private:
51 friend class test::CursorManagerTestApi; 51 // Overridden from NativeCursorManagerDelegate:
52 virtual gfx::NativeCursor GetCurrentCursor() const OVERRIDE;
53 virtual bool GetCurrentVisibility() const OVERRIDE;
54 virtual bool GetMouseEventsEnabled() const OVERRIDE;
55 virtual void CommitCursor(gfx::NativeCursor cursor) OVERRIDE;
56 virtual void CommitVisibility(bool visible) OVERRIDE;
57 virtual void CommitMouseEventsEnabled(bool enabled) OVERRIDE;
52 58
53 void SetCursorInternal(gfx::NativeCursor cursor); 59 scoped_ptr<NativeCursorManager> delegate_;
54 void SetCursorVisibility(bool visible);
55 void SetMouseEventsEnabled(bool enabled);
56
57 // Returns the current cursor.
58 gfx::NativeCursor GetCurrentCursor() const;
59 60
60 // Number of times LockCursor() has been invoked without a corresponding 61 // Number of times LockCursor() has been invoked without a corresponding
61 // UnlockCursor(). 62 // UnlockCursor().
62 int cursor_lock_count_; 63 int cursor_lock_count_;
63 64
64 // The cursor location where the cursor was disabled.
65 gfx::Point disabled_cursor_location_;
66
67 // The current state of the cursor. 65 // The current state of the cursor.
68 scoped_ptr<internal::CursorState> current_state_; 66 scoped_ptr<internal::CursorState> current_state_;
69 67
70 // The cursor state to restore when the cursor is unlocked. 68 // The cursor state to restore when the cursor is unlocked.
71 scoped_ptr<internal::CursorState> state_on_unlock_; 69 scoped_ptr<internal::CursorState> state_on_unlock_;
72 70
73 scoped_ptr<ImageCursors> image_cursors_;
74
75 DISALLOW_COPY_AND_ASSIGN(CursorManager); 71 DISALLOW_COPY_AND_ASSIGN(CursorManager);
76 }; 72 };
77 73
78 } // namespace ash 74 } // namespace corewm
75 } // namespace views
79 76
80 #endif // UI_AURA_CURSOR_MANAGER_H_ 77 #endif // UI_VIEWS_COREWM_CURSOR_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc ('k') | ui/views/corewm/cursor_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698