| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 | 231 |
| 232 void ChromeShellDelegate::PreInit() { | 232 void ChromeShellDelegate::PreInit() { |
| 233 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); | 233 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); |
| 234 // Set the observer now so that we can save the initial state | 234 // Set the observer now so that we can save the initial state |
| 235 // in Shell::Init. | 235 // in Shell::Init. |
| 236 display_configuration_observer_.reset( | 236 display_configuration_observer_.reset( |
| 237 new chromeos::DisplayConfigurationObserver()); | 237 new chromeos::DisplayConfigurationObserver()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void ChromeShellDelegate::Shutdown() { | 240 void ChromeShellDelegate::PreShutdown() { |
| 241 content::RecordAction(base::UserMetricsAction("Shutdown")); | 241 display_configuration_observer_.reset(); |
| 242 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | |
| 243 RequestShutdown(); | |
| 244 } | 242 } |
| 245 | 243 |
| 246 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { | 244 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { |
| 247 return new SessionStateDelegateChromeos; | 245 return new SessionStateDelegateChromeos; |
| 248 } | 246 } |
| 249 | 247 |
| 250 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { | 248 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { |
| 251 return new AccessibilityDelegateImpl; | 249 return new AccessibilityDelegateImpl; |
| 252 } | 250 } |
| 253 | 251 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 278 // Start the error notifier service to show auth notifications. | 276 // Start the error notifier service to show auth notifications. |
| 279 SigninErrorNotifierFactory::GetForProfile(profile); | 277 SigninErrorNotifierFactory::GetForProfile(profile); |
| 280 } | 278 } |
| 281 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 279 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
| 282 break; | 280 break; |
| 283 } | 281 } |
| 284 case chrome::NOTIFICATION_SESSION_STARTED: | 282 case chrome::NOTIFICATION_SESSION_STARTED: |
| 285 InitAfterSessionStart(); | 283 InitAfterSessionStart(); |
| 286 ash::Shell::GetInstance()->ShowShelf(); | 284 ash::Shell::GetInstance()->ShowShelf(); |
| 287 break; | 285 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: | 286 default: |
| 294 NOTREACHED() << "Unexpected notification " << type; | 287 NOTREACHED() << "Unexpected notification " << type; |
| 295 } | 288 } |
| 296 } | 289 } |
| 297 | 290 |
| 298 void ChromeShellDelegate::PlatformInit() { | 291 void ChromeShellDelegate::PlatformInit() { |
| 299 registrar_.Add(this, | 292 registrar_.Add(this, |
| 300 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 293 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 301 content::NotificationService::AllSources()); | 294 content::NotificationService::AllSources()); |
| 302 registrar_.Add(this, | 295 registrar_.Add(this, |
| 303 chrome::NOTIFICATION_SESSION_STARTED, | 296 chrome::NOTIFICATION_SESSION_STARTED, |
| 304 content::NotificationService::AllSources()); | 297 content::NotificationService::AllSources()); |
| 305 registrar_.Add(this, | |
| 306 chrome::NOTIFICATION_APP_TERMINATING, | |
| 307 content::NotificationService::AllSources()); | |
| 308 } | 298 } |
| OLD | NEW |