OLD | NEW |
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" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 aura::client::SetStackingClient(root_window, stacking_controller_.get()); | 176 aura::client::SetStackingClient(root_window, stacking_controller_.get()); |
177 } | 177 } |
178 | 178 |
179 RootWindowController::~RootWindowController() { | 179 RootWindowController::~RootWindowController() { |
180 Shutdown(); | 180 Shutdown(); |
181 root_window_.reset(); | 181 root_window_.reset(); |
182 } | 182 } |
183 | 183 |
184 // static | 184 // static |
185 RootWindowController* RootWindowController::ForLauncher(aura::Window* window) { | 185 RootWindowController* RootWindowController::ForLauncher(aura::Window* window) { |
186 if (Shell::IsLauncherPerDisplayEnabled()) | 186 return GetRootWindowController(window->GetRootWindow()); |
187 return GetRootWindowController(window->GetRootWindow()); | |
188 else | |
189 return Shell::GetPrimaryRootWindowController(); | |
190 } | 187 } |
191 | 188 |
192 // static | 189 // static |
193 RootWindowController* RootWindowController::ForWindow( | 190 RootWindowController* RootWindowController::ForWindow( |
194 const aura::Window* window) { | 191 const aura::Window* window) { |
195 return GetRootWindowController(window->GetRootWindow()); | 192 return GetRootWindowController(window->GetRootWindow()); |
196 } | 193 } |
197 | 194 |
198 // static | 195 // static |
199 RootWindowController* RootWindowController::ForActiveRootWindow() { | 196 RootWindowController* RootWindowController::ForActiveRootWindow() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 void RootWindowController::InitForPrimaryDisplay() { | 265 void RootWindowController::InitForPrimaryDisplay() { |
269 DCHECK(!shelf_.get()); | 266 DCHECK(!shelf_.get()); |
270 aura::Window* shelf_container = | 267 aura::Window* shelf_container = |
271 GetContainer(ash::internal::kShellWindowId_ShelfContainer); | 268 GetContainer(ash::internal::kShellWindowId_ShelfContainer); |
272 // TODO(harrym): Remove when status area is view. | 269 // TODO(harrym): Remove when status area is view. |
273 aura::Window* status_container = | 270 aura::Window* status_container = |
274 GetContainer(ash::internal::kShellWindowId_StatusContainer); | 271 GetContainer(ash::internal::kShellWindowId_StatusContainer); |
275 shelf_.reset(new ash::ShelfWidget( | 272 shelf_.reset(new ash::ShelfWidget( |
276 shelf_container, status_container, workspace_controller())); | 273 shelf_container, status_container, workspace_controller())); |
277 | 274 |
278 if (Shell::IsLauncherPerDisplayEnabled() || | 275 // Create Panel layout manager |
279 root_window_ == Shell::GetPrimaryRootWindow()) { | 276 aura::Window* panel_container = GetContainer( |
280 // Create Panel layout manager | 277 internal::kShellWindowId_PanelContainer); |
281 aura::Window* panel_container = GetContainer( | 278 panel_layout_manager_ = |
282 internal::kShellWindowId_PanelContainer); | 279 new internal::PanelLayoutManager(panel_container); |
283 panel_layout_manager_ = | 280 panel_container_handler_.reset( |
284 new internal::PanelLayoutManager(panel_container); | 281 new ToplevelWindowEventHandler(panel_container)); |
285 panel_container_handler_.reset( | 282 panel_container->SetLayoutManager(panel_layout_manager_); |
286 new ToplevelWindowEventHandler(panel_container)); | 283 |
287 panel_container->SetLayoutManager(panel_layout_manager_); | |
288 } | |
289 if (Shell::GetInstance()->session_state_delegate()->HasActiveUser()) | 284 if (Shell::GetInstance()->session_state_delegate()->HasActiveUser()) |
290 shelf_->CreateLauncher(); | 285 shelf_->CreateLauncher(); |
291 | 286 |
292 InitKeyboard(); | 287 InitKeyboard(); |
293 } | 288 } |
294 | 289 |
295 void RootWindowController::CreateContainers() { | 290 void RootWindowController::CreateContainers() { |
296 CreateContainersInRootWindow(root_window_.get()); | 291 CreateContainersInRootWindow(root_window_.get()); |
297 | 292 |
298 // Create touch observer HUD if needed. HUD should be created after the | 293 // Create touch observer HUD if needed. HUD should be created after the |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 404 |
410 SystemTray* RootWindowController::GetSystemTray() { | 405 SystemTray* RootWindowController::GetSystemTray() { |
411 // We assume in throughout the code that this will not return NULL. If code | 406 // We assume in throughout the code that this will not return NULL. If code |
412 // triggers this for valid reasons, it should test status_area_widget first. | 407 // triggers this for valid reasons, it should test status_area_widget first. |
413 CHECK(shelf_.get() && shelf_->status_area_widget()); | 408 CHECK(shelf_.get() && shelf_->status_area_widget()); |
414 return shelf_->status_area_widget()->system_tray(); | 409 return shelf_->status_area_widget()->system_tray(); |
415 } | 410 } |
416 | 411 |
417 void RootWindowController::ShowContextMenu( | 412 void RootWindowController::ShowContextMenu( |
418 const gfx::Point& location_in_screen) { | 413 const gfx::Point& location_in_screen) { |
419 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? | |
420 root_window() : Shell::GetPrimaryRootWindow(); | |
421 DCHECK(Shell::GetInstance()->delegate()); | 414 DCHECK(Shell::GetInstance()->delegate()); |
422 scoped_ptr<ui::MenuModel> menu_model( | 415 scoped_ptr<ui::MenuModel> menu_model( |
423 Shell::GetInstance()->delegate()->CreateContextMenu(target)); | 416 Shell::GetInstance()->delegate()->CreateContextMenu(root_window())); |
424 if (!menu_model) | 417 if (!menu_model) |
425 return; | 418 return; |
426 | 419 |
427 internal::DesktopBackgroundWidgetController* background = | 420 internal::DesktopBackgroundWidgetController* background = |
428 root_window_->GetProperty(kDesktopController); | 421 root_window_->GetProperty(kDesktopController); |
429 // Background controller may not be set yet if user clicked on status are | 422 // Background controller may not be set yet if user clicked on status are |
430 // before initial animation completion. See crbug.com/222218 | 423 // before initial animation completion. See crbug.com/222218 |
431 if (!background) | 424 if (!background) |
432 return; | 425 return; |
433 | 426 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 "OverlayContainer", | 623 "OverlayContainer", |
631 lock_screen_related_containers); | 624 lock_screen_related_containers); |
632 SetUsesScreenCoordinates(overlay_container); | 625 SetUsesScreenCoordinates(overlay_container); |
633 | 626 |
634 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 627 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
635 "PowerButtonAnimationContainer", root_window) ; | 628 "PowerButtonAnimationContainer", root_window) ; |
636 } | 629 } |
637 | 630 |
638 } // namespace internal | 631 } // namespace internal |
639 } // namespace ash | 632 } // namespace ash |
OLD | NEW |