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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_cursor_manager.h

Issue 111043002: Cursor state should be global for desktop Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test added 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
OLDNEW
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_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_ 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_ 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_
7 7
8 #include <set>
9
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
10 #include "ui/views/corewm/native_cursor_manager.h" 12 #include "ui/views/corewm/native_cursor_manager.h"
11 #include "ui/views/views_export.h" 13 #include "ui/views/views_export.h"
12 14
13 namespace aura { 15 namespace aura {
14 class RootWindow; 16 class RootWindow;
15 } 17 }
16 18
17 namespace ui { 19 namespace ui {
18 class CursorLoader; 20 class CursorLoader;
19 } 21 }
20 22
21 namespace views { 23 namespace views {
22 class DesktopCursorLoaderUpdater; 24 class DesktopCursorLoaderUpdater;
23 25
24 namespace corewm { 26 namespace corewm {
25 class NativeCursorManagerDelegate; 27 class NativeCursorManagerDelegate;
26 } 28 }
27 29
28 // A NativeCursorManager that interacts with only one RootWindow. (Unlike the 30 // A NativeCursorManager that performs the desktop-specific setting of cursor
29 // one in ash, which interacts with all the RootWindows that ash knows about.) 31 // state. Similar to AshNativeCursorManager, it also communicates these changes
32 // to all root windows.
30 class VIEWS_EXPORT DesktopNativeCursorManager 33 class VIEWS_EXPORT DesktopNativeCursorManager
31 : public views::corewm::NativeCursorManager { 34 : public views::corewm::NativeCursorManager {
32 public: 35 public:
33 DesktopNativeCursorManager( 36 DesktopNativeCursorManager(
34 aura::RootWindow* window,
35 scoped_ptr<DesktopCursorLoaderUpdater> cursor_loader_updater); 37 scoped_ptr<DesktopCursorLoaderUpdater> cursor_loader_updater);
36 virtual ~DesktopNativeCursorManager(); 38 virtual ~DesktopNativeCursorManager();
37 39
38 // Builds a cursor and sets the internal platform representation. 40 // Builds a cursor and sets the internal platform representation.
39 gfx::NativeCursor GetInitializedCursor(int type); 41 gfx::NativeCursor GetInitializedCursor(int type);
40 42
43 // Adds |root_window| to the set |root_windows_|.
44 void AddRootWindow(aura::RootWindow* root_window);
45
46 // Removes |root_window| from the set |root_windows_|.
47 void RemoveRootWindow(aura::RootWindow* root_window);
48
41 private: 49 private:
42 // Overridden from views::corewm::NativeCursorManager: 50 // Overridden from views::corewm::NativeCursorManager:
43 virtual void SetDisplay( 51 virtual void SetDisplay(
44 const gfx::Display& display, 52 const gfx::Display& display,
45 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 53 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE;
46 virtual void SetCursor( 54 virtual void SetCursor(
47 gfx::NativeCursor cursor, 55 gfx::NativeCursor cursor,
48 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 56 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE;
49 virtual void SetVisibility( 57 virtual void SetVisibility(
50 bool visible, 58 bool visible,
51 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 59 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE;
52 virtual void SetCursorSet( 60 virtual void SetCursorSet(
53 ui::CursorSetType cursor_set, 61 ui::CursorSetType cursor_set,
54 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 62 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE;
55 virtual void SetScale( 63 virtual void SetScale(
56 float scale, 64 float scale,
57 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 65 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE;
58 virtual void SetMouseEventsEnabled( 66 virtual void SetMouseEventsEnabled(
59 bool enabled, 67 bool enabled,
60 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 68 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE;
61 69
62 aura::RootWindow* root_window_; 70 // The set of root windows to notify of changes in cursor state.
71 typedef std::set<aura::RootWindow*> RootWindows;
72 RootWindows root_windows_;
73
63 scoped_ptr<DesktopCursorLoaderUpdater> cursor_loader_updater_; 74 scoped_ptr<DesktopCursorLoaderUpdater> cursor_loader_updater_;
64 scoped_ptr<ui::CursorLoader> cursor_loader_; 75 scoped_ptr<ui::CursorLoader> cursor_loader_;
65 76
66 DISALLOW_COPY_AND_ASSIGN(DesktopNativeCursorManager); 77 DISALLOW_COPY_AND_ASSIGN(DesktopNativeCursorManager);
67 }; 78 };
68 79
69 } // namespace views 80 } // namespace views
70 81
71 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_ 82 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_
72 83
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698