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

Side by Side Diff: ui/aura/env.h

Issue 9808010: Keep the mouse cursor within desktop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 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) 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_ENV_H_ 5 #ifndef UI_AURA_ENV_H_
6 #define UI_AURA_ENV_H_ 6 #define UI_AURA_ENV_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "ui/aura/aura_export.h" 12 #include "ui/aura/aura_export.h"
13 #include "ui/aura/client/stacking_client.h" 13 #include "ui/aura/client/stacking_client.h"
14 14
15 namespace aura { 15 namespace aura {
16 16
17 class EnvObserver; 17 class EnvObserver;
18 class MonitorChangeObserverX11;
19 class MonitorManager; 18 class MonitorManager;
20 class Window; 19 class Window;
21 20
21 namespace internal {
22 class MonitorChangeObserverX11;
23 }
24
22 #if !defined(OS_MACOSX) 25 #if !defined(OS_MACOSX)
23 class Dispatcher : public MessageLoop::Dispatcher {
24 public:
25 virtual ~Dispatcher() {}
26 };
27
28 // Creates a platform-specific native event dispatcher. 26 // Creates a platform-specific native event dispatcher.
29 Dispatcher* CreateDispatcher(); 27 MessageLoop::Dispatcher* CreateDispatcher();
30 #endif 28 #endif
31 29
32 // A singleton object that tracks general state within Aura. 30 // A singleton object that tracks general state within Aura.
33 // TODO(beng): manage RootWindows. 31 // TODO(beng): manage RootWindows.
34 class AURA_EXPORT Env { 32 class AURA_EXPORT Env {
35 public: 33 public:
36 Env(); 34 Env();
37 ~Env(); 35 ~Env();
38 36
39 static Env* GetInstance(); 37 static Env* GetInstance();
40 static void DeleteInstance(); 38 static void DeleteInstance();
41 39
42 void AddObserver(EnvObserver* observer); 40 void AddObserver(EnvObserver* observer);
43 void RemoveObserver(EnvObserver* observer); 41 void RemoveObserver(EnvObserver* observer);
44 42
45 bool is_mouse_button_down() const { return mouse_button_flags_ != 0; } 43 bool is_mouse_button_down() const { return mouse_button_flags_ != 0; }
46 void set_mouse_button_flags(int mouse_button_flags) { 44 void set_mouse_button_flags(int mouse_button_flags) {
47 mouse_button_flags_ = mouse_button_flags; 45 mouse_button_flags_ = mouse_button_flags;
48 } 46 }
49 47
50 client::StackingClient* stacking_client() { return stacking_client_; } 48 client::StackingClient* stacking_client() { return stacking_client_; }
51 void set_stacking_client(client::StackingClient* stacking_client) { 49 void set_stacking_client(client::StackingClient* stacking_client) {
52 stacking_client_ = stacking_client; 50 stacking_client_ = stacking_client;
53 } 51 }
54 52
55 #if defined(USE_X11)
56 MonitorChangeObserverX11* monitor_change_observer() {
57 return monitor_change_observer_.get();
58 }
59 #endif
60
61 // Gets/sets MonitorManager. The MonitorManager's ownership is 53 // Gets/sets MonitorManager. The MonitorManager's ownership is
62 // transfered. 54 // transfered.
63 MonitorManager* monitor_manager() { return monitor_manager_.get(); } 55 MonitorManager* monitor_manager() { return monitor_manager_.get(); }
64 void SetMonitorManager(MonitorManager* monitor_manager); 56 void SetMonitorManager(MonitorManager* monitor_manager);
65 57
66 // Returns the native event dispatcher. The result should only be passed to 58 // Returns the native event dispatcher. The result should only be passed to
67 // MessageLoopForUI::RunWithDispatcher() or 59 // MessageLoopForUI::RunWithDispatcher() or
68 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch 60 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch
69 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored. 61 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored.
70 #if !defined(OS_MACOSX) 62 #if !defined(OS_MACOSX)
71 MessageLoop::Dispatcher* GetDispatcher(); 63 MessageLoop::Dispatcher* GetDispatcher();
72 #endif 64 #endif
73 65
74 private: 66 private:
75 friend class Window; 67 friend class Window;
76 68
69 void Init();
70
77 // Called by the Window when it is initialized. Notifies observers. 71 // Called by the Window when it is initialized. Notifies observers.
78 void NotifyWindowInitialized(Window* window); 72 void NotifyWindowInitialized(Window* window);
79 73
80 ObserverList<EnvObserver> observers_; 74 ObserverList<EnvObserver> observers_;
81 #if !defined(OS_MACOSX) 75 #if !defined(OS_MACOSX)
82 scoped_ptr<Dispatcher> dispatcher_; 76 scoped_ptr<MessageLoop::Dispatcher> dispatcher_;
83 #endif 77 #endif
84 78
85 static Env* instance_; 79 static Env* instance_;
86 int mouse_button_flags_; 80 int mouse_button_flags_;
87 client::StackingClient* stacking_client_; 81 client::StackingClient* stacking_client_;
88 scoped_ptr<MonitorManager> monitor_manager_; 82 scoped_ptr<MonitorManager> monitor_manager_;
89 83
90 #if defined(USE_X11) 84 #if defined(USE_X11)
91 scoped_ptr<MonitorChangeObserverX11> monitor_change_observer_; 85 scoped_ptr<internal::MonitorChangeObserverX11> monitor_change_observer_;
92 #endif 86 #endif
93 87
94 DISALLOW_COPY_AND_ASSIGN(Env); 88 DISALLOW_COPY_AND_ASSIGN(Env);
95 }; 89 };
96 90
97 } // namespace aura 91 } // namespace aura
98 92
99 #endif // UI_AURA_ENV_H_ 93 #endif // UI_AURA_ENV_H_
OLDNEW
« no previous file with comments | « ui/aura/dispatcher_win.cc ('k') | ui/aura/env.cc » ('j') | ui/aura/env.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698