Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: ash/shell.cc

Issue 2108793002: mash: Convert system tray logout button to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more review comments, fix mash_unittests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/shell.h ('k') | ash/system/chromeos/enterprise/tray_enterprise.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 #include "ash/display/display_color_manager_chromeos.h" 132 #include "ash/display/display_color_manager_chromeos.h"
133 #include "ash/display/display_error_observer_chromeos.h" 133 #include "ash/display/display_error_observer_chromeos.h"
134 #include "ash/display/projecting_observer_chromeos.h" 134 #include "ash/display/projecting_observer_chromeos.h"
135 #include "ash/display/resolution_notification_controller.h" 135 #include "ash/display/resolution_notification_controller.h"
136 #include "ash/display/screen_orientation_controller_chromeos.h" 136 #include "ash/display/screen_orientation_controller_chromeos.h"
137 #include "ash/sticky_keys/sticky_keys_controller.h" 137 #include "ash/sticky_keys/sticky_keys_controller.h"
138 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" 138 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h"
139 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" 139 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h"
140 #include "ash/system/chromeos/power/power_event_observer.h" 140 #include "ash/system/chromeos/power/power_event_observer.h"
141 #include "ash/system/chromeos/power/video_activity_notifier.h" 141 #include "ash/system/chromeos/power/video_activity_notifier.h"
142 #include "ash/system/chromeos/session/last_window_closed_logout_reminder.h"
143 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
144 #include "ash/touch/touch_transformer_controller.h" 142 #include "ash/touch/touch_transformer_controller.h"
145 #include "ash/virtual_keyboard_controller.h" 143 #include "ash/virtual_keyboard_controller.h"
146 #include "base/bind_helpers.h" 144 #include "base/bind_helpers.h"
147 #include "base/sys_info.h" 145 #include "base/sys_info.h"
148 #include "chromeos/audio/audio_a11y_controller.h" 146 #include "chromeos/audio/audio_a11y_controller.h"
149 #include "chromeos/dbus/dbus_thread_manager.h" 147 #include "chromeos/dbus/dbus_thread_manager.h"
150 #include "ui/chromeos/user_activity_power_manager_notifier.h" 148 #include "ui/chromeos/user_activity_power_manager_notifier.h"
151 #include "ui/display/chromeos/display_configurator.h" 149 #include "ui/display/chromeos/display_configurator.h"
152 150
153 #if defined(USE_X11) 151 #if defined(USE_X11)
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 // since the latters destructor triggers events that the former is listening 677 // since the latters destructor triggers events that the former is listening
680 // to but no longer cares about. 678 // to but no longer cares about.
681 #if defined(OS_CHROMEOS) 679 #if defined(OS_CHROMEOS)
682 virtual_keyboard_controller_.reset(); 680 virtual_keyboard_controller_.reset();
683 #endif 681 #endif
684 682
685 // Destroy maximize mode controller early on since it has some observers which 683 // Destroy maximize mode controller early on since it has some observers which
686 // need to be removed. 684 // need to be removed.
687 maximize_mode_controller_.reset(); 685 maximize_mode_controller_.reset();
688 686
689 #if defined(OS_CHROMEOS)
690 // Destroy the LastWindowClosedLogoutReminder before the
691 // LogoutConfirmationController.
692 last_window_closed_logout_reminder_.reset();
693
694 // Destroy the LogoutConfirmationController before the SystemTrayDelegate.
695 logout_confirmation_controller_.reset();
696 #endif
697
698 // Destroy the keyboard before closing the shelf, since it will invoke a shelf 687 // Destroy the keyboard before closing the shelf, since it will invoke a shelf
699 // layout. 688 // layout.
700 DeactivateKeyboard(); 689 DeactivateKeyboard();
701 690
702 // Destroy toasts 691 // Destroy toasts
703 toast_manager_.reset(); 692 toast_manager_.reset();
704 693
705 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure 694 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure
706 // to deinitialize the shelf first, as it is initialized after the delegate. 695 // to deinitialize the shelf first, as it is initialized after the delegate.
707 ShutdownShelf(); 696 ShutdownShelf();
708 wm_shell_->system_tray_delegate()->Shutdown(); 697 wm_shell_->DeleteSystemTrayDelegate();
709 wm_shell_->SetSystemTrayDelegate(nullptr);
710 698
711 locale_notification_controller_.reset(); 699 locale_notification_controller_.reset();
712 700
713 // Drag-and-drop must be canceled prior to close all windows. 701 // Drag-and-drop must be canceled prior to close all windows.
714 drag_drop_controller_.reset(); 702 drag_drop_controller_.reset();
715 703
716 // Controllers who have WindowObserver added must be deleted 704 // Controllers who have WindowObserver added must be deleted
717 // before |window_tree_host_manager_| is deleted. 705 // before |window_tree_host_manager_| is deleted.
718 706
719 #if defined(OS_CHROMEOS) 707 #if defined(OS_CHROMEOS)
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 delegate()->CreateSystemTrayDelegate(); 1037 delegate()->CreateSystemTrayDelegate();
1050 DCHECK(system_tray_delegate); 1038 DCHECK(system_tray_delegate);
1051 wm_shell_->SetSystemTrayDelegate(base::WrapUnique(system_tray_delegate)); 1039 wm_shell_->SetSystemTrayDelegate(base::WrapUnique(system_tray_delegate));
1052 1040
1053 locale_notification_controller_.reset(new LocaleNotificationController); 1041 locale_notification_controller_.reset(new LocaleNotificationController);
1054 1042
1055 // Initialize toast manager 1043 // Initialize toast manager
1056 toast_manager_.reset(new ToastManager); 1044 toast_manager_.reset(new ToastManager);
1057 1045
1058 #if defined(OS_CHROMEOS) 1046 #if defined(OS_CHROMEOS)
1059 // Create the LogoutConfirmationController after the SystemTrayDelegate.
1060 logout_confirmation_controller_.reset(new LogoutConfirmationController(
1061 base::Bind(&SystemTrayDelegate::SignOut,
1062 base::Unretained(system_tray_delegate))));
1063
1064 // Create TouchTransformerController before 1047 // Create TouchTransformerController before
1065 // WindowTreeHostManager::InitDisplays() 1048 // WindowTreeHostManager::InitDisplays()
1066 // since TouchTransformerController listens on 1049 // since TouchTransformerController listens on
1067 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). 1050 // WindowTreeHostManager::Observer::OnDisplaysInitialized().
1068 if (!in_mus_) 1051 if (!in_mus_)
1069 touch_transformer_controller_.reset(new TouchTransformerController()); 1052 touch_transformer_controller_.reset(new TouchTransformerController());
1070 #endif // defined(OS_CHROMEOS) 1053 #endif // defined(OS_CHROMEOS)
1071 1054
1072 keyboard_ui_ = init_params.keyboard_factory.is_null() 1055 keyboard_ui_ = init_params.keyboard_factory.is_null()
1073 ? KeyboardUI::Create() 1056 ? KeyboardUI::Create()
(...skipping 29 matching lines...) Expand all
1103 accelerator_controller_->SetBrightnessControlDelegate( 1086 accelerator_controller_->SetBrightnessControlDelegate(
1104 std::unique_ptr<BrightnessControlDelegate>( 1087 std::unique_ptr<BrightnessControlDelegate>(
1105 new system::BrightnessControllerChromeos)); 1088 new system::BrightnessControllerChromeos));
1106 1089
1107 power_event_observer_.reset(new PowerEventObserver()); 1090 power_event_observer_.reset(new PowerEventObserver());
1108 user_activity_notifier_.reset( 1091 user_activity_notifier_.reset(
1109 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); 1092 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get()));
1110 video_activity_notifier_.reset( 1093 video_activity_notifier_.reset(
1111 new VideoActivityNotifier(video_detector_.get())); 1094 new VideoActivityNotifier(video_detector_.get()));
1112 bluetooth_notification_controller_.reset(new BluetoothNotificationController); 1095 bluetooth_notification_controller_.reset(new BluetoothNotificationController);
1113 last_window_closed_logout_reminder_.reset(new LastWindowClosedLogoutReminder);
1114 screen_orientation_controller_.reset(new ScreenOrientationController()); 1096 screen_orientation_controller_.reset(new ScreenOrientationController());
1115 #endif 1097 #endif
1116 // The compositor thread and main message loop have to be running in 1098 // The compositor thread and main message loop have to be running in
1117 // order to create mirror window. Run it after the main message loop 1099 // order to create mirror window. Run it after the main message loop
1118 // is started. 1100 // is started.
1119 display_manager_->CreateMirrorWindowAsyncIfAny(); 1101 display_manager_->CreateMirrorWindowAsyncIfAny();
1120 1102
1121 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), 1103 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(),
1122 OnShellInitialized()); 1104 OnShellInitialized());
1123 1105
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 1182
1201 void Shell::OnWindowActivated( 1183 void Shell::OnWindowActivated(
1202 aura::client::ActivationChangeObserver::ActivationReason reason, 1184 aura::client::ActivationChangeObserver::ActivationReason reason,
1203 aura::Window* gained_active, 1185 aura::Window* gained_active,
1204 aura::Window* lost_active) { 1186 aura::Window* lost_active) {
1205 if (gained_active) 1187 if (gained_active)
1206 target_root_window_ = gained_active->GetRootWindow(); 1188 target_root_window_ = gained_active->GetRootWindow();
1207 } 1189 }
1208 1190
1209 } // namespace ash 1191 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/system/chromeos/enterprise/tray_enterprise.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698