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

Side by Side Diff: ash/root_window_controller.cc

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock with zero width (no logs) Created 7 years, 6 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
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 <vector> 7 #include <vector>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/desktop_background/desktop_background_widget_controller.h" 11 #include "ash/desktop_background/desktop_background_widget_controller.h"
12 #include "ash/display/display_controller.h" 12 #include "ash/display/display_controller.h"
13 #include "ash/display/display_manager.h" 13 #include "ash/display/display_manager.h"
14 #include "ash/focus_cycler.h" 14 #include "ash/focus_cycler.h"
15 #include "ash/session_state_delegate.h" 15 #include "ash/session_state_delegate.h"
16 #include "ash/shelf/shelf_layout_manager.h" 16 #include "ash/shelf/shelf_layout_manager.h"
17 #include "ash/shelf/shelf_types.h" 17 #include "ash/shelf/shelf_types.h"
18 #include "ash/shelf/shelf_widget.h" 18 #include "ash/shelf/shelf_widget.h"
19 #include "ash/shell.h" 19 #include "ash/shell.h"
20 #include "ash/shell_delegate.h" 20 #include "ash/shell_delegate.h"
21 #include "ash/shell_factory.h" 21 #include "ash/shell_factory.h"
22 #include "ash/shell_window_ids.h" 22 #include "ash/shell_window_ids.h"
23 #include "ash/system/status_area_widget.h" 23 #include "ash/system/status_area_widget.h"
24 #include "ash/system/tray/system_tray_delegate.h" 24 #include "ash/system/tray/system_tray_delegate.h"
25 #include "ash/touch/touch_observer_hud.h" 25 #include "ash/touch/touch_observer_hud.h"
26 #include "ash/wm/base_layout_manager.h" 26 #include "ash/wm/base_layout_manager.h"
27 #include "ash/wm/boot_splash_screen.h" 27 #include "ash/wm/boot_splash_screen.h"
28 #include "ash/wm/dock/dock_layout_manager.h"
28 #include "ash/wm/panels/panel_layout_manager.h" 29 #include "ash/wm/panels/panel_layout_manager.h"
29 #include "ash/wm/property_util.h" 30 #include "ash/wm/property_util.h"
30 #include "ash/wm/root_window_layout_manager.h" 31 #include "ash/wm/root_window_layout_manager.h"
31 #include "ash/wm/screen_dimmer.h" 32 #include "ash/wm/screen_dimmer.h"
32 #include "ash/wm/stacking_controller.h" 33 #include "ash/wm/stacking_controller.h"
33 #include "ash/wm/status_area_layout_manager.h" 34 #include "ash/wm/status_area_layout_manager.h"
34 #include "ash/wm/system_background_controller.h" 35 #include "ash/wm/system_background_controller.h"
35 #include "ash/wm/system_modal_container_layout_manager.h" 36 #include "ash/wm/system_modal_container_layout_manager.h"
36 #include "ash/wm/toplevel_window_event_handler.h" 37 #include "ash/wm/toplevel_window_event_handler.h"
37 #include "ash/wm/window_properties.h" 38 #include "ash/wm/window_properties.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 new_parent->AddChild(window); 105 new_parent->AddChild(window);
105 if (!restore_bounds.IsEmpty()) 106 if (!restore_bounds.IsEmpty())
106 SetRestoreBoundsInParent(window, restore_bounds); 107 SetRestoreBoundsInParent(window, restore_bounds);
107 } 108 }
108 109
109 // Reparents the appropriate set of windows from |src| to |dst|. 110 // Reparents the appropriate set of windows from |src| to |dst|.
110 void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) { 111 void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) {
111 // Set of windows to move. 112 // Set of windows to move.
112 const int kContainerIdsToMove[] = { 113 const int kContainerIdsToMove[] = {
113 internal::kShellWindowId_DefaultContainer, 114 internal::kShellWindowId_DefaultContainer,
115 internal::kShellWindowId_DockContainer,
114 internal::kShellWindowId_PanelContainer, 116 internal::kShellWindowId_PanelContainer,
115 internal::kShellWindowId_AlwaysOnTopContainer, 117 internal::kShellWindowId_AlwaysOnTopContainer,
116 internal::kShellWindowId_SystemModalContainer, 118 internal::kShellWindowId_SystemModalContainer,
117 internal::kShellWindowId_LockSystemModalContainer, 119 internal::kShellWindowId_LockSystemModalContainer,
118 internal::kShellWindowId_InputMethodContainer, 120 internal::kShellWindowId_InputMethodContainer,
119 internal::kShellWindowId_UnparentedControlContainer, 121 internal::kShellWindowId_UnparentedControlContainer,
120 }; 122 };
121 // For workspace windows we need to manually reparent the windows. This way 123 // For workspace windows we need to manually reparent the windows. This way
122 // workspace can move the windows to the appropriate workspace. 124 // workspace can move the windows to the appropriate workspace.
123 std::vector<aura::Window*> windows(GetWorkspaceWindows(src)); 125 std::vector<aura::Window*> windows(GetWorkspaceWindows(src));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 162 }
161 163
162 } // namespace 164 } // namespace
163 165
164 namespace internal { 166 namespace internal {
165 167
166 RootWindowController::RootWindowController(aura::RootWindow* root_window) 168 RootWindowController::RootWindowController(aura::RootWindow* root_window)
167 : root_window_(root_window), 169 : root_window_(root_window),
168 root_window_layout_(NULL), 170 root_window_layout_(NULL),
169 shelf_(NULL), 171 shelf_(NULL),
172 dock_layout_manager_(NULL),
170 panel_layout_manager_(NULL), 173 panel_layout_manager_(NULL),
171 touch_observer_hud_(NULL) { 174 touch_observer_hud_(NULL) {
172 SetRootWindowController(root_window, this); 175 SetRootWindowController(root_window, this);
173 screen_dimmer_.reset(new ScreenDimmer(root_window)); 176 screen_dimmer_.reset(new ScreenDimmer(root_window));
174 177
175 stacking_controller_.reset(new ash::StackingController); 178 stacking_controller_.reset(new ash::StackingController);
176 aura::client::SetStackingClient(root_window, stacking_controller_.get()); 179 aura::client::SetStackingClient(root_window, stacking_controller_.get());
177 } 180 }
178 181
179 RootWindowController::~RootWindowController() { 182 RootWindowController::~RootWindowController() {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 void RootWindowController::InitForPrimaryDisplay() { 268 void RootWindowController::InitForPrimaryDisplay() {
266 DCHECK(!shelf_.get()); 269 DCHECK(!shelf_.get());
267 aura::Window* shelf_container = 270 aura::Window* shelf_container =
268 GetContainer(ash::internal::kShellWindowId_ShelfContainer); 271 GetContainer(ash::internal::kShellWindowId_ShelfContainer);
269 // TODO(harrym): Remove when status area is view. 272 // TODO(harrym): Remove when status area is view.
270 aura::Window* status_container = 273 aura::Window* status_container =
271 GetContainer(ash::internal::kShellWindowId_StatusContainer); 274 GetContainer(ash::internal::kShellWindowId_StatusContainer);
272 shelf_.reset(new ash::ShelfWidget( 275 shelf_.reset(new ash::ShelfWidget(
273 shelf_container, status_container, workspace_controller())); 276 shelf_container, status_container, workspace_controller()));
274 277
278 // Create Dock layout manager
279 aura::Window* dock_container = GetContainer(
280 internal::kShellWindowId_DockContainer);
281 dock_layout_manager_ =
282 new internal::DockLayoutManager(dock_container);
283 dock_container_handler_.reset(
284 new ToplevelWindowEventHandler(dock_container));
285 dock_container->SetLayoutManager(dock_layout_manager_);
286
275 // Create Panel layout manager 287 // Create Panel layout manager
276 aura::Window* panel_container = GetContainer( 288 aura::Window* panel_container = GetContainer(
277 internal::kShellWindowId_PanelContainer); 289 internal::kShellWindowId_PanelContainer);
278 panel_layout_manager_ = 290 panel_layout_manager_ =
279 new internal::PanelLayoutManager(panel_container); 291 new internal::PanelLayoutManager(panel_container);
280 panel_container_handler_.reset( 292 panel_container_handler_.reset(
281 new ToplevelWindowEventHandler(panel_container)); 293 new ToplevelWindowEventHandler(panel_container));
282 panel_container->SetLayoutManager(panel_layout_manager_); 294 panel_container->SetLayoutManager(panel_layout_manager_);
283 295
284 if (Shell::GetInstance()->session_state_delegate()->NumberOfLoggedInUsers()) 296 if (Shell::GetInstance()->session_state_delegate()->NumberOfLoggedInUsers())
(...skipping 30 matching lines...) Expand all
315 switches::kAshCopyHostBackgroundAtBoot) || 327 switches::kAshCopyHostBackgroundAtBoot) ||
316 CommandLine::ForCurrentProcess()->HasSwitch( 328 CommandLine::ForCurrentProcess()->HasSwitch(
317 switches::kAshAnimateFromBootSplashScreen))) 329 switches::kAshAnimateFromBootSplashScreen)))
318 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); 330 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get()));
319 #endif 331 #endif
320 } 332 }
321 333
322 void RootWindowController::OnLauncherCreated() { 334 void RootWindowController::OnLauncherCreated() {
323 if (panel_layout_manager_) 335 if (panel_layout_manager_)
324 panel_layout_manager_->SetLauncher(shelf_->launcher()); 336 panel_layout_manager_->SetLauncher(shelf_->launcher());
337 if (dock_layout_manager_)
338 dock_layout_manager_->SetLauncher(shelf_->launcher());
325 } 339 }
326 340
327 void RootWindowController::ShowLauncher() { 341 void RootWindowController::ShowLauncher() {
328 if (!shelf_.get() || !shelf_->launcher()) 342 if (!shelf_.get() || !shelf_->launcher())
329 return; 343 return;
330 shelf_->launcher()->SetVisible(true); 344 shelf_->launcher()->SetVisible(true);
331 shelf_->status_area_widget()->Show(); 345 shelf_->status_area_widget()->Show();
332 } 346 }
333 347
334 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { 348 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
(...skipping 24 matching lines...) Expand all
359 system_background_->SetColor(SK_ColorBLACK); 373 system_background_->SetColor(SK_ColorBLACK);
360 boot_splash_screen_.reset(); 374 boot_splash_screen_.reset();
361 } 375 }
362 376
363 void RootWindowController::CloseChildWindows() { 377 void RootWindowController::CloseChildWindows() {
364 // panel_layout_manager_ needs to be shut down before windows are destroyed. 378 // panel_layout_manager_ needs to be shut down before windows are destroyed.
365 if (panel_layout_manager_) { 379 if (panel_layout_manager_) {
366 panel_layout_manager_->Shutdown(); 380 panel_layout_manager_->Shutdown();
367 panel_layout_manager_ = NULL; 381 panel_layout_manager_ = NULL;
368 } 382 }
383 if (dock_layout_manager_) {
384 dock_layout_manager_->Shutdown();
385 dock_layout_manager_ = NULL;
386 }
369 387
370 // TODO(harrym): Remove when Status Area Widget is a child view. 388 // TODO(harrym): Remove when Status Area Widget is a child view.
371 if (shelf_) 389 if (shelf_)
372 shelf_->ShutdownStatusAreaWidget(); 390 shelf_->ShutdownStatusAreaWidget();
373 391
374 if (shelf_.get() && shelf_->shelf_layout_manager()) 392 if (shelf_.get() && shelf_->shelf_layout_manager())
375 shelf_->shelf_layout_manager()->set_workspace_controller(NULL); 393 shelf_->shelf_layout_manager()->set_workspace_controller(NULL);
376 394
377 // Close background widget first as it depends on tooltip. 395 // Close background widget first as it depends on tooltip.
378 root_window_->SetProperty(kDesktopController, 396 root_window_->SetProperty(kDesktopController,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 aura::Window* always_on_top_container = CreateContainer( 544 aura::Window* always_on_top_container = CreateContainer(
527 kShellWindowId_AlwaysOnTopContainer, 545 kShellWindowId_AlwaysOnTopContainer,
528 "AlwaysOnTopContainer", 546 "AlwaysOnTopContainer",
529 non_lock_screen_containers); 547 non_lock_screen_containers);
530 always_on_top_container_handler_.reset( 548 always_on_top_container_handler_.reset(
531 new ToplevelWindowEventHandler(always_on_top_container)); 549 new ToplevelWindowEventHandler(always_on_top_container));
532 views::corewm::SetChildWindowVisibilityChangesAnimated( 550 views::corewm::SetChildWindowVisibilityChangesAnimated(
533 always_on_top_container); 551 always_on_top_container);
534 SetUsesScreenCoordinates(always_on_top_container); 552 SetUsesScreenCoordinates(always_on_top_container);
535 553
554 aura::Window* dock_container = CreateContainer(
555 kShellWindowId_DockContainer,
556 "DockContainer",
557 non_lock_screen_containers);
558 SetUsesScreenCoordinates(dock_container);
559
536 aura::Window* panel_container = CreateContainer( 560 aura::Window* panel_container = CreateContainer(
537 kShellWindowId_PanelContainer, 561 kShellWindowId_PanelContainer,
538 "PanelContainer", 562 "PanelContainer",
539 non_lock_screen_containers); 563 non_lock_screen_containers);
540 SetUsesScreenCoordinates(panel_container); 564 SetUsesScreenCoordinates(panel_container);
541 565
542 aura::Window* launcher_container = 566 aura::Window* launcher_container =
543 CreateContainer(kShellWindowId_ShelfContainer, 567 CreateContainer(kShellWindowId_ShelfContainer,
544 "LauncherContainer", 568 "LauncherContainer",
545 non_lock_screen_containers); 569 non_lock_screen_containers);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 "OverlayContainer", 647 "OverlayContainer",
624 lock_screen_related_containers); 648 lock_screen_related_containers);
625 SetUsesScreenCoordinates(overlay_container); 649 SetUsesScreenCoordinates(overlay_container);
626 650
627 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 651 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
628 "PowerButtonAnimationContainer", root_window) ; 652 "PowerButtonAnimationContainer", root_window) ;
629 } 653 }
630 654
631 } // namespace internal 655 } // namespace internal
632 } // namespace ash 656 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/shell_window_ids.h » ('j') | ash/shell_window_ids.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698