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

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

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

Powered by Google App Engine
This is Rietveld 408576698