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

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 (small fix for shelf auto-hide) 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/docked_window_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_DockedContainer,
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 docked_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 Docked windows layout manager
279 aura::Window* docked_container = GetContainer(
280 internal::kShellWindowId_DockedContainer);
281 docked_layout_manager_ =
282 new internal::DockedWindowLayoutManager(docked_container);
283 docked_container_handler_.reset(
284 new ToplevelWindowEventHandler(docked_container));
285 docked_container->SetLayoutManager(docked_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 // TODO(stevenjb/oshima): Remove this call to CreateLauncher() and call 296 // TODO(stevenjb/oshima): Remove this call to CreateLauncher() and call
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 switches::kAshCopyHostBackgroundAtBoot) || 331 switches::kAshCopyHostBackgroundAtBoot) ||
320 CommandLine::ForCurrentProcess()->HasSwitch( 332 CommandLine::ForCurrentProcess()->HasSwitch(
321 switches::kAshAnimateFromBootSplashScreen))) 333 switches::kAshAnimateFromBootSplashScreen)))
322 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); 334 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get()));
323 #endif 335 #endif
324 } 336 }
325 337
326 void RootWindowController::OnLauncherCreated() { 338 void RootWindowController::OnLauncherCreated() {
327 if (panel_layout_manager_) 339 if (panel_layout_manager_)
328 panel_layout_manager_->SetLauncher(shelf_->launcher()); 340 panel_layout_manager_->SetLauncher(shelf_->launcher());
341 if (docked_layout_manager_)
342 docked_layout_manager_->SetLauncher(shelf_->launcher());
329 } 343 }
330 344
331 void RootWindowController::ShowLauncher() { 345 void RootWindowController::ShowLauncher() {
332 if (!shelf_.get() || !shelf_->launcher()) 346 if (!shelf_.get() || !shelf_->launcher())
333 return; 347 return;
334 shelf_->launcher()->SetVisible(true); 348 shelf_->launcher()->SetVisible(true);
335 shelf_->status_area_widget()->Show(); 349 shelf_->status_area_widget()->Show();
336 } 350 }
337 351
338 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { 352 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 aura::Window* always_on_top_container = CreateContainer( 544 aura::Window* always_on_top_container = CreateContainer(
531 kShellWindowId_AlwaysOnTopContainer, 545 kShellWindowId_AlwaysOnTopContainer,
532 "AlwaysOnTopContainer", 546 "AlwaysOnTopContainer",
533 non_lock_screen_containers); 547 non_lock_screen_containers);
534 always_on_top_container_handler_.reset( 548 always_on_top_container_handler_.reset(
535 new ToplevelWindowEventHandler(always_on_top_container)); 549 new ToplevelWindowEventHandler(always_on_top_container));
536 views::corewm::SetChildWindowVisibilityChangesAnimated( 550 views::corewm::SetChildWindowVisibilityChangesAnimated(
537 always_on_top_container); 551 always_on_top_container);
538 SetUsesScreenCoordinates(always_on_top_container); 552 SetUsesScreenCoordinates(always_on_top_container);
539 553
554 aura::Window* docked_container = CreateContainer(
555 kShellWindowId_DockedContainer,
556 "DockedContainer",
557 non_lock_screen_containers);
558 SetUsesScreenCoordinates(docked_container);
559
540 aura::Window* panel_container = CreateContainer( 560 aura::Window* panel_container = CreateContainer(
541 kShellWindowId_PanelContainer, 561 kShellWindowId_PanelContainer,
542 "PanelContainer", 562 "PanelContainer",
543 non_lock_screen_containers); 563 non_lock_screen_containers);
544 SetUsesScreenCoordinates(panel_container); 564 SetUsesScreenCoordinates(panel_container);
545 565
546 aura::Window* launcher_container = 566 aura::Window* launcher_container =
547 CreateContainer(kShellWindowId_ShelfContainer, 567 CreateContainer(kShellWindowId_ShelfContainer,
548 "LauncherContainer", 568 "LauncherContainer",
549 non_lock_screen_containers); 569 non_lock_screen_containers);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 "OverlayContainer", 647 "OverlayContainer",
628 lock_screen_related_containers); 648 lock_screen_related_containers);
629 SetUsesScreenCoordinates(overlay_container); 649 SetUsesScreenCoordinates(overlay_container);
630 650
631 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 651 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
632 "PowerButtonAnimationContainer", root_window) ; 652 "PowerButtonAnimationContainer", root_window) ;
633 } 653 }
634 654
635 } // namespace internal 655 } // namespace internal
636 } // namespace ash 656 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698