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

Side by Side Diff: ash/root_window_controller.cc

Issue 24020002: Move GetRootWindowController() to root_window_controller.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 #include "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 14 matching lines...) Expand all
25 #include "ash/system/status_area_widget.h" 25 #include "ash/system/status_area_widget.h"
26 #include "ash/system/tray/system_tray_delegate.h" 26 #include "ash/system/tray/system_tray_delegate.h"
27 #include "ash/touch/touch_hud_debug.h" 27 #include "ash/touch/touch_hud_debug.h"
28 #include "ash/touch/touch_hud_projection.h" 28 #include "ash/touch/touch_hud_projection.h"
29 #include "ash/touch/touch_observer_hud.h" 29 #include "ash/touch/touch_observer_hud.h"
30 #include "ash/wm/always_on_top_controller.h" 30 #include "ash/wm/always_on_top_controller.h"
31 #include "ash/wm/base_layout_manager.h" 31 #include "ash/wm/base_layout_manager.h"
32 #include "ash/wm/dock/docked_window_layout_manager.h" 32 #include "ash/wm/dock/docked_window_layout_manager.h"
33 #include "ash/wm/panels/panel_layout_manager.h" 33 #include "ash/wm/panels/panel_layout_manager.h"
34 #include "ash/wm/panels/panel_window_event_handler.h" 34 #include "ash/wm/panels/panel_window_event_handler.h"
35 #include "ash/wm/property_util.h"
36 #include "ash/wm/root_window_layout_manager.h" 35 #include "ash/wm/root_window_layout_manager.h"
37 #include "ash/wm/screen_dimmer.h" 36 #include "ash/wm/screen_dimmer.h"
38 #include "ash/wm/stacking_controller.h" 37 #include "ash/wm/stacking_controller.h"
39 #include "ash/wm/status_area_layout_manager.h" 38 #include "ash/wm/status_area_layout_manager.h"
40 #include "ash/wm/system_background_controller.h" 39 #include "ash/wm/system_background_controller.h"
41 #include "ash/wm/system_modal_container_layout_manager.h" 40 #include "ash/wm/system_modal_container_layout_manager.h"
42 #include "ash/wm/toplevel_window_event_handler.h" 41 #include "ash/wm/toplevel_window_event_handler.h"
43 #include "ash/wm/window_properties.h" 42 #include "ash/wm/window_properties.h"
44 #include "ash/wm/window_util.h" 43 #include "ash/wm/window_util.h"
45 #include "ash/wm/workspace_controller.h" 44 #include "ash/wm/workspace_controller.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 211
213 namespace internal { 212 namespace internal {
214 213
215 RootWindowController::RootWindowController(aura::RootWindow* root_window) 214 RootWindowController::RootWindowController(aura::RootWindow* root_window)
216 : root_window_(root_window), 215 : root_window_(root_window),
217 root_window_layout_(NULL), 216 root_window_layout_(NULL),
218 docked_layout_manager_(NULL), 217 docked_layout_manager_(NULL),
219 panel_layout_manager_(NULL), 218 panel_layout_manager_(NULL),
220 touch_hud_debug_(NULL), 219 touch_hud_debug_(NULL),
221 touch_hud_projection_(NULL) { 220 touch_hud_projection_(NULL) {
222 SetRootWindowController(root_window, this); 221 GetRootWindowSettings(root_window)->controller = this;
223 screen_dimmer_.reset(new ScreenDimmer(root_window)); 222 screen_dimmer_.reset(new ScreenDimmer(root_window));
224 223
225 stacking_controller_.reset(new StackingController); 224 stacking_controller_.reset(new StackingController);
226 aura::client::SetStackingClient(root_window, stacking_controller_.get()); 225 aura::client::SetStackingClient(root_window, stacking_controller_.get());
227 capture_client_.reset(new views::corewm::ScopedCaptureClient(root_window)); 226 capture_client_.reset(new views::corewm::ScopedCaptureClient(root_window));
228 } 227 }
229 228
230 RootWindowController::~RootWindowController() { 229 RootWindowController::~RootWindowController() {
231 Shutdown(); 230 Shutdown();
232 root_window_.reset(); 231 root_window_.reset();
233 // The CaptureClient needs to be around for as long as the RootWindow is 232 // The CaptureClient needs to be around for as long as the RootWindow is
234 // valid. 233 // valid.
235 capture_client_.reset(); 234 capture_client_.reset();
236 } 235 }
237 236
238 // static 237 // static
239 RootWindowController* RootWindowController::ForLauncher(aura::Window* window) { 238 RootWindowController* RootWindowController::ForLauncher(aura::Window* window) {
240 return GetRootWindowController(window->GetRootWindow()); 239 return GetRootWindowController(window->GetRootWindow());
241 } 240 }
242 241
243 // static 242 // static
244 RootWindowController* RootWindowController::ForWindow( 243 RootWindowController* RootWindowController::ForWindow(
245 const aura::Window* window) { 244 const aura::Window* window) {
246 return GetRootWindowController(window->GetRootWindow()); 245 return GetRootWindowController(window->GetRootWindow());
247 } 246 }
248 247
249 // static 248 // static
250 RootWindowController* RootWindowController::ForActiveRootWindow() { 249 RootWindowController* RootWindowController::ForActiveRootWindow() {
251 return GetRootWindowController(Shell::GetActiveRootWindow()); 250 return internal::GetRootWindowController(Shell::GetActiveRootWindow());
252 } 251 }
253 252
254 void RootWindowController::SetWallpaperController( 253 void RootWindowController::SetWallpaperController(
255 DesktopBackgroundWidgetController* controller) { 254 DesktopBackgroundWidgetController* controller) {
256 wallpaper_controller_.reset(controller); 255 wallpaper_controller_.reset(controller);
257 } 256 }
258 257
259 void RootWindowController::SetAnimatingWallpaperController( 258 void RootWindowController::SetAnimatingWallpaperController(
260 AnimatingDesktopController* controller) { 259 AnimatingDesktopController* controller) {
261 if (animating_wallpaper_controller_.get()) 260 if (animating_wallpaper_controller_.get())
(...skipping 13 matching lines...) Expand all
275 // being removed triggers a relayout of the shelf it will try to build a 274 // being removed triggers a relayout of the shelf it will try to build a
276 // window list adding windows from the active root window's containers which 275 // window list adding windows from the active root window's containers which
277 // may have already gone away. 276 // may have already gone away.
278 if (Shell::GetActiveRootWindow() == root_window_) { 277 if (Shell::GetActiveRootWindow() == root_window_) {
279 Shell::GetInstance()->set_active_root_window( 278 Shell::GetInstance()->set_active_root_window(
280 Shell::GetPrimaryRootWindow() == root_window_.get() ? 279 Shell::GetPrimaryRootWindow() == root_window_.get() ?
281 NULL : Shell::GetPrimaryRootWindow()); 280 NULL : Shell::GetPrimaryRootWindow());
282 } 281 }
283 282
284 CloseChildWindows(); 283 CloseChildWindows();
285 SetRootWindowController(root_window_.get(), NULL); 284 GetRootWindowSettings(root_window_.get())->controller = NULL;
286 screen_dimmer_.reset(); 285 screen_dimmer_.reset();
287 workspace_controller_.reset(); 286 workspace_controller_.reset();
288 // Forget with the display ID so that display lookup 287 // Forget with the display ID so that display lookup
289 // ends up with invalid display. 288 // ends up with invalid display.
290 internal::GetRootWindowSettings(root_window_.get())->display_id = 289 internal::GetRootWindowSettings(root_window_.get())->display_id =
291 gfx::Display::kInvalidDisplayID; 290 gfx::Display::kInvalidDisplayID;
292 // And this root window should no longer process events. 291 // And this root window should no longer process events.
293 root_window_->PrepareForShutdown(); 292 root_window_->PrepareForShutdown();
294 293
295 system_background_.reset(); 294 system_background_.reset();
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 shelf_->shelf_layout_manager()->UpdateVisibilityState(); 810 shelf_->shelf_layout_manager()->UpdateVisibilityState();
812 } 811 }
813 812
814 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { 813 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) {
815 if (enabled) 814 if (enabled)
816 EnableTouchHudProjection(); 815 EnableTouchHudProjection();
817 else 816 else
818 DisableTouchHudProjection(); 817 DisableTouchHudProjection();
819 } 818 }
820 819
820 RootWindowController* GetRootWindowController(
821 const aura::RootWindow* root_window) {
822 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
Daniel Erat 2013/09/06 01:00:35 is it valid to pass a NULL root window, or would i
oshima 2013/09/06 01:11:06 It is valid. This is to avoid boiler plate code li
823 }
824
821 } // namespace internal 825 } // namespace internal
822 } // namespace ash 826 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698