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/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 shelf_(NULL), | 188 shelf_(NULL), |
| 189 panel_layout_manager_(NULL), | 189 panel_layout_manager_(NULL), |
| 190 status_area_widget_(NULL), | 190 status_area_widget_(NULL), |
| 191 browser_context_(NULL) { | 191 browser_context_(NULL) { |
| 192 gfx::Screen::SetInstance(screen_); | 192 gfx::Screen::SetInstance(screen_); |
| 193 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); | 193 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); |
| 194 #if defined(OS_CHROMEOS) | 194 #if defined(OS_CHROMEOS) |
| 195 output_configurator_->AddObserver(output_configurator_animation_.get()); | 195 output_configurator_->AddObserver(output_configurator_animation_.get()); |
| 196 base::MessagePumpAuraX11::Current()->AddDispatcherForRootWindow( | 196 base::MessagePumpAuraX11::Current()->AddDispatcherForRootWindow( |
| 197 output_configurator()); | 197 output_configurator()); |
| 198 static_cast<internal::MultiDisplayManager*>( | |
| 199 aura::Env::GetInstance()->display_manager())->InitInternalDisplayInfo(); | |
|
oshima
2012/09/18 09:30:48
I moved this to MultiDisplayManager's constructor.
| |
| 200 #endif // defined(OS_CHROMEOS) | 198 #endif // defined(OS_CHROMEOS) |
| 201 } | 199 } |
| 202 | 200 |
| 203 Shell::~Shell() { | 201 Shell::~Shell() { |
| 204 views::FocusManagerFactory::Install(NULL); | 202 views::FocusManagerFactory::Install(NULL); |
| 205 | 203 |
| 206 // Remove the focus from any window. This will prevent overhead and side | 204 // Remove the focus from any window. This will prevent overhead and side |
| 207 // effects (e.g. crashes) from changing focus during shutdown. | 205 // effects (e.g. crashes) from changing focus during shutdown. |
| 208 // See bug crbug.com/134502. | 206 // See bug crbug.com/134502. |
| 209 if (active_root_window_) | 207 if (active_root_window_) |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 video_detector_.reset(new VideoDetector); | 441 video_detector_.reset(new VideoDetector); |
| 444 window_cycle_controller_.reset( | 442 window_cycle_controller_.reset( |
| 445 new WindowCycleController(activation_controller_.get())); | 443 new WindowCycleController(activation_controller_.get())); |
| 446 | 444 |
| 447 tooltip_controller_.reset(new internal::TooltipController( | 445 tooltip_controller_.reset(new internal::TooltipController( |
| 448 drag_drop_controller_.get())); | 446 drag_drop_controller_.get())); |
| 449 AddEnvEventFilter(tooltip_controller_.get()); | 447 AddEnvEventFilter(tooltip_controller_.get()); |
| 450 | 448 |
| 451 InitRootWindowController(root_window_controller); | 449 InitRootWindowController(root_window_controller); |
| 452 | 450 |
| 451 // This controller needs to be set before SetupManagedWindowMode. | |
| 452 desktop_background_controller_.reset(new DesktopBackgroundController()); | |
| 453 if (delegate_.get()) | |
| 454 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | |
| 455 if (!user_wallpaper_delegate_.get()) | |
| 456 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | |
| 457 | |
| 458 // Launcher must be created after secondary displays are initialized. | |
| 459 display_controller_->InitSecondaryDisplays(); | |
| 460 | |
| 453 // StatusAreaWidget uses Shell's CapsLockDelegate. | 461 // StatusAreaWidget uses Shell's CapsLockDelegate. |
| 454 if (delegate_.get()) | 462 if (delegate_.get()) |
| 455 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); | 463 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); |
| 456 else | 464 else |
| 457 caps_lock_delegate_.reset(new CapsLockDelegateStub); | 465 caps_lock_delegate_.reset(new CapsLockDelegateStub); |
| 458 | 466 |
| 459 // Initialize Primary RootWindow specific items. | 467 // Initialize Primary RootWindow specific items. |
| 460 status_area_widget_ = new internal::StatusAreaWidget(); | 468 status_area_widget_ = new internal::StatusAreaWidget(); |
| 461 status_area_widget_->CreateTrayViews(delegate_.get()); | 469 status_area_widget_->CreateTrayViews(delegate_.get()); |
| 462 // Login screen manages status area visibility by itself. | 470 // Login screen manages status area visibility by itself. |
| 463 if (delegate_.get() && delegate_->IsSessionStarted()) | 471 if (delegate_.get() && delegate_->IsSessionStarted()) |
| 464 status_area_widget_->Show(); | 472 status_area_widget_->Show(); |
| 465 | 473 |
| 466 focus_cycler_.reset(new internal::FocusCycler()); | 474 focus_cycler_.reset(new internal::FocusCycler()); |
| 467 focus_cycler_->AddWidget(status_area_widget_); | 475 focus_cycler_->AddWidget(status_area_widget_); |
| 468 | 476 |
| 469 // This controller needs to be set before SetupManagedWindowMode. | |
| 470 desktop_background_controller_.reset(new DesktopBackgroundController()); | |
| 471 if (delegate_.get()) | |
| 472 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | |
| 473 if (!user_wallpaper_delegate_.get()) | |
| 474 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | |
| 475 | |
| 476 InitLayoutManagersForPrimaryDisplay(root_window_controller); | 477 InitLayoutManagersForPrimaryDisplay(root_window_controller); |
| 477 | 478 |
| 478 if (!command_line->HasSwitch(switches::kAuraNoShadows)) { | 479 if (!command_line->HasSwitch(switches::kAuraNoShadows)) { |
| 479 resize_shadow_controller_.reset(new internal::ResizeShadowController()); | 480 resize_shadow_controller_.reset(new internal::ResizeShadowController()); |
| 480 shadow_controller_.reset(new internal::ShadowController()); | 481 shadow_controller_.reset(new internal::ShadowController()); |
| 481 } | 482 } |
| 482 | 483 |
| 483 // Launcher must be created after secondary displays are initialized. | |
| 484 display_controller_->InitSecondaryDisplays(); | |
| 485 | |
| 486 if (!delegate_.get() || delegate_->IsUserLoggedIn()) | 484 if (!delegate_.get() || delegate_->IsUserLoggedIn()) |
| 487 CreateLauncher(); | 485 CreateLauncher(); |
| 488 | 486 |
| 489 // Force Layout | 487 // Force Layout |
| 490 root_window_controller->root_window_layout()->OnWindowResized(); | 488 root_window_controller->root_window_layout()->OnWindowResized(); |
| 491 | 489 |
| 492 // It needs to be created after OnWindowResized has been called, otherwise the | 490 // It needs to be created after OnWindowResized has been called, otherwise the |
| 493 // widget will not paint when restoring after a browser crash. Also it needs | 491 // widget will not paint when restoring after a browser crash. Also it needs |
| 494 // to be created after InitSecondaryDisplays() to initialize the wallpapers in | 492 // to be created after InitSecondaryDisplays() to initialize the wallpapers in |
| 495 // the correct size. | 493 // the correct size. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 } | 768 } |
| 771 | 769 |
| 772 void Shell::ShowCursor(bool visible) { | 770 void Shell::ShowCursor(bool visible) { |
| 773 RootWindowList root_windows = GetAllRootWindows(); | 771 RootWindowList root_windows = GetAllRootWindows(); |
| 774 for (RootWindowList::iterator iter = root_windows.begin(); | 772 for (RootWindowList::iterator iter = root_windows.begin(); |
| 775 iter != root_windows.end(); ++iter) | 773 iter != root_windows.end(); ++iter) |
| 776 (*iter)->ShowCursor(visible); | 774 (*iter)->ShowCursor(visible); |
| 777 } | 775 } |
| 778 | 776 |
| 779 } // namespace ash | 777 } // namespace ash |
| OLD | NEW |