| 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/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 #include "ash/system/chromeos/power/power_status.h" | 121 #include "ash/system/chromeos/power/power_status.h" |
| 122 #endif // defined(OS_CHROMEOS) | 122 #endif // defined(OS_CHROMEOS) |
| 123 | 123 |
| 124 namespace ash { | 124 namespace ash { |
| 125 | 125 |
| 126 namespace { | 126 namespace { |
| 127 | 127 |
| 128 using aura::Window; | 128 using aura::Window; |
| 129 using views::Widget; | 129 using views::Widget; |
| 130 | 130 |
| 131 // This dummy class is used for shell unit tests. We dont have chrome delegate | |
| 132 // in these tests. | |
| 133 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { | |
| 134 public: | |
| 135 DummyUserWallpaperDelegate() {} | |
| 136 | |
| 137 virtual ~DummyUserWallpaperDelegate() {} | |
| 138 | |
| 139 virtual int GetAnimationType() OVERRIDE { | |
| 140 return views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; | |
| 141 } | |
| 142 | |
| 143 virtual bool ShouldShowInitialAnimation() OVERRIDE { | |
| 144 return false; | |
| 145 } | |
| 146 | |
| 147 virtual void UpdateWallpaper() OVERRIDE { | |
| 148 } | |
| 149 | |
| 150 virtual void InitializeWallpaper() OVERRIDE { | |
| 151 ash::Shell::GetInstance()->desktop_background_controller()-> | |
| 152 CreateEmptyWallpaper(); | |
| 153 } | |
| 154 | |
| 155 virtual void OpenSetWallpaperPage() OVERRIDE { | |
| 156 } | |
| 157 | |
| 158 virtual bool CanOpenSetWallpaperPage() OVERRIDE { | |
| 159 return false; | |
| 160 } | |
| 161 | |
| 162 virtual void OnWallpaperAnimationFinished() OVERRIDE { | |
| 163 } | |
| 164 | |
| 165 virtual void OnWallpaperBootAnimationFinished() OVERRIDE { | |
| 166 } | |
| 167 | |
| 168 private: | |
| 169 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); | |
| 170 }; | |
| 171 | |
| 172 // A Corewm VisibilityController subclass that calls the Ash animation routine | 131 // A Corewm VisibilityController subclass that calls the Ash animation routine |
| 173 // so we can pick up our extended animations. See ash/wm/window_animations.h. | 132 // so we can pick up our extended animations. See ash/wm/window_animations.h. |
| 174 class AshVisibilityController : public views::corewm::VisibilityController { | 133 class AshVisibilityController : public views::corewm::VisibilityController { |
| 175 public: | 134 public: |
| 176 AshVisibilityController() {} | 135 AshVisibilityController() {} |
| 177 virtual ~AshVisibilityController() {} | 136 virtual ~AshVisibilityController() {} |
| 178 | 137 |
| 179 private: | 138 private: |
| 180 // Overridden from views::corewm::VisibilityController: | 139 // Overridden from views::corewm::VisibilityController: |
| 181 virtual bool CallAnimateOnChildWindowVisibilityChanged( | 140 virtual bool CallAnimateOnChildWindowVisibilityChanged( |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 visibility_controller_.reset(); | 261 visibility_controller_.reset(); |
| 303 launcher_delegate_.reset(); | 262 launcher_delegate_.reset(); |
| 304 launcher_model_.reset(); | 263 launcher_model_.reset(); |
| 305 video_detector_.reset(); | 264 video_detector_.reset(); |
| 306 | 265 |
| 307 power_button_controller_.reset(); | 266 power_button_controller_.reset(); |
| 308 lock_state_controller_.reset(); | 267 lock_state_controller_.reset(); |
| 309 mru_window_tracker_.reset(); | 268 mru_window_tracker_.reset(); |
| 310 | 269 |
| 311 resolution_notification_controller_.reset(); | 270 resolution_notification_controller_.reset(); |
| 271 desktop_background_controller_.reset(); |
| 312 | 272 |
| 313 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 273 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
| 314 // DisplayController before resetting |display_controller_|, since destruction | 274 // DisplayController before resetting |display_controller_|, since destruction |
| 315 // of its owned RootWindowControllers relies on the value. | 275 // of its owned RootWindowControllers relies on the value. |
| 316 display_controller_->Shutdown(); | 276 display_controller_->Shutdown(); |
| 317 display_controller_.reset(); | 277 display_controller_.reset(); |
| 318 screen_position_controller_.reset(); | 278 screen_position_controller_.reset(); |
| 319 | 279 |
| 320 #if defined(OS_CHROMEOS) && defined(USE_X11) | 280 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 321 if (display_change_observer_) | 281 if (display_change_observer_) |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 522 |
| 563 tooltip_controller_.reset(new views::corewm::TooltipController( | 523 tooltip_controller_.reset(new views::corewm::TooltipController( |
| 564 gfx::SCREEN_TYPE_ALTERNATE)); | 524 gfx::SCREEN_TYPE_ALTERNATE)); |
| 565 AddPreTargetHandler(tooltip_controller_.get()); | 525 AddPreTargetHandler(tooltip_controller_.get()); |
| 566 | 526 |
| 567 event_client_.reset(new internal::EventClientImpl); | 527 event_client_.reset(new internal::EventClientImpl); |
| 568 | 528 |
| 569 // This controller needs to be set before SetupManagedWindowMode. | 529 // This controller needs to be set before SetupManagedWindowMode. |
| 570 desktop_background_controller_.reset(new DesktopBackgroundController()); | 530 desktop_background_controller_.reset(new DesktopBackgroundController()); |
| 571 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | 531 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); |
| 572 if (!user_wallpaper_delegate_) | |
| 573 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | |
| 574 | 532 |
| 575 // StatusAreaWidget uses Shell's CapsLockDelegate. | 533 // StatusAreaWidget uses Shell's CapsLockDelegate. |
| 576 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); | 534 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); |
| 577 | 535 |
| 578 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate()); | 536 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate()); |
| 579 | 537 |
| 580 if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) { | 538 if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) { |
| 581 resize_shadow_controller_.reset(new internal::ResizeShadowController()); | 539 resize_shadow_controller_.reset(new internal::ResizeShadowController()); |
| 582 shadow_controller_.reset( | 540 shadow_controller_.reset( |
| 583 new views::corewm::ShadowController(activation_client_)); | 541 new views::corewm::ShadowController(activation_client_)); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 //////////////////////////////////////////////////////////////////////////////// | 921 //////////////////////////////////////////////////////////////////////////////// |
| 964 // Shell, aura::client::ActivationChangeObserver implementation: | 922 // Shell, aura::client::ActivationChangeObserver implementation: |
| 965 | 923 |
| 966 void Shell::OnWindowActivated(aura::Window* gained_active, | 924 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 967 aura::Window* lost_active) { | 925 aura::Window* lost_active) { |
| 968 if (gained_active) | 926 if (gained_active) |
| 969 target_root_window_ = gained_active->GetRootWindow(); | 927 target_root_window_ = gained_active->GetRootWindow(); |
| 970 } | 928 } |
| 971 | 929 |
| 972 } // namespace ash | 930 } // namespace ash |
| OLD | NEW |