Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #include "ash/shelf/shelf_item_delegate.h" | 42 #include "ash/shelf/shelf_item_delegate.h" |
| 43 #include "ash/shelf/shelf_item_delegate_manager.h" | 43 #include "ash/shelf/shelf_item_delegate_manager.h" |
| 44 #include "ash/shelf/shelf_layout_manager.h" | 44 #include "ash/shelf/shelf_layout_manager.h" |
| 45 #include "ash/shelf/shelf_model.h" | 45 #include "ash/shelf/shelf_model.h" |
| 46 #include "ash/shelf/shelf_widget.h" | 46 #include "ash/shelf/shelf_widget.h" |
| 47 #include "ash/shelf/shelf_window_watcher.h" | 47 #include "ash/shelf/shelf_window_watcher.h" |
| 48 #include "ash/shell_delegate.h" | 48 #include "ash/shell_delegate.h" |
| 49 #include "ash/shell_factory.h" | 49 #include "ash/shell_factory.h" |
| 50 #include "ash/shell_window_ids.h" | 50 #include "ash/shell_window_ids.h" |
| 51 #include "ash/system/locale/locale_notification_controller.h" | 51 #include "ash/system/locale/locale_notification_controller.h" |
| 52 #include "ash/system/logout_confirmation/logout_confirmation_controller.h" | |
| 52 #include "ash/system/status_area_widget.h" | 53 #include "ash/system/status_area_widget.h" |
| 53 #include "ash/system/tray/system_tray_delegate.h" | 54 #include "ash/system/tray/system_tray_delegate.h" |
| 54 #include "ash/system/tray/system_tray_notifier.h" | 55 #include "ash/system/tray/system_tray_notifier.h" |
| 55 #include "ash/wm/app_list_controller.h" | 56 #include "ash/wm/app_list_controller.h" |
| 56 #include "ash/wm/ash_focus_rules.h" | 57 #include "ash/wm/ash_focus_rules.h" |
| 57 #include "ash/wm/ash_native_cursor_manager.h" | 58 #include "ash/wm/ash_native_cursor_manager.h" |
| 58 #include "ash/wm/coordinate_conversion.h" | 59 #include "ash/wm/coordinate_conversion.h" |
| 59 #include "ash/wm/custom_frame_view_ash.h" | 60 #include "ash/wm/custom_frame_view_ash.h" |
| 60 #include "ash/wm/event_client_impl.h" | 61 #include "ash/wm/event_client_impl.h" |
| 61 #include "ash/wm/lock_state_controller.h" | 62 #include "ash/wm/lock_state_controller.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 73 #include "ash/wm/toplevel_window_event_handler.h" | 74 #include "ash/wm/toplevel_window_event_handler.h" |
| 74 #include "ash/wm/user_activity_detector.h" | 75 #include "ash/wm/user_activity_detector.h" |
| 75 #include "ash/wm/video_detector.h" | 76 #include "ash/wm/video_detector.h" |
| 76 #include "ash/wm/window_animations.h" | 77 #include "ash/wm/window_animations.h" |
| 77 #include "ash/wm/window_cycle_controller.h" | 78 #include "ash/wm/window_cycle_controller.h" |
| 78 #include "ash/wm/window_positioner.h" | 79 #include "ash/wm/window_positioner.h" |
| 79 #include "ash/wm/window_properties.h" | 80 #include "ash/wm/window_properties.h" |
| 80 #include "ash/wm/window_util.h" | 81 #include "ash/wm/window_util.h" |
| 81 #include "ash/wm/workspace_controller.h" | 82 #include "ash/wm/workspace_controller.h" |
| 82 #include "base/bind.h" | 83 #include "base/bind.h" |
| 84 #include "base/bind_helpers.h" | |
| 83 #include "base/command_line.h" | 85 #include "base/command_line.h" |
| 84 #include "base/debug/trace_event.h" | 86 #include "base/debug/trace_event.h" |
| 87 #include "base/time/default_tick_clock.h" | |
| 85 #include "ui/aura/client/aura_constants.h" | 88 #include "ui/aura/client/aura_constants.h" |
| 86 #include "ui/aura/client/user_action_client.h" | 89 #include "ui/aura/client/user_action_client.h" |
| 87 #include "ui/aura/env.h" | 90 #include "ui/aura/env.h" |
| 88 #include "ui/aura/layout_manager.h" | 91 #include "ui/aura/layout_manager.h" |
| 89 #include "ui/aura/window.h" | 92 #include "ui/aura/window.h" |
| 90 #include "ui/aura/window_event_dispatcher.h" | 93 #include "ui/aura/window_event_dispatcher.h" |
| 91 #include "ui/base/ui_base_switches.h" | 94 #include "ui/base/ui_base_switches.h" |
| 92 #include "ui/compositor/layer.h" | 95 #include "ui/compositor/layer.h" |
| 93 #include "ui/compositor/layer_animator.h" | 96 #include "ui/compositor/layer_animator.h" |
| 94 #include "ui/events/event_target_iterator.h" | 97 #include "ui/events/event_target_iterator.h" |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 | 651 |
| 649 // TooltipController is deleted with the Shell so removing its references. | 652 // TooltipController is deleted with the Shell so removing its references. |
| 650 RemovePreTargetHandler(tooltip_controller_.get()); | 653 RemovePreTargetHandler(tooltip_controller_.get()); |
| 651 | 654 |
| 652 // AppList needs to be released before shelf layout manager, which is | 655 // AppList needs to be released before shelf layout manager, which is |
| 653 // destroyed with shelf container in the loop below. However, app list | 656 // destroyed with shelf container in the loop below. However, app list |
| 654 // container is now on top of shelf container and released after it. | 657 // container is now on top of shelf container and released after it. |
| 655 // TODO(xiyuan): Move it back when app list container is no longer needed. | 658 // TODO(xiyuan): Move it back when app list container is no longer needed. |
| 656 app_list_controller_.reset(); | 659 app_list_controller_.reset(); |
| 657 | 660 |
| 661 // Destroy the LogoutConfirmationController before the SystemTrayDelegate. | |
| 662 logout_confirmation_controller_.reset(); | |
| 663 | |
| 658 // Destroy SystemTrayDelegate before destroying the status area(s). | 664 // Destroy SystemTrayDelegate before destroying the status area(s). |
| 659 system_tray_delegate_->Shutdown(); | 665 system_tray_delegate_->Shutdown(); |
| 660 system_tray_delegate_.reset(); | 666 system_tray_delegate_.reset(); |
| 661 | 667 |
| 662 locale_notification_controller_.reset(); | 668 locale_notification_controller_.reset(); |
| 663 | 669 |
| 664 // Drag-and-drop must be canceled prior to close all windows. | 670 // Drag-and-drop must be canceled prior to close all windows. |
| 665 drag_drop_controller_.reset(); | 671 drag_drop_controller_.reset(); |
| 666 | 672 |
| 667 // Controllers who have WindowObserver added must be deleted | 673 // Controllers who have WindowObserver added must be deleted |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 945 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. | 951 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. |
| 946 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); | 952 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); |
| 947 DCHECK(system_tray_delegate_.get()); | 953 DCHECK(system_tray_delegate_.get()); |
| 948 | 954 |
| 949 locale_notification_controller_.reset( | 955 locale_notification_controller_.reset( |
| 950 new internal::LocaleNotificationController); | 956 new internal::LocaleNotificationController); |
| 951 | 957 |
| 952 // Initialize system_tray_delegate_ after StatusAreaWidget is created. | 958 // Initialize system_tray_delegate_ after StatusAreaWidget is created. |
| 953 system_tray_delegate_->Initialize(); | 959 system_tray_delegate_->Initialize(); |
| 954 | 960 |
| 961 // Create the LogoutConfirmationController after the SystemTrayDelegate. | |
| 962 logout_confirmation_controller_.reset( | |
| 963 new internal::LogoutConfirmationController( | |
| 964 scoped_ptr<base::TickClock>(new base::DefaultTickClock), | |
|
stevenjb
2014/02/27 17:58:44
nit: use make_scoped_ptr?
bartfab (slow)
2014/02/28 12:13:49
make_scoped_ptr cannot be used when upcasting, as
stevenjb
2014/03/04 23:33:29
Ah, I missed the upcast. I like this version bette
| |
| 965 base::Bind(&SystemTrayDelegate::SignOut, | |
| 966 base::Unretained(system_tray_delegate_.get())))); | |
|
stevenjb
2014/02/27 17:58:44
Even though we are explicitly creating/destroying
bartfab (slow)
2014/02/28 12:13:49
The reason for doing it this way is that I can sup
stevenjb
2014/03/04 23:33:29
Testability is important, but stability even more
bartfab (slow)
2014/03/05 18:19:44
Added a comment.
| |
| 967 | |
| 955 // TODO(oshima): Initialize all RootWindowControllers once, and | 968 // TODO(oshima): Initialize all RootWindowControllers once, and |
| 956 // initialize controller/delegates above when initializing the | 969 // initialize controller/delegates above when initializing the |
| 957 // primary root window controller. | 970 // primary root window controller. |
| 958 internal::RootWindowController::CreateForPrimaryDisplay( | 971 internal::RootWindowController::CreateForPrimaryDisplay( |
| 959 root_window->GetDispatcher()); | 972 root_window->GetDispatcher()); |
| 960 | 973 |
| 961 display_controller_->InitSecondaryDisplays(); | 974 display_controller_->InitSecondaryDisplays(); |
| 962 | 975 |
| 963 // It needs to be created after RootWindowController has been created | 976 // It needs to be created after RootWindowController has been created |
| 964 // (which calls OnWindowResized has been called, otherwise the | 977 // (which calls OnWindowResized has been called, otherwise the |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1083 //////////////////////////////////////////////////////////////////////////////// | 1096 //////////////////////////////////////////////////////////////////////////////// |
| 1084 // Shell, aura::client::ActivationChangeObserver implementation: | 1097 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1085 | 1098 |
| 1086 void Shell::OnWindowActivated(aura::Window* gained_active, | 1099 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1087 aura::Window* lost_active) { | 1100 aura::Window* lost_active) { |
| 1088 if (gained_active) | 1101 if (gained_active) |
| 1089 target_root_window_ = gained_active->GetRootWindow(); | 1102 target_root_window_ = gained_active->GetRootWindow(); |
| 1090 } | 1103 } |
| 1091 | 1104 |
| 1092 } // namespace ash | 1105 } // namespace ash |
| OLD | NEW |