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

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

Issue 8894018: Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | « ui/aura/demo/demo_main.cc ('k') | ui/aura/root_window.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) 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
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_; }
61 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } 60 Window* mouse_pressed_handler() { return mouse_pressed_handler_; }
62 Window* capture_window() { return capture_window_; } 61 Window* capture_window() { return capture_window_; }
63 ScreenAura* screen() { return screen_; } 62 ScreenAura* screen() { return screen_; }
64 63
65 void SetStackingClient(StackingClient* stacking_client); 64 void SetStackingClient(StackingClient* stacking_client);
66 65
67 // Shows the root window host. 66 // Shows the root window host.
68 void ShowRootWindow(); 67 void ShowRootWindow();
69 68
70 // Sets the size of the root window. 69 // Sets the size of the root window.
(...skipping 17 matching lines...) Expand all
88 87
89 // Handles a touch event. Returns true if handled. 88 // Handles a touch event. Returns true if handled.
90 bool DispatchTouchEvent(TouchEvent* event); 89 bool DispatchTouchEvent(TouchEvent* event);
91 90
92 // Called when the host changes size. 91 // Called when the host changes size.
93 void OnHostResized(const gfx::Size& size); 92 void OnHostResized(const gfx::Size& size);
94 93
95 // Called when the native screen's resolution changes. 94 // Called when the native screen's resolution changes.
96 void OnNativeScreenResized(const gfx::Size& size); 95 void OnNativeScreenResized(const gfx::Size& size);
97 96
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
112 // Invoked when |window| is initialized. 97 // Invoked when |window| is initialized.
113 void WindowInitialized(Window* window); 98 void WindowInitialized(Window* window);
114 99
115 // Invoked when |window| is being destroyed. 100 // Invoked when |window| is being destroyed.
116 void WindowDestroying(Window* window); 101 void WindowDestroying(Window* window);
117 102
118 // Returns the root window's dispatcher. The result should only be passed to 103 // Returns the root window's dispatcher. The result should only be passed to
119 // MessageLoopForUI::RunWithDispatcher() or 104 // MessageLoopForUI::RunWithDispatcher() or
120 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch 105 // MessageLoopForUI::RunAllPendingWithDispatcher(), or used to dispatch
121 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored. 106 // an event by |Dispatch(const NativeEvent&)| on it. It must never be stored.
122 MessageLoop::Dispatcher* GetDispatcher(); 107 MessageLoop::Dispatcher* GetDispatcher();
123 108
124 // Add/remove observer. 109 // Add/remove observer.
125 void AddObserver(RootWindowObserver* observer); 110 void AddRootWindowObserver(RootWindowObserver* observer);
126 void RemoveObserver(RootWindowObserver* observer); 111 void RemoveRootWindowObserver(RootWindowObserver* observer);
127 112
128 // Are any mouse buttons currently down? 113 // Are any mouse buttons currently down?
129 bool IsMouseButtonDown() const; 114 bool IsMouseButtonDown() const;
130 115
131 // Posts |native_event| to the platform's event queue. 116 // Posts |native_event| to the platform's event queue.
132 void PostNativeEvent(const base::NativeEvent& native_event); 117 void PostNativeEvent(const base::NativeEvent& native_event);
133 118
134 // Converts |point| from the root window's coordinate system to native 119 // Converts |point| from the root window's coordinate system to native
135 // screen's. 120 // screen's.
136 void ConvertPointToNativeScreen(gfx::Point* point) const; 121 void ConvertPointToNativeScreen(gfx::Point* point) const;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 static RootWindow* instance_; 186 static RootWindow* instance_;
202 187
203 // If set before the RootWindow is created, the host window will cover the 188 // If set before the RootWindow is created, the host window will cover the
204 // entire screen. Note that this can still be overridden via the 189 // entire screen. Note that this can still be overridden via the
205 // switches::kAuraHostWindowSize flag. 190 // switches::kAuraHostWindowSize flag.
206 static bool use_fullscreen_host_window_; 191 static bool use_fullscreen_host_window_;
207 192
208 // Used to schedule painting. 193 // Used to schedule painting.
209 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; 194 base::WeakPtrFactory<RootWindow> schedule_paint_factory_;
210 195
211 Window* active_window_;
212
213 // Last location seen in a mouse event. 196 // Last location seen in a mouse event.
214 gfx::Point last_mouse_location_; 197 gfx::Point last_mouse_location_;
215 198
216 // ui::EventFlags containing the current state of the mouse buttons. 199 // ui::EventFlags containing the current state of the mouse buttons.
217 int mouse_button_flags_; 200 int mouse_button_flags_;
218 201
219 // Last cursor set. Used for testing. 202 // Last cursor set. Used for testing.
220 gfx::NativeCursor last_cursor_; 203 gfx::NativeCursor last_cursor_;
221 204
222 // Are we in the process of being destroyed? Used to avoid processing during
223 // destruction.
224 bool in_destructor_;
225
226 ObserverList<RootWindowObserver> observers_; 205 ObserverList<RootWindowObserver> observers_;
227 206
228 ScreenAura* screen_; 207 ScreenAura* screen_;
229 208
230 // The capture window. When not-null, this window receives all the mouse and 209 // The capture window. When not-null, this window receives all the mouse and
231 // touch events. 210 // touch events.
232 Window* capture_window_; 211 Window* capture_window_;
233 212
234 Window* mouse_pressed_handler_; 213 Window* mouse_pressed_handler_;
235 Window* mouse_moved_handler_; 214 Window* mouse_moved_handler_;
236 Window* focused_window_; 215 Window* focused_window_;
237 Window* touch_event_handler_; 216 Window* touch_event_handler_;
238 217
239 DISALLOW_COPY_AND_ASSIGN(RootWindow); 218 DISALLOW_COPY_AND_ASSIGN(RootWindow);
240 }; 219 };
241 220
242 } // namespace aura 221 } // namespace aura
243 222
244 #endif // UI_AURA_ROOT_WINDOW_H_ 223 #endif // UI_AURA_ROOT_WINDOW_H_
OLDNEW
« no previous file with comments | « ui/aura/demo/demo_main.cc ('k') | ui/aura/root_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698