Chromium Code Reviews| 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" |
| 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/shelf_types.h" | 15 #include "ash/shelf/shelf_layout_manager.h" |
| 16 #include "ash/shelf/shelf_types.h" | |
| 17 #include "ash/shelf/shelf_widget.h" | |
| 16 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 17 #include "ash/shell_delegate.h" | 19 #include "ash/shell_delegate.h" |
| 18 #include "ash/shell_factory.h" | 20 #include "ash/shell_factory.h" |
| 19 #include "ash/shell_window_ids.h" | 21 #include "ash/shell_window_ids.h" |
| 20 #include "ash/system/status_area_widget.h" | 22 #include "ash/system/status_area_widget.h" |
| 21 #include "ash/system/tray/system_tray_delegate.h" | 23 #include "ash/system/tray/system_tray_delegate.h" |
| 22 #include "ash/wm/base_layout_manager.h" | 24 #include "ash/wm/base_layout_manager.h" |
| 23 #include "ash/wm/boot_splash_screen.h" | 25 #include "ash/wm/boot_splash_screen.h" |
| 24 #include "ash/wm/panel_layout_manager.h" | 26 #include "ash/wm/panel_layout_manager.h" |
| 25 #include "ash/wm/property_util.h" | 27 #include "ash/wm/property_util.h" |
| 26 #include "ash/wm/root_window_layout_manager.h" | 28 #include "ash/wm/root_window_layout_manager.h" |
| 27 #include "ash/wm/screen_dimmer.h" | 29 #include "ash/wm/screen_dimmer.h" |
| 28 #include "ash/wm/shelf_layout_manager.h" | |
| 29 #include "ash/wm/stacking_controller.h" | 30 #include "ash/wm/stacking_controller.h" |
| 30 #include "ash/wm/status_area_layout_manager.h" | 31 #include "ash/wm/status_area_layout_manager.h" |
| 31 #include "ash/wm/system_background_controller.h" | 32 #include "ash/wm/system_background_controller.h" |
| 32 #include "ash/wm/system_modal_container_layout_manager.h" | 33 #include "ash/wm/system_modal_container_layout_manager.h" |
| 33 #include "ash/wm/toplevel_window_event_handler.h" | 34 #include "ash/wm/toplevel_window_event_handler.h" |
| 34 #include "ash/wm/window_properties.h" | 35 #include "ash/wm/window_properties.h" |
| 35 #include "ash/wm/workspace_controller.h" | 36 #include "ash/wm/workspace_controller.h" |
| 36 #include "base/command_line.h" | 37 #include "base/command_line.h" |
| 37 #include "base/time.h" | 38 #include "base/time.h" |
| 38 #include "ui/aura/client/activation_client.h" | 39 #include "ui/aura/client/activation_client.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 container->SetProperty(internal::kUsesScreenCoordinatesKey, true); | 159 container->SetProperty(internal::kUsesScreenCoordinatesKey, true); |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace | 162 } // namespace |
| 162 | 163 |
| 163 namespace internal { | 164 namespace internal { |
| 164 | 165 |
| 165 RootWindowController::RootWindowController(aura::RootWindow* root_window) | 166 RootWindowController::RootWindowController(aura::RootWindow* root_window) |
| 166 : root_window_(root_window), | 167 : root_window_(root_window), |
| 167 root_window_layout_(NULL), | 168 root_window_layout_(NULL), |
| 168 status_area_widget_(NULL), | |
| 169 shelf_(NULL), | 169 shelf_(NULL), |
| 170 panel_layout_manager_(NULL) { | 170 panel_layout_manager_(NULL) { |
| 171 SetRootWindowController(root_window, this); | 171 SetRootWindowController(root_window, this); |
| 172 screen_dimmer_.reset(new ScreenDimmer(root_window)); | 172 screen_dimmer_.reset(new ScreenDimmer(root_window)); |
| 173 | 173 |
| 174 stacking_controller_.reset(new ash::StackingController); | 174 stacking_controller_.reset(new ash::StackingController); |
| 175 aura::client::SetStackingClient(root_window, stacking_controller_.get()); | 175 aura::client::SetStackingClient(root_window, stacking_controller_.get()); |
| 176 } | 176 } |
| 177 | 177 |
| 178 RootWindowController::~RootWindowController() { | 178 RootWindowController::~RootWindowController() { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 209 SetRootWindowController(root_window_.get(), NULL); | 209 SetRootWindowController(root_window_.get(), NULL); |
| 210 screen_dimmer_.reset(); | 210 screen_dimmer_.reset(); |
| 211 workspace_controller_.reset(); | 211 workspace_controller_.reset(); |
| 212 // Forget with the display ID so that display lookup | 212 // Forget with the display ID so that display lookup |
| 213 // ends up with invalid display. | 213 // ends up with invalid display. |
| 214 root_window_->ClearProperty(kDisplayIdKey); | 214 root_window_->ClearProperty(kDisplayIdKey); |
| 215 // And this root window should no longer process events. | 215 // And this root window should no longer process events. |
| 216 root_window_->PrepareForShutdown(); | 216 root_window_->PrepareForShutdown(); |
| 217 | 217 |
| 218 system_background_.reset(); | 218 system_background_.reset(); |
| 219 | |
| 220 // Launcher widget has an InputMethodBridge that references to | |
| 221 // |input_method_filter_|'s |input_method_|. So explicitly release | |
| 222 // |launcher_| before |input_method_filter_|. And this needs to be | |
| 223 // after we delete all containers in case there are still live | |
| 224 // browser windows which access LauncherModel during close. | |
| 225 launcher_.reset(); | |
| 226 } | 219 } |
| 227 | 220 |
| 228 SystemModalContainerLayoutManager* | 221 SystemModalContainerLayoutManager* |
| 229 RootWindowController::GetSystemModalLayoutManager(aura::Window* window) { | 222 RootWindowController::GetSystemModalLayoutManager(aura::Window* window) { |
| 230 aura::Window* container = NULL; | 223 aura::Window* container = NULL; |
| 231 if (window) { | 224 if (window) { |
| 232 if (window->parent() && | 225 if (window->parent() && |
| 233 window->parent()->id() >= kShellWindowId_LockScreenContainer) { | 226 window->parent()->id() >= kShellWindowId_LockScreenContainer) { |
| 234 container = GetContainer(kShellWindowId_LockSystemModalContainer); | 227 container = GetContainer(kShellWindowId_LockSystemModalContainer); |
| 235 } else { | 228 } else { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 265 new WorkspaceController(default_container)); | 258 new WorkspaceController(default_container)); |
| 266 | 259 |
| 267 aura::Window* always_on_top_container = | 260 aura::Window* always_on_top_container = |
| 268 GetContainer(kShellWindowId_AlwaysOnTopContainer); | 261 GetContainer(kShellWindowId_AlwaysOnTopContainer); |
| 269 always_on_top_container->SetLayoutManager( | 262 always_on_top_container->SetLayoutManager( |
| 270 new BaseLayoutManager( | 263 new BaseLayoutManager( |
| 271 always_on_top_container->GetRootWindow())); | 264 always_on_top_container->GetRootWindow())); |
| 272 } | 265 } |
| 273 | 266 |
| 274 void RootWindowController::InitForPrimaryDisplay() { | 267 void RootWindowController::InitForPrimaryDisplay() { |
| 275 DCHECK(!status_area_widget_); | 268 DCHECK(!shelf_); |
| 269 aura::Window* shelf_container = | |
| 270 GetContainer(ash::internal::kShellWindowId_ShelfContainer); | |
| 271 // todo (harrym) remove when status area is view. | |
|
Mr4D (OOO till 08-26)
2013/02/27 19:42:51
// TODO(harrym): remove..
Harry McCleave
2013/03/01 04:31:19
Done.
| |
| 276 aura::Window* status_container = | 272 aura::Window* status_container = |
| 277 GetContainer(ash::internal::kShellWindowId_StatusContainer); | 273 GetContainer(ash::internal::kShellWindowId_StatusContainer); |
| 278 // Initialize Primary RootWindow specific items. | 274 shelf_ = new ash::ShelfWidget( |
|
Mr4D (OOO till 08-26)
2013/02/27 19:42:51
I am fairly certain that shelf_ should be a scoped
Harry McCleave
2013/03/01 04:31:19
Done.
| |
| 279 status_area_widget_ = new internal::StatusAreaWidget(status_container); | 275 shelf_container, status_container, workspace_controller()); |
| 280 status_area_widget_->CreateTrayViews(); | |
| 281 // Login screen manages status area visibility by itself. | |
| 282 ShellDelegate* shell_delegate = Shell::GetInstance()->delegate(); | |
| 283 if (shell_delegate->IsSessionStarted()) | |
| 284 status_area_widget_->Show(); | |
| 285 | |
| 286 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_); | |
| 287 | |
| 288 internal::ShelfLayoutManager* shelf_layout_manager = | |
| 289 new internal::ShelfLayoutManager(status_area_widget_); | |
| 290 GetContainer(internal::kShellWindowId_LauncherContainer)-> | |
| 291 SetLayoutManager(shelf_layout_manager); | |
| 292 shelf_ = shelf_layout_manager; | |
| 293 | |
| 294 internal::StatusAreaLayoutManager* status_area_layout_manager = | |
| 295 new internal::StatusAreaLayoutManager(shelf_layout_manager); | |
| 296 GetContainer(internal::kShellWindowId_StatusContainer)-> | |
| 297 SetLayoutManager(status_area_layout_manager); | |
| 298 | |
| 299 shelf_layout_manager->set_workspace_controller( | |
| 300 workspace_controller()); | |
| 301 | |
| 302 workspace_controller()->SetShelf(shelf_); | |
| 303 | 276 |
| 304 if (Shell::IsLauncherPerDisplayEnabled() || | 277 if (Shell::IsLauncherPerDisplayEnabled() || |
| 305 root_window_ == Shell::GetPrimaryRootWindow()) { | 278 root_window_ == Shell::GetPrimaryRootWindow()) { |
| 306 // Create Panel layout manager | 279 // Create Panel layout manager |
| 307 aura::Window* panel_container = GetContainer( | 280 aura::Window* panel_container = GetContainer( |
| 308 internal::kShellWindowId_PanelContainer); | 281 internal::kShellWindowId_PanelContainer); |
| 309 panel_layout_manager_ = | 282 panel_layout_manager_ = |
| 310 new internal::PanelLayoutManager(panel_container); | 283 new internal::PanelLayoutManager(panel_container); |
| 311 panel_container_handler_.reset( | 284 panel_container_handler_.reset( |
| 312 new ToplevelWindowEventHandler(panel_container)); | 285 new ToplevelWindowEventHandler(panel_container)); |
| 313 panel_container->SetLayoutManager(panel_layout_manager_); | 286 panel_container->SetLayoutManager(panel_layout_manager_); |
| 314 } | 287 } |
| 315 | 288 |
| 316 if (shell_delegate->IsUserLoggedIn()) | 289 if (Shell::GetInstance()->delegate()->IsUserLoggedIn()) |
| 317 CreateLauncher(); | 290 shelf_->CreateLauncher(); |
| 318 } | 291 } |
| 319 | 292 |
| 320 void RootWindowController::CreateContainers() { | 293 void RootWindowController::CreateContainers() { |
| 321 CreateContainersInRootWindow(root_window_.get()); | 294 CreateContainersInRootWindow(root_window_.get()); |
| 322 } | 295 } |
| 323 | 296 |
| 324 void RootWindowController::CreateSystemBackground( | 297 void RootWindowController::CreateSystemBackground( |
| 325 bool is_first_run_after_boot) { | 298 bool is_first_run_after_boot) { |
| 326 SkColor color = SK_ColorBLACK; | 299 SkColor color = SK_ColorBLACK; |
| 327 #if defined(OS_CHROMEOS) | 300 #if defined(OS_CHROMEOS) |
| 328 if (is_first_run_after_boot) | 301 if (is_first_run_after_boot) |
| 329 color = kChromeOsBootColor; | 302 color = kChromeOsBootColor; |
| 330 #endif | 303 #endif |
| 331 system_background_.reset( | 304 system_background_.reset( |
| 332 new SystemBackgroundController(root_window_.get(), color)); | 305 new SystemBackgroundController(root_window_.get(), color)); |
| 333 | 306 |
| 334 #if defined(OS_CHROMEOS) | 307 #if defined(OS_CHROMEOS) |
| 335 // Make a copy of the system's boot splash screen so we can composite it | 308 // Make a copy of the system's boot splash screen so we can composite it |
| 336 // onscreen until the desktop background is ready. | 309 // onscreen until the desktop background is ready. |
| 337 if (is_first_run_after_boot && | 310 if (is_first_run_after_boot && |
| 338 (CommandLine::ForCurrentProcess()->HasSwitch( | 311 (CommandLine::ForCurrentProcess()->HasSwitch( |
| 339 switches::kAshCopyHostBackgroundAtBoot) || | 312 switches::kAshCopyHostBackgroundAtBoot) || |
| 340 CommandLine::ForCurrentProcess()->HasSwitch( | 313 CommandLine::ForCurrentProcess()->HasSwitch( |
| 341 switches::kAshAnimateFromBootSplashScreen))) | 314 switches::kAshAnimateFromBootSplashScreen))) |
| 342 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); | 315 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); |
| 343 #endif | 316 #endif |
| 344 } | 317 } |
| 345 | 318 |
| 346 void RootWindowController::CreateLauncher() { | 319 void RootWindowController::OnLauncherCreated() { |
| 347 if (launcher_.get()) | 320 panel_layout_manager_->SetLauncher(shelf_->launcher()); |
| 348 return; | |
| 349 | |
| 350 aura::Window* default_container = | |
| 351 GetContainer(internal::kShellWindowId_DefaultContainer); | |
| 352 // Get the delegate first to make sure the launcher model is created. | |
| 353 LauncherDelegate* launcher_delegate = | |
| 354 Shell::GetInstance()->GetLauncherDelegate(); | |
| 355 launcher_.reset(new Launcher(Shell::GetInstance()->launcher_model(), | |
| 356 launcher_delegate, | |
| 357 default_container, | |
| 358 shelf_)); | |
| 359 | |
| 360 launcher_->SetFocusCycler(Shell::GetInstance()->focus_cycler()); | |
| 361 shelf_->SetLauncher(launcher_.get()); | |
| 362 | |
| 363 if (panel_layout_manager_) | |
| 364 panel_layout_manager_->SetLauncher(launcher_.get()); | |
| 365 | |
| 366 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | |
| 367 if (delegate) | |
| 368 launcher_->SetVisible(delegate->IsSessionStarted()); | |
| 369 launcher_->widget()->Show(); | |
| 370 } | 321 } |
| 371 | 322 |
| 372 void RootWindowController::ShowLauncher() { | 323 void RootWindowController::ShowLauncher() { |
| 373 if (!launcher_.get()) | 324 if (!shelf_->launcher()) |
| 374 return; | 325 return; |
| 375 launcher_->SetVisible(true); | 326 shelf_->launcher()->SetVisible(true); |
| 376 status_area_widget_->Show(); | 327 shelf_->status_area_widget()->Show(); |
| 377 } | 328 } |
| 378 | 329 |
| 379 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { | 330 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { |
| 380 // TODO(oshima): remove if when launcher per display is enabled by | 331 // TODO(oshima): remove if when launcher per display is enabled by |
| 381 // default. | 332 // default. |
| 382 if (shelf_) | 333 if (shelf_) |
| 383 shelf_->UpdateVisibilityState(); | 334 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
| 384 } | 335 } |
| 385 | 336 |
| 386 void RootWindowController::UpdateAfterLoginStatusChange( | 337 void RootWindowController::UpdateAfterLoginStatusChange( |
| 387 user::LoginStatus status) { | 338 user::LoginStatus status) { |
| 388 if (status_area_widget_) | 339 if (shelf_->status_area_widget()) |
| 389 status_area_widget_->UpdateAfterLoginStatusChange(status); | 340 shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status); |
| 390 } | 341 } |
| 391 | 342 |
| 392 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { | 343 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { |
| 393 if (CommandLine::ForCurrentProcess()->HasSwitch( | 344 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 394 switches::kAshAnimateFromBootSplashScreen) && | 345 switches::kAshAnimateFromBootSplashScreen) && |
| 395 boot_splash_screen_.get()) { | 346 boot_splash_screen_.get()) { |
| 396 // Make the splash screen fade out so it doesn't obscure the desktop | 347 // Make the splash screen fade out so it doesn't obscure the desktop |
| 397 // wallpaper's brightness/grayscale animation. | 348 // wallpaper's brightness/grayscale animation. |
| 398 boot_splash_screen_->StartHideAnimation( | 349 boot_splash_screen_->StartHideAnimation( |
| 399 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); | 350 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); |
| 400 } | 351 } |
| 401 } | 352 } |
| 402 | 353 |
| 403 void RootWindowController::HandleDesktopBackgroundVisible() { | 354 void RootWindowController::HandleDesktopBackgroundVisible() { |
| 404 system_background_->SetColor(SK_ColorBLACK); | 355 system_background_->SetColor(SK_ColorBLACK); |
| 405 boot_splash_screen_.reset(); | 356 boot_splash_screen_.reset(); |
| 406 } | 357 } |
| 407 | 358 |
| 408 void RootWindowController::CloseChildWindows() { | 359 void RootWindowController::CloseChildWindows() { |
| 409 // The status area needs to be shut down before the windows are destroyed. | |
| 410 if (status_area_widget_) { | |
| 411 status_area_widget_->Shutdown(); | |
| 412 status_area_widget_ = NULL; | |
| 413 } | |
| 414 | |
| 415 // panel_layout_manager_ needs to be shut down before windows are destroyed. | 360 // panel_layout_manager_ needs to be shut down before windows are destroyed. |
| 416 if (panel_layout_manager_) { | 361 if (panel_layout_manager_) { |
| 417 panel_layout_manager_->Shutdown(); | 362 panel_layout_manager_->Shutdown(); |
| 418 panel_layout_manager_ = NULL; | 363 panel_layout_manager_ = NULL; |
| 419 } | 364 } |
| 420 | 365 |
| 421 // Closing the windows frees the workspace controller. | 366 // todo(HarryM) remove when Status Area Widget is a child view. |
| 422 if (shelf_) | 367 if (shelf_ && shelf_->status_area_widget()) |
| 423 shelf_->set_workspace_controller(NULL); | 368 shelf_->status_area_widget()->Shutdown(); |
| 369 | |
| 370 if (shelf_ && shelf_->shelf_layout_manager()) | |
| 371 shelf_->shelf_layout_manager()->set_workspace_controller(NULL); | |
| 424 | 372 |
| 425 // Close background widget first as it depends on tooltip. | 373 // Close background widget first as it depends on tooltip. |
| 426 root_window_->SetProperty(kDesktopController, | 374 root_window_->SetProperty(kDesktopController, |
| 427 static_cast<DesktopBackgroundWidgetController*>(NULL)); | 375 static_cast<DesktopBackgroundWidgetController*>(NULL)); |
| 428 root_window_->SetProperty(kAnimatingDesktopController, | 376 root_window_->SetProperty(kAnimatingDesktopController, |
| 429 static_cast<AnimatingDesktopController*>(NULL)); | 377 static_cast<AnimatingDesktopController*>(NULL)); |
| 430 | 378 |
| 431 workspace_controller_.reset(); | 379 workspace_controller_.reset(); |
| 432 aura::client::SetTooltipClient(root_window_.get(), NULL); | 380 aura::client::SetTooltipClient(root_window_.get(), NULL); |
| 433 | 381 |
| 434 while (!root_window_->children().empty()) { | 382 while (!root_window_->children().empty()) { |
| 435 aura::Window* child = root_window_->children()[0]; | 383 aura::Window* child = root_window_->children()[0]; |
| 436 delete child; | 384 delete child; |
| 437 } | 385 } |
| 438 launcher_.reset(); | 386 |
| 439 // All containers are deleted, so reset shelf_. | 387 // All containers have been deleted, including shelf. |
| 440 shelf_ = NULL; | 388 shelf_ = NULL; |
| 441 } | 389 } |
| 442 | 390 |
| 443 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 391 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
| 444 aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow(); | 392 aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow(); |
| 445 aura::WindowTracker tracker; | 393 aura::WindowTracker tracker; |
| 446 if (focused) | 394 if (focused) |
| 447 tracker.Add(focused); | 395 tracker.Add(focused); |
| 448 aura::client::ActivationClient* activation_client = | 396 aura::client::ActivationClient* activation_client = |
| 449 aura::client::GetActivationClient(dst); | 397 aura::client::GetActivationClient(dst); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 466 workspace_controller_->SetShelf(NULL); | 414 workspace_controller_->SetShelf(NULL); |
| 467 | 415 |
| 468 ReparentAllWindows(root_window_.get(), dst); | 416 ReparentAllWindows(root_window_.get(), dst); |
| 469 | 417 |
| 470 // Restore focused or active window if it's still alive. | 418 // Restore focused or active window if it's still alive. |
| 471 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { | 419 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { |
| 472 aura::client::GetFocusClient(dst)->FocusWindow(focused); | 420 aura::client::GetFocusClient(dst)->FocusWindow(focused); |
| 473 } else if (active && tracker.Contains(active) && dst->Contains(active)) { | 421 } else if (active && tracker.Contains(active) && dst->Contains(active)) { |
| 474 activation_client->ActivateWindow(active); | 422 activation_client->ActivateWindow(active); |
| 475 } | 423 } |
| 476 } | 424 } |
|
Mr4D (OOO till 08-26)
2013/02/27 19:42:51
empty line here
Harry McCleave
2013/03/01 04:31:19
Done.
| |
| 477 | 425 ShelfLayoutManager* RootWindowController::shelf_layout_manager() const { |
| 426 return shelf_ ? shelf_->shelf_layout_manager() : NULL; | |
| 427 } | |
|
Mr4D (OOO till 08-26)
2013/02/27 19:42:51
empty line again
Harry McCleave
2013/03/01 04:31:19
Done.
| |
| 478 SystemTray* RootWindowController::GetSystemTray() { | 428 SystemTray* RootWindowController::GetSystemTray() { |
| 479 // We assume in throughout the code that this will not return NULL. If code | 429 // We assume in throughout the code that this will not return NULL. If code |
| 480 // triggers this for valid reasons, it should test status_area_widget first. | 430 // triggers this for valid reasons, it should test status_area_widget first. |
| 481 internal::StatusAreaWidget* status_area = status_area_widget(); | 431 CHECK(shelf_ && shelf_->status_area_widget()); |
| 482 CHECK(status_area); | 432 return shelf_->status_area_widget()->system_tray(); |
| 483 return status_area->system_tray(); | |
| 484 } | 433 } |
| 485 | 434 |
| 486 void RootWindowController::ShowContextMenu( | 435 void RootWindowController::ShowContextMenu( |
| 487 const gfx::Point& location_in_screen) { | 436 const gfx::Point& location_in_screen) { |
| 488 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? | 437 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? |
| 489 root_window() : Shell::GetPrimaryRootWindow(); | 438 root_window() : Shell::GetPrimaryRootWindow(); |
| 490 DCHECK(Shell::GetInstance()->delegate()); | 439 DCHECK(Shell::GetInstance()->delegate()); |
| 491 scoped_ptr<ui::MenuModel> menu_model( | 440 scoped_ptr<ui::MenuModel> menu_model( |
| 492 Shell::GetInstance()->delegate()->CreateContextMenu(target)); | 441 Shell::GetInstance()->delegate()->CreateContextMenu(target)); |
| 493 if (!menu_model.get()) | 442 if (!menu_model.get()) |
| 494 return; | 443 return; |
| 495 | 444 |
| 496 views::MenuModelAdapter menu_model_adapter(menu_model.get()); | 445 views::MenuModelAdapter menu_model_adapter(menu_model.get()); |
| 497 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu()); | 446 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu()); |
| 498 views::Widget* widget = | 447 views::Widget* widget = |
| 499 root_window_->GetProperty(kDesktopController)->widget(); | 448 root_window_->GetProperty(kDesktopController)->widget(); |
| 500 | 449 |
| 501 if (menu_runner.RunMenuAt( | 450 if (menu_runner.RunMenuAt( |
| 502 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()), | 451 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()), |
| 503 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == | 452 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == |
| 504 views::MenuRunner::MENU_DELETED) | 453 views::MenuRunner::MENU_DELETED) |
| 505 return; | 454 return; |
| 506 | 455 |
| 507 Shell::GetInstance()->UpdateShelfVisibility(); | 456 Shell::GetInstance()->UpdateShelfVisibility(); |
| 508 } | 457 } |
| 509 | 458 |
| 510 void RootWindowController::UpdateShelfVisibility() { | 459 void RootWindowController::UpdateShelfVisibility() { |
| 511 shelf_->UpdateVisibilityState(); | 460 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
| 512 } | |
| 513 | |
| 514 void RootWindowController::SetShelfAutoHideBehavior( | |
| 515 ShelfAutoHideBehavior behavior) { | |
| 516 shelf_->SetAutoHideBehavior(behavior); | |
| 517 } | |
| 518 | |
| 519 ShelfAutoHideBehavior RootWindowController::GetShelfAutoHideBehavior() const { | |
| 520 return shelf_->auto_hide_behavior(); | |
| 521 } | |
| 522 | |
| 523 bool RootWindowController::SetShelfAlignment(ShelfAlignment alignment) { | |
| 524 return shelf_->SetAlignment(alignment); | |
| 525 } | |
| 526 | |
| 527 ShelfAlignment RootWindowController::GetShelfAlignment() { | |
| 528 return shelf_->GetAlignment(); | |
| 529 } | 461 } |
| 530 | 462 |
| 531 bool RootWindowController::IsImmersiveMode() const { | 463 bool RootWindowController::IsImmersiveMode() const { |
| 532 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); | 464 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); |
| 533 for (size_t i = 0; i < container->children().size(); ++i) { | 465 for (size_t i = 0; i < container->children().size(); ++i) { |
| 534 aura::Window* child = container->children()[i]; | 466 aura::Window* child = container->children()[i]; |
| 535 if (child->IsVisible() && child->GetProperty(kImmersiveModeKey)) | 467 if (child->IsVisible() && child->GetProperty(kImmersiveModeKey)) |
| 536 return true; | 468 return true; |
| 537 } | 469 } |
| 538 return false; | 470 return false; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 always_on_top_container); | 534 always_on_top_container); |
| 603 SetUsesScreenCoordinates(always_on_top_container); | 535 SetUsesScreenCoordinates(always_on_top_container); |
| 604 | 536 |
| 605 aura::Window* panel_container = CreateContainer( | 537 aura::Window* panel_container = CreateContainer( |
| 606 kShellWindowId_PanelContainer, | 538 kShellWindowId_PanelContainer, |
| 607 "PanelContainer", | 539 "PanelContainer", |
| 608 non_lock_screen_containers); | 540 non_lock_screen_containers); |
| 609 SetUsesScreenCoordinates(panel_container); | 541 SetUsesScreenCoordinates(panel_container); |
| 610 | 542 |
| 611 aura::Window* launcher_container = | 543 aura::Window* launcher_container = |
| 612 CreateContainer(kShellWindowId_LauncherContainer, | 544 CreateContainer(kShellWindowId_ShelfContainer, |
| 613 "LauncherContainer", | 545 "LauncherContainer", |
| 614 non_lock_screen_containers); | 546 non_lock_screen_containers); |
| 615 SetUsesScreenCoordinates(launcher_container); | 547 SetUsesScreenCoordinates(launcher_container); |
| 616 | 548 |
| 617 aura::Window* app_list_container = | 549 aura::Window* app_list_container = |
| 618 CreateContainer(kShellWindowId_AppListContainer, | 550 CreateContainer(kShellWindowId_AppListContainer, |
| 619 "AppListContainer", | 551 "AppListContainer", |
| 620 non_lock_screen_containers); | 552 non_lock_screen_containers); |
| 621 SetUsesScreenCoordinates(app_list_container); | 553 SetUsesScreenCoordinates(app_list_container); |
| 622 | 554 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 "OverlayContainer", | 624 "OverlayContainer", |
| 693 lock_screen_related_containers); | 625 lock_screen_related_containers); |
| 694 SetUsesScreenCoordinates(overlay_container); | 626 SetUsesScreenCoordinates(overlay_container); |
| 695 | 627 |
| 696 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 628 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 697 "PowerButtonAnimationContainer", root_window) ; | 629 "PowerButtonAnimationContainer", root_window) ; |
| 698 } | 630 } |
| 699 | 631 |
| 700 } // namespace internal | 632 } // namespace internal |
| 701 } // namespace ash | 633 } // namespace ash |
| OLD | NEW |