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

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

Issue 92413002: Cursor state should be global for all CursorManagers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 7 years 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
« no previous file with comments | « ui/aura/test/test_cursor_client.cc ('k') | ui/views/corewm/cursor_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 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 UI_VIEWS_COREWM_CURSOR_MANAGER_H_ 5 #ifndef UI_VIEWS_COREWM_CURSOR_MANAGER_H_
6 #define UI_VIEWS_COREWM_CURSOR_MANAGER_H_ 6 #define UI_VIEWS_COREWM_CURSOR_MANAGER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 18 matching lines...) Expand all
29 29
30 class NativeCursorManager; 30 class NativeCursorManager;
31 31
32 // This class receives requests to change cursor properties, as well as 32 // This class receives requests to change cursor properties, as well as
33 // requests to queue any further changes until a later time. It sends changes 33 // requests to queue any further changes until a later time. It sends changes
34 // to the NativeCursorManager, which communicates back to us when these changes 34 // to the NativeCursorManager, which communicates back to us when these changes
35 // were made through the NativeCursorManagerDelegate interface. 35 // were made through the NativeCursorManagerDelegate interface.
36 class VIEWS_EXPORT CursorManager : public aura::client::CursorClient, 36 class VIEWS_EXPORT CursorManager : public aura::client::CursorClient,
37 public NativeCursorManagerDelegate { 37 public NativeCursorManagerDelegate {
38 public: 38 public:
39 class VIEWS_EXPORT TestApi {
40 public:
41 explicit TestApi(CursorManager* cursor_manager)
42 : cursor_manager_(cursor_manager) {
43 }
44 ~TestApi() {}
45
46 void ResetState();
47
48 private:
49 CursorManager* cursor_manager_;
50 };
51
39 CursorManager(scoped_ptr<NativeCursorManager> delegate); 52 CursorManager(scoped_ptr<NativeCursorManager> delegate);
40 virtual ~CursorManager(); 53 virtual ~CursorManager();
41 54
42 // Overridden from aura::client::CursorClient: 55 // Overridden from aura::client::CursorClient:
43 virtual void SetCursor(gfx::NativeCursor) OVERRIDE; 56 virtual void SetCursor(gfx::NativeCursor) OVERRIDE;
57 virtual gfx::NativeCursor GetCursor() const OVERRIDE;
44 virtual void ShowCursor() OVERRIDE; 58 virtual void ShowCursor() OVERRIDE;
45 virtual void HideCursor() OVERRIDE; 59 virtual void HideCursor() OVERRIDE;
46 virtual bool IsCursorVisible() const OVERRIDE; 60 virtual bool IsCursorVisible() const OVERRIDE;
47 virtual void SetScale(float scale) OVERRIDE; 61 virtual void SetScale(float scale) OVERRIDE;
48 virtual float GetCurrentScale() const OVERRIDE; 62 virtual float GetScale() const OVERRIDE;
49 virtual void SetCursorSet(ui::CursorSetType cursor_set) OVERRIDE; 63 virtual void SetCursorSet(ui::CursorSetType cursor_set) OVERRIDE;
50 virtual ui::CursorSetType GetCurrentCursorSet() const OVERRIDE; 64 virtual ui::CursorSetType GetCursorSet() const OVERRIDE;
51 virtual void EnableMouseEvents() OVERRIDE; 65 virtual void EnableMouseEvents() OVERRIDE;
52 virtual void DisableMouseEvents() OVERRIDE; 66 virtual void DisableMouseEvents() OVERRIDE;
53 virtual bool IsMouseEventsEnabled() const OVERRIDE; 67 virtual bool IsMouseEventsEnabled() const OVERRIDE;
54 virtual void SetDisplay(const gfx::Display& display) OVERRIDE; 68 virtual void SetDisplay(const gfx::Display& display) OVERRIDE;
55 virtual void LockCursor() OVERRIDE; 69 virtual void LockCursor() OVERRIDE;
56 virtual void UnlockCursor() OVERRIDE; 70 virtual void UnlockCursor() OVERRIDE;
57 virtual bool IsCursorLocked() const OVERRIDE; 71 virtual bool IsCursorLocked() const OVERRIDE;
58 virtual void AddObserver( 72 virtual void AddObserver(
59 aura::client::CursorClientObserver* observer) OVERRIDE; 73 aura::client::CursorClientObserver* observer) OVERRIDE;
60 virtual void RemoveObserver( 74 virtual void RemoveObserver(
61 aura::client::CursorClientObserver* observer) OVERRIDE; 75 aura::client::CursorClientObserver* observer) OVERRIDE;
62 76
63 private: 77 private:
64 // Overridden from NativeCursorManagerDelegate: 78 // Overridden from NativeCursorManagerDelegate:
65 virtual gfx::NativeCursor GetCurrentCursor() const OVERRIDE;
66 virtual bool GetCurrentVisibility() const OVERRIDE;
67 virtual bool GetMouseEventsEnabled() const OVERRIDE;
68 virtual void CommitCursor(gfx::NativeCursor cursor) OVERRIDE; 79 virtual void CommitCursor(gfx::NativeCursor cursor) OVERRIDE;
69 virtual void CommitVisibility(bool visible) OVERRIDE; 80 virtual void CommitVisibility(bool visible) OVERRIDE;
70 virtual void CommitScale(float scale) OVERRIDE; 81 virtual void CommitScale(float scale) OVERRIDE;
71 virtual void CommitCursorSet(ui::CursorSetType cursor_set) OVERRIDE; 82 virtual void CommitCursorSet(ui::CursorSetType cursor_set) OVERRIDE;
72 virtual void CommitMouseEventsEnabled(bool enabled) OVERRIDE; 83 virtual void CommitMouseEventsEnabled(bool enabled) OVERRIDE;
73 84
74 scoped_ptr<NativeCursorManager> delegate_; 85 scoped_ptr<NativeCursorManager> delegate_;
75 86
76 // Number of times LockCursor() has been invoked without a corresponding 87 // Number of times LockCursor() has been invoked without a corresponding
77 // UnlockCursor(). 88 // UnlockCursor().
78 int cursor_lock_count_; 89 static int cursor_lock_count_;
79 90
80 // The current state of the cursor. 91 // The current state of the cursor.
81 scoped_ptr<internal::CursorState> current_state_; 92 static internal::CursorState* current_state_;
82 93
83 // The cursor state to restore when the cursor is unlocked. 94 // The cursor state to restore when the cursor is unlocked.
84 scoped_ptr<internal::CursorState> state_on_unlock_; 95 static internal::CursorState* state_on_unlock_;
85 96
86 ObserverList<aura::client::CursorClientObserver> observers_; 97 typedef ObserverList<aura::client::CursorClientObserver> CursorObservers;
98 static CursorObservers* observers_;
87 99
88 DISALLOW_COPY_AND_ASSIGN(CursorManager); 100 DISALLOW_COPY_AND_ASSIGN(CursorManager);
89 }; 101 };
90 102
91 } // namespace corewm 103 } // namespace corewm
92 } // namespace views 104 } // namespace views
93 105
94 #endif // UI_VIEWS_COREWM_CURSOR_MANAGER_H_ 106 #endif // UI_VIEWS_COREWM_CURSOR_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/aura/test/test_cursor_client.cc ('k') | ui/views/corewm/cursor_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698