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