Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
| 8 #include "ash/media_delegate.h" | 8 #include "ash/media_delegate.h" |
| 9 #include "ash/wm/mru_window_tracker.h" | 9 #include "ash/wm/mru_window_tracker.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "chrome/browser/accessibility/accessibility_events.h" | 13 #include "chrome/browser/accessibility/accessibility_events.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 16 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 16 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 17 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 17 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
| 18 #include "chrome/browser/chromeos/display/display_configuration_observer.h" | |
| 18 #include "chrome/browser/chromeos/display/display_preferences.h" | 19 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 19 #include "chrome/browser/chromeos/extensions/media_player_api.h" | 20 #include "chrome/browser/chromeos/extensions/media_player_api.h" |
| 20 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 21 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/speech/tts_controller.h" | 23 #include "chrome/browser/speech/tts_controller.h" |
| 23 #include "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h" | 24 #include "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h" |
| 24 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" | 25 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" |
| 25 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" | 26 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" |
| 26 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" | 27 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
| 27 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 | 201 |
| 201 } // anonymous namespace | 202 } // anonymous namespace |
| 202 | 203 |
| 203 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { | 204 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { |
| 204 return CommandLine::ForCurrentProcess()->HasSwitch( | 205 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 205 chromeos::switches::kFirstExecAfterBoot); | 206 chromeos::switches::kFirstExecAfterBoot); |
| 206 } | 207 } |
| 207 | 208 |
| 208 void ChromeShellDelegate::PreInit() { | 209 void ChromeShellDelegate::PreInit() { |
| 209 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); | 210 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); |
| 211 display_configuration_observer_.reset( | |
| 212 new chromeos::DisplayConfigurationObserver()); | |
|
Jun Mukai
2014/01/13 23:51:15
I'm not sure why moving display_configuration_obse
oshima
2014/01/13 23:58:19
This should happen before Shell::Init so that obse
| |
| 210 } | 213 } |
| 211 | 214 |
| 212 void ChromeShellDelegate::Shutdown() { | 215 void ChromeShellDelegate::Shutdown() { |
| 213 content::RecordAction(content::UserMetricsAction("Shutdown")); | 216 content::RecordAction(content::UserMetricsAction("Shutdown")); |
| 214 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 217 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 215 RequestShutdown(); | 218 RequestShutdown(); |
| 219 | |
| 220 // Let classes unregister themselves as observers of the ash::Shell singleton | |
| 221 // before the shell is destroyed. | |
| 222 display_configuration_observer_.reset(); | |
| 216 } | 223 } |
| 217 | 224 |
| 218 ash::CapsLockDelegate* ChromeShellDelegate::CreateCapsLockDelegate() { | 225 ash::CapsLockDelegate* ChromeShellDelegate::CreateCapsLockDelegate() { |
| 219 chromeos::input_method::XKeyboard* xkeyboard = | 226 chromeos::input_method::XKeyboard* xkeyboard = |
| 220 chromeos::input_method::InputMethodManager::Get()->GetXKeyboard(); | 227 chromeos::input_method::InputMethodManager::Get()->GetXKeyboard(); |
| 221 return new CapsLockDelegate(xkeyboard); | 228 return new CapsLockDelegate(xkeyboard); |
| 222 } | 229 } |
| 223 | 230 |
| 224 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { | 231 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { |
| 225 return new SessionStateDelegateChromeos; | 232 return new SessionStateDelegateChromeos; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 } | 269 } |
| 263 | 270 |
| 264 void ChromeShellDelegate::PlatformInit() { | 271 void ChromeShellDelegate::PlatformInit() { |
| 265 registrar_.Add(this, | 272 registrar_.Add(this, |
| 266 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 273 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 267 content::NotificationService::AllSources()); | 274 content::NotificationService::AllSources()); |
| 268 registrar_.Add(this, | 275 registrar_.Add(this, |
| 269 chrome::NOTIFICATION_SESSION_STARTED, | 276 chrome::NOTIFICATION_SESSION_STARTED, |
| 270 content::NotificationService::AllSources()); | 277 content::NotificationService::AllSources()); |
| 271 } | 278 } |
| OLD | NEW |