| 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/accelerators/magnifier_key_scroller.h" | 7 #include "ash/accelerators/magnifier_key_scroller.h" |
| 8 #include "ash/accelerators/spoken_feedback_toggler.h" | 8 #include "ash/accelerators/spoken_feedback_toggler.h" |
| 9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
| 10 #include "ash/media_delegate.h" | 10 #include "ash/media_delegate.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" | 28 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" |
| 29 #include "chrome/browser/speech/tts_controller.h" | 29 #include "chrome/browser/speech/tts_controller.h" |
| 30 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" | 30 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" |
| 31 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" | 31 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" |
| 32 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" | 32 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
| 33 #include "chrome/browser/ui/browser.h" | 33 #include "chrome/browser/ui/browser.h" |
| 34 #include "chrome/browser/ui/browser_finder.h" | 34 #include "chrome/browser/ui/browser_finder.h" |
| 35 #include "chrome/browser/ui/browser_window.h" | 35 #include "chrome/browser/ui/browser_window.h" |
| 36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 37 #include "chromeos/chromeos_switches.h" | 37 #include "chromeos/chromeos_switches.h" |
| 38 #include "chromeos/dbus/dbus_thread_manager.h" | |
| 39 #include "chromeos/dbus/power_manager_client.h" | |
| 40 #include "chromeos/ime/input_method_manager.h" | 38 #include "chromeos/ime/input_method_manager.h" |
| 41 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
| 42 #include "content/public/browser/user_metrics.h" | 40 #include "content/public/browser/user_metrics.h" |
| 43 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
| 44 #include "ui/aura/window.h" | 42 #include "ui/aura/window.h" |
| 45 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
| 46 | 44 |
| 47 namespace { | 45 namespace { |
| 48 | 46 |
| 49 void InitAfterSessionStart() { | 47 void InitAfterSessionStart() { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 228 } |
| 231 | 229 |
| 232 void ChromeShellDelegate::PreInit() { | 230 void ChromeShellDelegate::PreInit() { |
| 233 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); | 231 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); |
| 234 // Set the observer now so that we can save the initial state | 232 // Set the observer now so that we can save the initial state |
| 235 // in Shell::Init. | 233 // in Shell::Init. |
| 236 display_configuration_observer_.reset( | 234 display_configuration_observer_.reset( |
| 237 new chromeos::DisplayConfigurationObserver()); | 235 new chromeos::DisplayConfigurationObserver()); |
| 238 } | 236 } |
| 239 | 237 |
| 240 void ChromeShellDelegate::Shutdown() { | 238 void ChromeShellDelegate::PreShutdown() { |
| 241 content::RecordAction(base::UserMetricsAction("Shutdown")); | 239 display_configuration_observer_.reset(); |
| 242 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | |
| 243 RequestShutdown(); | |
| 244 } | 240 } |
| 245 | 241 |
| 246 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { | 242 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { |
| 247 return new SessionStateDelegateChromeos; | 243 return new SessionStateDelegateChromeos; |
| 248 } | 244 } |
| 249 | 245 |
| 250 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { | 246 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { |
| 251 return new AccessibilityDelegateImpl; | 247 return new AccessibilityDelegateImpl; |
| 252 } | 248 } |
| 253 | 249 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 278 // Start the error notifier service to show auth notifications. | 274 // Start the error notifier service to show auth notifications. |
| 279 SigninErrorNotifierFactory::GetForProfile(profile); | 275 SigninErrorNotifierFactory::GetForProfile(profile); |
| 280 } | 276 } |
| 281 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 277 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
| 282 break; | 278 break; |
| 283 } | 279 } |
| 284 case chrome::NOTIFICATION_SESSION_STARTED: | 280 case chrome::NOTIFICATION_SESSION_STARTED: |
| 285 InitAfterSessionStart(); | 281 InitAfterSessionStart(); |
| 286 ash::Shell::GetInstance()->ShowShelf(); | 282 ash::Shell::GetInstance()->ShowShelf(); |
| 287 break; | 283 break; |
| 288 case chrome::NOTIFICATION_APP_TERMINATING: | |
| 289 // Let classes unregister themselves as observers of the | |
| 290 // ash::Shell singleton before the shell is destroyed. | |
| 291 display_configuration_observer_.reset(); | |
| 292 break; | |
| 293 default: | 284 default: |
| 294 NOTREACHED() << "Unexpected notification " << type; | 285 NOTREACHED() << "Unexpected notification " << type; |
| 295 } | 286 } |
| 296 } | 287 } |
| 297 | 288 |
| 298 void ChromeShellDelegate::PlatformInit() { | 289 void ChromeShellDelegate::PlatformInit() { |
| 299 registrar_.Add(this, | 290 registrar_.Add(this, |
| 300 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 291 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 301 content::NotificationService::AllSources()); | 292 content::NotificationService::AllSources()); |
| 302 registrar_.Add(this, | 293 registrar_.Add(this, |
| 303 chrome::NOTIFICATION_SESSION_STARTED, | 294 chrome::NOTIFICATION_SESSION_STARTED, |
| 304 content::NotificationService::AllSources()); | 295 content::NotificationService::AllSources()); |
| 305 registrar_.Add(this, | |
| 306 chrome::NOTIFICATION_APP_TERMINATING, | |
| 307 content::NotificationService::AllSources()); | |
| 308 } | 296 } |
| OLD | NEW |