OLD | NEW |
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 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "ui/aura/aura_export.h" | 11 #include "ui/aura/aura_export.h" |
12 #include "ui/aura/cursor_manager.h" | |
13 #include "ui/aura/client/stacking_client.h" | 12 #include "ui/aura/client/stacking_client.h" |
14 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
15 | 14 |
16 namespace aura { | 15 namespace aura { |
17 class CursorManager; | |
18 class EnvObserver; | 16 class EnvObserver; |
19 class EventFilter; | 17 class EventFilter; |
20 class DisplayManager; | 18 class DisplayManager; |
21 class Window; | 19 class Window; |
22 | 20 |
23 namespace internal { | 21 namespace internal { |
24 class DisplayChangeObserverX11; | 22 class DisplayChangeObserverX11; |
25 } | 23 } |
26 | 24 |
27 #if !defined(OS_MACOSX) | 25 #if !defined(OS_MACOSX) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 69 |
72 // Gets/sets DisplayManager. The DisplayManager's ownership is | 70 // Gets/sets DisplayManager. The DisplayManager's ownership is |
73 // transfered. | 71 // transfered. |
74 DisplayManager* display_manager() { return display_manager_.get(); } | 72 DisplayManager* display_manager() { return display_manager_.get(); } |
75 void SetDisplayManager(DisplayManager* display_manager); | 73 void SetDisplayManager(DisplayManager* display_manager); |
76 | 74 |
77 // Env takes ownership of the EventFilter. | 75 // Env takes ownership of the EventFilter. |
78 EventFilter* event_filter() { return event_filter_.get(); } | 76 EventFilter* event_filter() { return event_filter_.get(); } |
79 void SetEventFilter(EventFilter* event_filter); | 77 void SetEventFilter(EventFilter* event_filter); |
80 | 78 |
81 CursorManager* cursor_manager() { return &cursor_manager_; } | |
82 | |
83 // Returns the native event dispatcher. The result should only be passed to | 79 // Returns the native event dispatcher. The result should only be passed to |
84 // base::RunLoop(dispatcher), or used to dispatch an event by | 80 // base::RunLoop(dispatcher), or used to dispatch an event by |
85 // |Dispatch(const NativeEvent&)| on it. It must never be stored. | 81 // |Dispatch(const NativeEvent&)| on it. It must never be stored. |
86 #if !defined(OS_MACOSX) | 82 #if !defined(OS_MACOSX) |
87 MessageLoop::Dispatcher* GetDispatcher(); | 83 MessageLoop::Dispatcher* GetDispatcher(); |
88 #endif | 84 #endif |
89 | 85 |
90 private: | 86 private: |
91 friend class Window; | 87 friend class Window; |
92 | 88 |
93 void Init(); | 89 void Init(); |
94 | 90 |
95 // Called by the Window when it is initialized. Notifies observers. | 91 // Called by the Window when it is initialized. Notifies observers. |
96 void NotifyWindowInitialized(Window* window); | 92 void NotifyWindowInitialized(Window* window); |
97 | 93 |
98 ObserverList<EnvObserver> observers_; | 94 ObserverList<EnvObserver> observers_; |
99 #if !defined(OS_MACOSX) | 95 #if !defined(OS_MACOSX) |
100 scoped_ptr<MessageLoop::Dispatcher> dispatcher_; | 96 scoped_ptr<MessageLoop::Dispatcher> dispatcher_; |
101 #endif | 97 #endif |
102 | 98 |
103 static Env* instance_; | 99 static Env* instance_; |
104 int mouse_button_flags_; | 100 int mouse_button_flags_; |
105 // Location of last mouse event, in screen coordinates. | 101 // Location of last mouse event, in screen coordinates. |
106 gfx::Point last_mouse_location_; | 102 gfx::Point last_mouse_location_; |
107 bool is_touch_down_; | 103 bool is_touch_down_; |
108 bool render_white_bg_; | 104 bool render_white_bg_; |
109 client::StackingClient* stacking_client_; | 105 client::StackingClient* stacking_client_; |
110 scoped_ptr<DisplayManager> display_manager_; | 106 scoped_ptr<DisplayManager> display_manager_; |
111 scoped_ptr<EventFilter> event_filter_; | 107 scoped_ptr<EventFilter> event_filter_; |
112 CursorManager cursor_manager_; | |
113 | 108 |
114 #if defined(USE_X11) | 109 #if defined(USE_X11) |
115 scoped_ptr<internal::DisplayChangeObserverX11> display_change_observer_; | 110 scoped_ptr<internal::DisplayChangeObserverX11> display_change_observer_; |
116 #endif | 111 #endif |
117 | 112 |
118 DISALLOW_COPY_AND_ASSIGN(Env); | 113 DISALLOW_COPY_AND_ASSIGN(Env); |
119 }; | 114 }; |
120 | 115 |
121 } // namespace aura | 116 } // namespace aura |
122 | 117 |
123 #endif // UI_AURA_ENV_H_ | 118 #endif // UI_AURA_ENV_H_ |
OLD | NEW |