| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 263 |
| 264 void Shell::SetDisplayWorkAreaInsets(Window* contains, | 264 void Shell::SetDisplayWorkAreaInsets(Window* contains, |
| 265 const gfx::Insets& insets) { | 265 const gfx::Insets& insets) { |
| 266 if (!window_tree_host_manager_->UpdateWorkAreaOfDisplayNearestWindow( | 266 if (!window_tree_host_manager_->UpdateWorkAreaOfDisplayNearestWindow( |
| 267 contains, insets)) { | 267 contains, insets)) { |
| 268 return; | 268 return; |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 void Shell::OnLoginStateChanged(LoginStatus status) { | 272 void Shell::OnLoginStateChanged(LoginStatus status) { |
| 273 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 273 for (auto& observer : *wm_shell_->shell_observers()) |
| 274 OnLoginStateChanged(status)); | 274 observer.OnLoginStateChanged(status); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void Shell::OnLoginUserProfilePrepared() { | 277 void Shell::OnLoginUserProfilePrepared() { |
| 278 wm_shell_->CreateShelf(); | 278 wm_shell_->CreateShelf(); |
| 279 CreateKeyboard(); | 279 CreateKeyboard(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void Shell::OnAppTerminating() { | 282 void Shell::OnAppTerminating() { |
| 283 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 283 for (auto& observer : *wm_shell_->shell_observers()) |
| 284 OnAppTerminating()); | 284 observer.OnAppTerminating(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void Shell::OnLockStateChanged(bool locked) { | 287 void Shell::OnLockStateChanged(bool locked) { |
| 288 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 288 for (auto& observer : *wm_shell_->shell_observers()) |
| 289 OnLockStateChanged(locked)); | 289 observer.OnLockStateChanged(locked); |
| 290 #ifndef NDEBUG | 290 #ifndef NDEBUG |
| 291 // Make sure that there is no system modal in Lock layer when unlocked. | 291 // Make sure that there is no system modal in Lock layer when unlocked. |
| 292 if (!locked) { | 292 if (!locked) { |
| 293 std::vector<WmWindow*> containers = wm::GetContainersFromAllRootWindows( | 293 std::vector<WmWindow*> containers = wm::GetContainersFromAllRootWindows( |
| 294 kShellWindowId_LockSystemModalContainer, | 294 kShellWindowId_LockSystemModalContainer, |
| 295 WmWindowAura::Get(GetPrimaryRootWindow())); | 295 WmWindowAura::Get(GetPrimaryRootWindow())); |
| 296 for (WmWindow* container : containers) | 296 for (WmWindow* container : containers) |
| 297 DCHECK(container->GetChildren().empty()); | 297 DCHECK(container->GetChildren().empty()); |
| 298 } | 298 } |
| 299 #endif | 299 #endif |
| 300 } | 300 } |
| 301 | 301 |
| 302 void Shell::OnCastingSessionStartedOrStopped(bool started) { | 302 void Shell::OnCastingSessionStartedOrStopped(bool started) { |
| 303 #if defined(OS_CHROMEOS) | 303 #if defined(OS_CHROMEOS) |
| 304 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 304 for (auto& observer : *wm_shell_->shell_observers()) |
| 305 OnCastingSessionStartedOrStopped(started)); | 305 observer.OnCastingSessionStartedOrStopped(started); |
| 306 #endif | 306 #endif |
| 307 } | 307 } |
| 308 | 308 |
| 309 void Shell::OnRootWindowAdded(WmWindow* root_window) { | 309 void Shell::OnRootWindowAdded(WmWindow* root_window) { |
| 310 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 310 for (auto& observer : *wm_shell_->shell_observers()) |
| 311 OnRootWindowAdded(root_window)); | 311 observer.OnRootWindowAdded(root_window); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void Shell::CreateKeyboard() { | 314 void Shell::CreateKeyboard() { |
| 315 // TODO(bshe): Primary root window controller may not be the controller to | 315 // TODO(bshe): Primary root window controller may not be the controller to |
| 316 // attach virtual keyboard. See http://crbug.com/303429 | 316 // attach virtual keyboard. See http://crbug.com/303429 |
| 317 InitKeyboard(); | 317 InitKeyboard(); |
| 318 GetPrimaryRootWindowController()->ActivateKeyboard( | 318 GetPrimaryRootWindowController()->ActivateKeyboard( |
| 319 keyboard::KeyboardController::GetInstance()); | 319 keyboard::KeyboardController::GetInstance()); |
| 320 } | 320 } |
| 321 | 321 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 357 |
| 358 SystemTray* Shell::GetPrimarySystemTray() { | 358 SystemTray* Shell::GetPrimarySystemTray() { |
| 359 return GetPrimaryRootWindowController()->GetSystemTray(); | 359 return GetPrimaryRootWindowController()->GetSystemTray(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 362 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 363 if (is_touch_hud_projection_enabled_ == enabled) | 363 if (is_touch_hud_projection_enabled_ == enabled) |
| 364 return; | 364 return; |
| 365 | 365 |
| 366 is_touch_hud_projection_enabled_ = enabled; | 366 is_touch_hud_projection_enabled_ = enabled; |
| 367 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 367 for (auto& observer : *wm_shell_->shell_observers()) |
| 368 OnTouchHudProjectionToggled(enabled)); | 368 observer.OnTouchHudProjectionToggled(enabled); |
| 369 } | 369 } |
| 370 | 370 |
| 371 #if defined(OS_CHROMEOS) | 371 #if defined(OS_CHROMEOS) |
| 372 FirstRunHelper* Shell::CreateFirstRunHelper() { | 372 FirstRunHelper* Shell::CreateFirstRunHelper() { |
| 373 return new FirstRunHelperImpl; | 373 return new FirstRunHelperImpl; |
| 374 } | 374 } |
| 375 | 375 |
| 376 void Shell::SetCursorCompositingEnabled(bool enabled) { | 376 void Shell::SetCursorCompositingEnabled(bool enabled) { |
| 377 window_tree_host_manager_->cursor_window_controller() | 377 window_tree_host_manager_->cursor_window_controller() |
| 378 ->SetCursorCompositingEnabled(enabled); | 378 ->SetCursorCompositingEnabled(enabled); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 new VideoActivityNotifier(video_detector_.get())); | 821 new VideoActivityNotifier(video_detector_.get())); |
| 822 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 822 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
| 823 screen_orientation_controller_.reset(new ScreenOrientationController()); | 823 screen_orientation_controller_.reset(new ScreenOrientationController()); |
| 824 screen_layout_observer_.reset(new ScreenLayoutObserver()); | 824 screen_layout_observer_.reset(new ScreenLayoutObserver()); |
| 825 #endif | 825 #endif |
| 826 // The compositor thread and main message loop have to be running in | 826 // The compositor thread and main message loop have to be running in |
| 827 // order to create mirror window. Run it after the main message loop | 827 // order to create mirror window. Run it after the main message loop |
| 828 // is started. | 828 // is started. |
| 829 display_manager_->CreateMirrorWindowAsyncIfAny(); | 829 display_manager_->CreateMirrorWindowAsyncIfAny(); |
| 830 | 830 |
| 831 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 831 for (auto& observer : *wm_shell_->shell_observers()) |
| 832 OnShellInitialized()); | 832 observer.OnShellInitialized(); |
| 833 | 833 |
| 834 user_metrics_recorder_->OnShellInitialized(); | 834 user_metrics_recorder_->OnShellInitialized(); |
| 835 } | 835 } |
| 836 | 836 |
| 837 void Shell::InitKeyboard() { | 837 void Shell::InitKeyboard() { |
| 838 if (keyboard::IsKeyboardEnabled()) { | 838 if (keyboard::IsKeyboardEnabled()) { |
| 839 if (keyboard::KeyboardController::GetInstance()) { | 839 if (keyboard::KeyboardController::GetInstance()) { |
| 840 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 840 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 841 for (RootWindowControllerList::iterator iter = controllers.begin(); | 841 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 842 iter != controllers.end(); ++iter) { | 842 iter != controllers.end(); ++iter) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { | 897 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { |
| 898 return std::unique_ptr<ui::EventTargetIterator>(); | 898 return std::unique_ptr<ui::EventTargetIterator>(); |
| 899 } | 899 } |
| 900 | 900 |
| 901 ui::EventTargeter* Shell::GetEventTargeter() { | 901 ui::EventTargeter* Shell::GetEventTargeter() { |
| 902 NOTREACHED(); | 902 NOTREACHED(); |
| 903 return nullptr; | 903 return nullptr; |
| 904 } | 904 } |
| 905 | 905 |
| 906 } // namespace ash | 906 } // namespace ash |
| OLD | NEW |