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 15 matching lines...) Expand all Loading... |
26 #include "ash/common/gpu_support.h" | 26 #include "ash/common/gpu_support.h" |
27 #include "ash/common/keyboard/keyboard_ui.h" | 27 #include "ash/common/keyboard/keyboard_ui.h" |
28 #include "ash/common/login_status.h" | 28 #include "ash/common/login_status.h" |
29 #include "ash/common/palette_delegate.h" | 29 #include "ash/common/palette_delegate.h" |
30 #include "ash/common/session/session_state_delegate.h" | 30 #include "ash/common/session/session_state_delegate.h" |
31 #include "ash/common/shelf/wm_shelf.h" | 31 #include "ash/common/shelf/wm_shelf.h" |
32 #include "ash/common/shell_delegate.h" | 32 #include "ash/common/shell_delegate.h" |
33 #include "ash/common/shell_observer.h" | 33 #include "ash/common/shell_observer.h" |
34 #include "ash/common/system/brightness_control_delegate.h" | 34 #include "ash/common/system/brightness_control_delegate.h" |
35 #include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller
.h" | 35 #include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller
.h" |
| 36 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth_helper.h" |
36 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h
" | 37 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h
" |
37 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" | 38 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" |
38 #include "ash/common/system/chromeos/network/sms_observer.h" | 39 #include "ash/common/system/chromeos/network/sms_observer.h" |
39 #include "ash/common/system/chromeos/power/power_status.h" | 40 #include "ash/common/system/chromeos/power/power_status.h" |
40 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" | 41 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" |
41 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 42 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
42 #include "ash/common/system/locale/locale_notification_controller.h" | 43 #include "ash/common/system/locale/locale_notification_controller.h" |
43 #include "ash/common/system/status_area_widget.h" | 44 #include "ash/common/system/status_area_widget.h" |
44 #include "ash/common/system/toast/toast_manager.h" | 45 #include "ash/common/system/toast/toast_manager.h" |
45 #include "ash/common/system/tray/system_tray_controller.h" | 46 #include "ash/common/system/tray/system_tray_controller.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 cast_config_(base::MakeUnique<CastConfigController>()), | 521 cast_config_(base::MakeUnique<CastConfigController>()), |
521 focus_cycler_(base::MakeUnique<FocusCycler>()), | 522 focus_cycler_(base::MakeUnique<FocusCycler>()), |
522 keyboard_brightness_control_delegate_( | 523 keyboard_brightness_control_delegate_( |
523 base::MakeUnique<KeyboardBrightnessController>()), | 524 base::MakeUnique<KeyboardBrightnessController>()), |
524 locale_notification_controller_( | 525 locale_notification_controller_( |
525 base::MakeUnique<LocaleNotificationController>()), | 526 base::MakeUnique<LocaleNotificationController>()), |
526 shell_delegate_(std::move(shell_delegate)), | 527 shell_delegate_(std::move(shell_delegate)), |
527 system_tray_controller_(base::MakeUnique<SystemTrayController>()), | 528 system_tray_controller_(base::MakeUnique<SystemTrayController>()), |
528 app_list_(base::MakeUnique<app_list::AppList>()), | 529 app_list_(base::MakeUnique<app_list::AppList>()), |
529 link_handler_model_factory_(nullptr), | 530 link_handler_model_factory_(nullptr), |
| 531 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()), |
530 display_configurator_(new display::DisplayConfigurator()), | 532 display_configurator_(new display::DisplayConfigurator()), |
531 native_cursor_manager_(nullptr), | 533 native_cursor_manager_(nullptr), |
532 simulate_modal_window_open_for_testing_(false), | 534 simulate_modal_window_open_for_testing_(false), |
533 is_touch_hud_projection_enabled_(false) { | 535 is_touch_hud_projection_enabled_(false) { |
534 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash | 536 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash |
535 // state on WmShellAura. http://crbug.com/671246. | 537 // state on WmShellAura. http://crbug.com/671246. |
536 | 538 |
537 if (!wm_shell_->IsRunningInMash()) { | 539 if (!wm_shell_->IsRunningInMash()) { |
538 gpu_support_.reset(shell_delegate_->CreateGPUSupport()); | 540 gpu_support_.reset(shell_delegate_->CreateGPUSupport()); |
539 display_manager_.reset(ScreenAsh::CreateDisplayManager()); | 541 display_manager_.reset(ScreenAsh::CreateDisplayManager()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 // Destroy the keyboard before closing the shelf, since it will invoke a shelf | 604 // Destroy the keyboard before closing the shelf, since it will invoke a shelf |
603 // layout. | 605 // layout. |
604 DeactivateKeyboard(); | 606 DeactivateKeyboard(); |
605 | 607 |
606 toast_manager_.reset(); | 608 toast_manager_.reset(); |
607 | 609 |
608 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure | 610 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure |
609 // to deinitialize the shelf first, as it is initialized after the delegate. | 611 // to deinitialize the shelf first, as it is initialized after the delegate. |
610 for (WmWindow* root : wm_shell_->GetAllRootWindows()) | 612 for (WmWindow* root : wm_shell_->GetAllRootWindows()) |
611 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget(); | 613 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget(); |
| 614 tray_bluetooth_helper_.reset(); |
612 DeleteSystemTrayDelegate(); | 615 DeleteSystemTrayDelegate(); |
613 | 616 |
614 // Drag-and-drop must be canceled prior to close all windows. | 617 // Drag-and-drop must be canceled prior to close all windows. |
615 drag_drop_controller_.reset(); | 618 drag_drop_controller_.reset(); |
616 | 619 |
617 // Controllers who have WindowObserver added must be deleted | 620 // Controllers who have WindowObserver added must be deleted |
618 // before |window_tree_host_manager_| is deleted. | 621 // before |window_tree_host_manager_| is deleted. |
619 | 622 |
620 // VideoActivityNotifier must be deleted before |video_detector_| is | 623 // VideoActivityNotifier must be deleted before |video_detector_| is |
621 // deleted because it's observing video activity through | 624 // deleted because it's observing video activity through |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 // Must occur after Shell has installed its early pre-target handlers (for | 967 // Must occur after Shell has installed its early pre-target handlers (for |
965 // example, WindowModalityController). | 968 // example, WindowModalityController). |
966 wm_shell_->CreatePointerWatcherAdapter(); | 969 wm_shell_->CreatePointerWatcherAdapter(); |
967 | 970 |
968 resize_shadow_controller_.reset(new ResizeShadowController()); | 971 resize_shadow_controller_.reset(new ResizeShadowController()); |
969 shadow_controller_.reset(new ::wm::ShadowController(focus_controller_.get())); | 972 shadow_controller_.reset(new ::wm::ShadowController(focus_controller_.get())); |
970 | 973 |
971 SetSystemTrayDelegate( | 974 SetSystemTrayDelegate( |
972 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); | 975 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); |
973 | 976 |
| 977 // May trigger initialization of the Bluetooth adapter. |
| 978 tray_bluetooth_helper_->Initialize(); |
| 979 |
974 // Create AshTouchTransformController before | 980 // Create AshTouchTransformController before |
975 // WindowTreeHostManager::InitDisplays() | 981 // WindowTreeHostManager::InitDisplays() |
976 // since AshTouchTransformController listens on | 982 // since AshTouchTransformController listens on |
977 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). | 983 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). |
978 if (!is_mash) { | 984 if (!is_mash) { |
979 touch_transformer_controller_.reset(new AshTouchTransformController( | 985 touch_transformer_controller_.reset(new AshTouchTransformController( |
980 display_configurator_.get(), display_manager_.get())); | 986 display_configurator_.get(), display_manager_.get())); |
981 } | 987 } |
982 | 988 |
983 keyboard_ui_ = wm_shell_->CreateKeyboardUI(); | 989 keyboard_ui_ = wm_shell_->CreateKeyboardUI(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 void Shell::OnWindowActivated( | 1136 void Shell::OnWindowActivated( |
1131 aura::client::ActivationChangeObserver::ActivationReason reason, | 1137 aura::client::ActivationChangeObserver::ActivationReason reason, |
1132 aura::Window* gained_active, | 1138 aura::Window* gained_active, |
1133 aura::Window* lost_active) { | 1139 aura::Window* lost_active) { |
1134 WmWindow* gained_active_wm = WmWindow::Get(gained_active); | 1140 WmWindow* gained_active_wm = WmWindow::Get(gained_active); |
1135 if (gained_active_wm) | 1141 if (gained_active_wm) |
1136 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); | 1142 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); |
1137 } | 1143 } |
1138 | 1144 |
1139 } // namespace ash | 1145 } // namespace ash |
OLD | NEW |