| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ROOT_WINDOW_H_ | 5 #ifndef UI_AURA_ROOT_WINDOW_H_ |
| 6 #define UI_AURA_ROOT_WINDOW_H_ | 6 #define UI_AURA_ROOT_WINDOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 static void DeleteInstance(); | 50 static void DeleteInstance(); |
| 51 | 51 |
| 52 static void set_use_fullscreen_host_window(bool use_fullscreen) { | 52 static void set_use_fullscreen_host_window(bool use_fullscreen) { |
| 53 use_fullscreen_host_window_ = use_fullscreen; | 53 use_fullscreen_host_window_ = use_fullscreen; |
| 54 } | 54 } |
| 55 | 55 |
| 56 ui::Compositor* compositor() { return compositor_.get(); } | 56 ui::Compositor* compositor() { return compositor_.get(); } |
| 57 gfx::Point last_mouse_location() const { return last_mouse_location_; } | 57 gfx::Point last_mouse_location() const { return last_mouse_location_; } |
| 58 gfx::NativeCursor last_cursor() const { return last_cursor_; } | 58 gfx::NativeCursor last_cursor() const { return last_cursor_; } |
| 59 StackingClient* stacking_client() { return stacking_client_.get(); } | 59 StackingClient* stacking_client() { return stacking_client_.get(); } |
| 60 Window* active_window() { return active_window_; } |
| 60 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } | 61 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } |
| 61 Window* capture_window() { return capture_window_; } | 62 Window* capture_window() { return capture_window_; } |
| 62 ScreenAura* screen() { return screen_; } | 63 ScreenAura* screen() { return screen_; } |
| 63 | 64 |
| 64 void SetStackingClient(StackingClient* stacking_client); | 65 void SetStackingClient(StackingClient* stacking_client); |
| 65 | 66 |
| 66 // Shows the root window host. | 67 // Shows the root window host. |
| 67 void ShowRootWindow(); | 68 void ShowRootWindow(); |
| 68 | 69 |
| 69 // Sets the size of the root window. | 70 // Sets the size of the root window. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 | 88 |
| 88 // Handles a touch event. Returns true if handled. | 89 // Handles a touch event. Returns true if handled. |
| 89 bool DispatchTouchEvent(TouchEvent* event); | 90 bool DispatchTouchEvent(TouchEvent* event); |
| 90 | 91 |
| 91 // Called when the host changes size. | 92 // Called when the host changes size. |
| 92 void OnHostResized(const gfx::Size& size); | 93 void OnHostResized(const gfx::Size& size); |
| 93 | 94 |
| 94 // Called when the native screen's resolution changes. | 95 // Called when the native screen's resolution changes. |
| 95 void OnNativeScreenResized(const gfx::Size& size); | 96 void OnNativeScreenResized(const gfx::Size& size); |
| 96 | 97 |
| 98 // Sets the active window to |window| and the focused window to |to_focus|. |
| 99 // If |to_focus| is NULL, |window| is focused. Does nothing if |window| is |
| 100 // NULL. |
| 101 void SetActiveWindow(Window* window, Window* to_focus); |
| 102 |
| 103 // Activates the topmost window. Does nothing if the topmost window is already |
| 104 // active. |
| 105 void ActivateTopmostWindow(); |
| 106 |
| 107 // Deactivates |window| and activates the topmost window. Does nothing if |
| 108 // |window| is not a topmost window, or there are no other suitable windows to |
| 109 // activate. |
| 110 void Deactivate(Window* window); |
| 111 |
| 97 // Invoked when |window| is initialized. | 112 // Invoked when |window| is initialized. |
| 98 void WindowInitialized(Window* window); | 113 void WindowInitialized(Window* window); |
| 99 | 114 |
| 100 // Invoked when |window| is being destroyed. | 115 // Invoked when |window| is being destroyed. |
| 101 void WindowDestroying(Window* window); | 116 void WindowDestroying(Window* window); |
| 102 | 117 |
| 103 // Returns the root window's dispatcher. The result should only be passed to | 118 // Returns the root window's dispatcher. The result should only be passed to |
| 104 // MessageLoopForUI::RunWithDispatcher() or | 119 // MessageLoopForUI::RunWithDispatcher() or |
| 105 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch | 120 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch |
| 106 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored. | 121 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored. |
| 107 MessageLoop::Dispatcher* GetDispatcher(); | 122 MessageLoop::Dispatcher* GetDispatcher(); |
| 108 | 123 |
| 109 // Add/remove observer. | 124 // Add/remove observer. |
| 110 void AddRootWindowObserver(RootWindowObserver* observer); | 125 void AddObserver(RootWindowObserver* observer); |
| 111 void RemoveRootWindowObserver(RootWindowObserver* observer); | 126 void RemoveObserver(RootWindowObserver* observer); |
| 112 | 127 |
| 113 // Are any mouse buttons currently down? | 128 // Are any mouse buttons currently down? |
| 114 bool IsMouseButtonDown() const; | 129 bool IsMouseButtonDown() const; |
| 115 | 130 |
| 116 // Posts |native_event| to the platform's event queue. | 131 // Posts |native_event| to the platform's event queue. |
| 117 void PostNativeEvent(const base::NativeEvent& native_event); | 132 void PostNativeEvent(const base::NativeEvent& native_event); |
| 118 | 133 |
| 119 // Converts |point| from the root window's coordinate system to native | 134 // Converts |point| from the root window's coordinate system to native |
| 120 // screen's. | 135 // screen's. |
| 121 void ConvertPointToNativeScreen(gfx::Point* point) const; | 136 void ConvertPointToNativeScreen(gfx::Point* point) const; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 static RootWindow* instance_; | 201 static RootWindow* instance_; |
| 187 | 202 |
| 188 // If set before the RootWindow is created, the host window will cover the | 203 // If set before the RootWindow is created, the host window will cover the |
| 189 // entire screen. Note that this can still be overridden via the | 204 // entire screen. Note that this can still be overridden via the |
| 190 // switches::kAuraHostWindowSize flag. | 205 // switches::kAuraHostWindowSize flag. |
| 191 static bool use_fullscreen_host_window_; | 206 static bool use_fullscreen_host_window_; |
| 192 | 207 |
| 193 // Used to schedule painting. | 208 // Used to schedule painting. |
| 194 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; | 209 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; |
| 195 | 210 |
| 211 Window* active_window_; |
| 212 |
| 196 // Last location seen in a mouse event. | 213 // Last location seen in a mouse event. |
| 197 gfx::Point last_mouse_location_; | 214 gfx::Point last_mouse_location_; |
| 198 | 215 |
| 199 // ui::EventFlags containing the current state of the mouse buttons. | 216 // ui::EventFlags containing the current state of the mouse buttons. |
| 200 int mouse_button_flags_; | 217 int mouse_button_flags_; |
| 201 | 218 |
| 202 // Last cursor set. Used for testing. | 219 // Last cursor set. Used for testing. |
| 203 gfx::NativeCursor last_cursor_; | 220 gfx::NativeCursor last_cursor_; |
| 204 | 221 |
| 222 // Are we in the process of being destroyed? Used to avoid processing during |
| 223 // destruction. |
| 224 bool in_destructor_; |
| 225 |
| 205 ObserverList<RootWindowObserver> observers_; | 226 ObserverList<RootWindowObserver> observers_; |
| 206 | 227 |
| 207 ScreenAura* screen_; | 228 ScreenAura* screen_; |
| 208 | 229 |
| 209 // The capture window. When not-null, this window receives all the mouse and | 230 // The capture window. When not-null, this window receives all the mouse and |
| 210 // touch events. | 231 // touch events. |
| 211 Window* capture_window_; | 232 Window* capture_window_; |
| 212 | 233 |
| 213 Window* mouse_pressed_handler_; | 234 Window* mouse_pressed_handler_; |
| 214 Window* mouse_moved_handler_; | 235 Window* mouse_moved_handler_; |
| 215 Window* focused_window_; | 236 Window* focused_window_; |
| 216 Window* touch_event_handler_; | 237 Window* touch_event_handler_; |
| 217 | 238 |
| 218 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 239 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
| 219 }; | 240 }; |
| 220 | 241 |
| 221 } // namespace aura | 242 } // namespace aura |
| 222 | 243 |
| 223 #endif // UI_AURA_ROOT_WINDOW_H_ | 244 #endif // UI_AURA_ROOT_WINDOW_H_ |
| OLD | NEW |