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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 460 } |
461 | 461 |
462 void Shell::AddShellObserver(ShellObserver* observer) { | 462 void Shell::AddShellObserver(ShellObserver* observer) { |
463 observers_.AddObserver(observer); | 463 observers_.AddObserver(observer); |
464 } | 464 } |
465 | 465 |
466 void Shell::RemoveShellObserver(ShellObserver* observer) { | 466 void Shell::RemoveShellObserver(ShellObserver* observer) { |
467 observers_.RemoveObserver(observer); | 467 observers_.RemoveObserver(observer); |
468 } | 468 } |
469 | 469 |
470 void Shell::EnableMaximizeModeWindowManager(bool enable) { | |
471 if (enable && !maximize_mode_window_manager_.get()) { | |
472 maximize_mode_window_manager_.reset(new MaximizeModeWindowManager()); | |
473 } else if (!enable && maximize_mode_window_manager_.get()) { | |
474 maximize_mode_window_manager_.reset(); | |
475 } | |
476 } | |
477 | |
478 bool Shell::IsMaximizeModeWindowManagerEnabled() { | |
479 return maximize_mode_window_manager_.get() != NULL; | |
480 } | |
481 | |
482 #if defined(OS_CHROMEOS) | 470 #if defined(OS_CHROMEOS) |
483 bool Shell::ShouldSaveDisplaySettings() { | 471 bool Shell::ShouldSaveDisplaySettings() { |
484 return !((IsMaximizeModeWindowManagerEnabled() && | 472 return !((maximize_mode_controller_->IsMaximizeModeWindowManagerEnabled() && |
485 maximize_mode_controller_->in_set_screen_rotation()) || | 473 maximize_mode_controller_->in_set_screen_rotation()) || |
486 resolution_notification_controller_->DoesNotificationTimeout()); | 474 resolution_notification_controller_->DoesNotificationTimeout()); |
487 } | 475 } |
488 #endif | 476 #endif |
489 | 477 |
490 void Shell::UpdateShelfVisibility() { | 478 void Shell::UpdateShelfVisibility() { |
491 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 479 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
492 for (RootWindowControllerList::iterator iter = controllers.begin(); | 480 for (RootWindowControllerList::iterator iter = controllers.begin(); |
493 iter != controllers.end(); ++iter) | 481 iter != controllers.end(); ++iter) |
494 if ((*iter)->shelf()) | 482 if ((*iter)->shelf()) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 RemovePreTargetHandler(event_transformation_handler_.get()); | 672 RemovePreTargetHandler(event_transformation_handler_.get()); |
685 RemovePreTargetHandler(toplevel_window_event_handler_.get()); | 673 RemovePreTargetHandler(toplevel_window_event_handler_.get()); |
686 RemovePostTargetHandler(toplevel_window_event_handler_.get()); | 674 RemovePostTargetHandler(toplevel_window_event_handler_.get()); |
687 RemovePreTargetHandler(system_gesture_filter_.get()); | 675 RemovePreTargetHandler(system_gesture_filter_.get()); |
688 RemovePreTargetHandler(keyboard_metrics_filter_.get()); | 676 RemovePreTargetHandler(keyboard_metrics_filter_.get()); |
689 RemovePreTargetHandler(mouse_cursor_filter_.get()); | 677 RemovePreTargetHandler(mouse_cursor_filter_.get()); |
690 | 678 |
691 // TooltipController is deleted with the Shell so removing its references. | 679 // TooltipController is deleted with the Shell so removing its references. |
692 RemovePreTargetHandler(tooltip_controller_.get()); | 680 RemovePreTargetHandler(tooltip_controller_.get()); |
693 | 681 |
694 // Destroy maximize window manager early on since it has some observers which | 682 // Destroy maximize mode controller early on since it has some observers which |
695 // need to be removed. | 683 // need to be removed. |
| 684 maximize_mode_controller_->Shutdown(); |
696 maximize_mode_controller_.reset(); | 685 maximize_mode_controller_.reset(); |
697 maximize_mode_window_manager_.reset(); | |
698 | 686 |
699 // AppList needs to be released before shelf layout manager, which is | 687 // AppList needs to be released before shelf layout manager, which is |
700 // destroyed with shelf container in the loop below. However, app list | 688 // destroyed with shelf container in the loop below. However, app list |
701 // container is now on top of shelf container and released after it. | 689 // container is now on top of shelf container and released after it. |
702 // TODO(xiyuan): Move it back when app list container is no longer needed. | 690 // TODO(xiyuan): Move it back when app list container is no longer needed. |
703 app_list_controller_.reset(); | 691 app_list_controller_.reset(); |
704 | 692 |
705 #if defined(OS_CHROMEOS) | 693 #if defined(OS_CHROMEOS) |
706 // Destroy the LastWindowClosedLogoutReminder before the | 694 // Destroy the LastWindowClosedLogoutReminder before the |
707 // LogoutConfirmationController. | 695 // LogoutConfirmationController. |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 //////////////////////////////////////////////////////////////////////////////// | 1139 //////////////////////////////////////////////////////////////////////////////// |
1152 // Shell, aura::client::ActivationChangeObserver implementation: | 1140 // Shell, aura::client::ActivationChangeObserver implementation: |
1153 | 1141 |
1154 void Shell::OnWindowActivated(aura::Window* gained_active, | 1142 void Shell::OnWindowActivated(aura::Window* gained_active, |
1155 aura::Window* lost_active) { | 1143 aura::Window* lost_active) { |
1156 if (gained_active) | 1144 if (gained_active) |
1157 target_root_window_ = gained_active->GetRootWindow(); | 1145 target_root_window_ = gained_active->GetRootWindow(); |
1158 } | 1146 } |
1159 | 1147 |
1160 } // namespace ash | 1148 } // namespace ash |
OLD | NEW |