| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 #endif | 375 #endif |
| 376 } | 376 } |
| 377 | 377 |
| 378 void Shell::OnCastingSessionStartedOrStopped(bool started) { | 378 void Shell::OnCastingSessionStartedOrStopped(bool started) { |
| 379 #if defined(OS_CHROMEOS) && defined(USE_X11) | 379 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 380 if (projecting_observer_) | 380 if (projecting_observer_) |
| 381 projecting_observer_->OnCastingSessionStartedOrStopped(started); | 381 projecting_observer_->OnCastingSessionStartedOrStopped(started); |
| 382 #endif | 382 #endif |
| 383 } | 383 } |
| 384 | 384 |
| 385 void Shell::OnOverviewModeStarted() { |
| 386 FOR_EACH_OBSERVER(ShellObserver, observers_, OnOverviewModeStarted()); |
| 387 } |
| 388 |
| 389 void Shell::OnOverviewModeEnded() { |
| 390 FOR_EACH_OBSERVER(ShellObserver, observers_, OnOverviewModeEnded()); |
| 391 } |
| 392 |
| 385 void Shell::CreateShelf() { | 393 void Shell::CreateShelf() { |
| 386 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 394 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 387 for (RootWindowControllerList::iterator iter = controllers.begin(); | 395 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 388 iter != controllers.end(); ++iter) | 396 iter != controllers.end(); ++iter) |
| 389 (*iter)->shelf()->CreateShelf(); | 397 (*iter)->shelf()->CreateShelf(); |
| 390 } | 398 } |
| 391 | 399 |
| 392 void Shell::CreateKeyboard() { | 400 void Shell::CreateKeyboard() { |
| 393 // TODO(bshe): Primary root window controller may not be the controller to | 401 // TODO(bshe): Primary root window controller may not be the controller to |
| 394 // attach virtual keyboard. See http://crbug.com/303429 | 402 // attach virtual keyboard. See http://crbug.com/303429 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 438 |
| 431 void Shell::EnableMaximizeModeWindowManager(bool enable) { | 439 void Shell::EnableMaximizeModeWindowManager(bool enable) { |
| 432 if (enable && !maximize_mode_window_manager_.get()) { | 440 if (enable && !maximize_mode_window_manager_.get()) { |
| 433 maximize_mode_window_manager_.reset( | 441 maximize_mode_window_manager_.reset( |
| 434 new internal::MaximizeModeWindowManager()); | 442 new internal::MaximizeModeWindowManager()); |
| 435 } else if (!enable && maximize_mode_window_manager_.get()) { | 443 } else if (!enable && maximize_mode_window_manager_.get()) { |
| 436 maximize_mode_window_manager_.reset(); | 444 maximize_mode_window_manager_.reset(); |
| 437 } | 445 } |
| 438 } | 446 } |
| 439 | 447 |
| 448 bool Shell::IsMaximizeModeWindowManagerEnabled() { |
| 449 return NULL != maximize_mode_window_manager_.get(); |
| 450 } |
| 451 |
| 440 void Shell::UpdateShelfVisibility() { | 452 void Shell::UpdateShelfVisibility() { |
| 441 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 453 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 442 for (RootWindowControllerList::iterator iter = controllers.begin(); | 454 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 443 iter != controllers.end(); ++iter) | 455 iter != controllers.end(); ++iter) |
| 444 if ((*iter)->shelf()) | 456 if ((*iter)->shelf()) |
| 445 (*iter)->UpdateShelfVisibility(); | 457 (*iter)->UpdateShelfVisibility(); |
| 446 } | 458 } |
| 447 | 459 |
| 448 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, | 460 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, |
| 449 aura::Window* root_window) { | 461 aura::Window* root_window) { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 RemovePreTargetHandler(toplevel_window_event_handler_.get()); | 656 RemovePreTargetHandler(toplevel_window_event_handler_.get()); |
| 645 RemovePostTargetHandler(toplevel_window_event_handler_.get()); | 657 RemovePostTargetHandler(toplevel_window_event_handler_.get()); |
| 646 RemovePreTargetHandler(system_gesture_filter_.get()); | 658 RemovePreTargetHandler(system_gesture_filter_.get()); |
| 647 RemovePreTargetHandler(keyboard_metrics_filter_.get()); | 659 RemovePreTargetHandler(keyboard_metrics_filter_.get()); |
| 648 if (mouse_cursor_filter_) | 660 if (mouse_cursor_filter_) |
| 649 RemovePreTargetHandler(mouse_cursor_filter_.get()); | 661 RemovePreTargetHandler(mouse_cursor_filter_.get()); |
| 650 | 662 |
| 651 // TooltipController is deleted with the Shell so removing its references. | 663 // TooltipController is deleted with the Shell so removing its references. |
| 652 RemovePreTargetHandler(tooltip_controller_.get()); | 664 RemovePreTargetHandler(tooltip_controller_.get()); |
| 653 | 665 |
| 666 // Disable the maximize mode here since it can be destroyed without without |
| 667 // side effects, but needs to be destroyed before the root windows and the |
| 668 // WorkspaceLayoutManager get destroyed. |
| 669 maximize_mode_window_manager_.reset(); |
| 670 |
| 654 // AppList needs to be released before shelf layout manager, which is | 671 // AppList needs to be released before shelf layout manager, which is |
| 655 // destroyed with shelf container in the loop below. However, app list | 672 // destroyed with shelf container in the loop below. However, app list |
| 656 // container is now on top of shelf container and released after it. | 673 // container is now on top of shelf container and released after it. |
| 657 // TODO(xiyuan): Move it back when app list container is no longer needed. | 674 // TODO(xiyuan): Move it back when app list container is no longer needed. |
| 658 app_list_controller_.reset(); | 675 app_list_controller_.reset(); |
| 659 | 676 |
| 660 // Destroy SystemTrayDelegate before destroying the status area(s). | 677 // Destroy SystemTrayDelegate before destroying the status area(s). |
| 661 system_tray_delegate_->Shutdown(); | 678 system_tray_delegate_->Shutdown(); |
| 662 system_tray_delegate_.reset(); | 679 system_tray_delegate_.reset(); |
| 663 | 680 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 //////////////////////////////////////////////////////////////////////////////// | 1105 //////////////////////////////////////////////////////////////////////////////// |
| 1089 // Shell, aura::client::ActivationChangeObserver implementation: | 1106 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1090 | 1107 |
| 1091 void Shell::OnWindowActivated(aura::Window* gained_active, | 1108 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1092 aura::Window* lost_active) { | 1109 aura::Window* lost_active) { |
| 1093 if (gained_active) | 1110 if (gained_active) |
| 1094 target_root_window_ = gained_active->GetRootWindow(); | 1111 target_root_window_ = gained_active->GetRootWindow(); |
| 1095 } | 1112 } |
| 1096 | 1113 |
| 1097 } // namespace ash | 1114 } // namespace ash |
| OLD | NEW |