OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_list.h" | 5 #include "chrome/browser/ui/browser_list.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // On the Mac, the application continues to run once all windows are closed. | 274 // On the Mac, the application continues to run once all windows are closed. |
275 // Terminate will result in a CloseAllBrowsers() call, and once (and if) | 275 // Terminate will result in a CloseAllBrowsers() call, and once (and if) |
276 // that is done, will cause the application to exit cleanly. | 276 // that is done, will cause the application to exit cleanly. |
277 chrome_browser_application_mac::Terminate(); | 277 chrome_browser_application_mac::Terminate(); |
278 #endif | 278 #endif |
279 } | 279 } |
280 | 280 |
281 // static | 281 // static |
282 void BrowserList::NotifyAndTerminate(bool fast_path) { | 282 void BrowserList::NotifyAndTerminate(bool fast_path) { |
283 #if defined(OS_CHROMEOS) | 283 #if defined(OS_CHROMEOS) |
284 if (!signout) return; | 284 if (!signout) |
285 NotifyWindowManagerAboutSignout(); | 285 return; |
286 #endif | 286 #endif |
287 | 287 |
288 if (fast_path) { | 288 if (fast_path) { |
289 NotificationService::current()->Notify(NotificationType::APP_TERMINATING, | 289 NotificationService::current()->Notify(NotificationType::APP_TERMINATING, |
290 NotificationService::AllSources(), | 290 NotificationService::AllSources(), |
291 NotificationService::NoDetails()); | 291 NotificationService::NoDetails()); |
292 } | 292 } |
293 | 293 |
294 #if defined(OS_CHROMEOS) | 294 #if defined(OS_CHROMEOS) |
| 295 NotifyWindowManagerAboutSignout(); |
295 chromeos::CrosLibrary* cros_library = chromeos::CrosLibrary::Get(); | 296 chromeos::CrosLibrary* cros_library = chromeos::CrosLibrary::Get(); |
296 if (cros_library->EnsureLoaded()) { | 297 if (cros_library->EnsureLoaded()) { |
297 // If update has been installed, reboot, otherwise, sign out. | 298 // If update has been installed, reboot, otherwise, sign out. |
298 if (cros_library->GetUpdateLibrary()->status().status == | 299 if (cros_library->GetUpdateLibrary()->status().status == |
299 chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) { | 300 chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) { |
300 cros_library->GetUpdateLibrary()->RebootAfterUpdate(); | 301 cros_library->GetUpdateLibrary()->RebootAfterUpdate(); |
301 } else { | 302 } else { |
302 cros_library->GetLoginLibrary()->StopSession(""); | 303 cros_library->GetLoginLibrary()->StopSession(""); |
303 } | 304 } |
304 return; | 305 return; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); | 430 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); |
430 | 431 |
431 // Login screen should show up in owner's locale. | 432 // Login screen should show up in owner's locale. |
432 PrefService* state = g_browser_process->local_state(); | 433 PrefService* state = g_browser_process->local_state(); |
433 if (state) { | 434 if (state) { |
434 std::string owner_locale = state->GetString(prefs::kOwnerLocale); | 435 std::string owner_locale = state->GetString(prefs::kOwnerLocale); |
435 if (!owner_locale.empty() && | 436 if (!owner_locale.empty() && |
436 state->GetString(prefs::kApplicationLocale) != owner_locale && | 437 state->GetString(prefs::kApplicationLocale) != owner_locale && |
437 !state->IsManagedPreference(prefs::kApplicationLocale)) { | 438 !state->IsManagedPreference(prefs::kApplicationLocale)) { |
438 state->SetString(prefs::kApplicationLocale, owner_locale); | 439 state->SetString(prefs::kApplicationLocale, owner_locale); |
439 state->ScheduleSavePersistentPrefs(); | 440 state->SavePersistentPrefs(); |
440 } | 441 } |
441 } | 442 } |
442 if (FastShutdown()) { | 443 if (FastShutdown()) |
443 return; | 444 return; |
444 } | |
445 #else | 445 #else |
446 // Reset the restart bit that might have been set in cancelled restart | 446 // Reset the restart bit that might have been set in cancelled restart |
447 // request. | 447 // request. |
448 PrefService* pref_service = g_browser_process->local_state(); | 448 PrefService* pref_service = g_browser_process->local_state(); |
449 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); | 449 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); |
450 #endif | 450 #endif |
451 AttemptExitInternal(); | 451 AttemptExitInternal(); |
452 } | 452 } |
453 | 453 |
454 // static | 454 // static |
(...skipping 19 matching lines...) Expand all Loading... |
474 // so crashes during shutdown are still reported in UMA. | 474 // so crashes during shutdown are still reported in UMA. |
475 if (AreAllBrowsersCloseable()) | 475 if (AreAllBrowsersCloseable()) |
476 MarkAsCleanShutdown(); | 476 MarkAsCleanShutdown(); |
477 AttemptExitInternal(); | 477 AttemptExitInternal(); |
478 } | 478 } |
479 | 479 |
480 #if defined(OS_CHROMEOS) | 480 #if defined(OS_CHROMEOS) |
481 // static | 481 // static |
482 void BrowserList::ExitCleanly() { | 482 void BrowserList::ExitCleanly() { |
483 // We always mark exit cleanly. | 483 // We always mark exit cleanly. |
484 MarkAsCleanShutdown(); | 484 g_browser_process->EndSession(); |
485 AttemptExitInternal(); | 485 AttemptExitInternal(); |
486 } | 486 } |
487 #endif | 487 #endif |
488 | 488 |
489 // static | 489 // static |
490 void BrowserList::SessionEnding() { | 490 void BrowserList::SessionEnding() { |
491 // EndSession is invoked once per frame. Only do something the first time. | 491 // EndSession is invoked once per frame. Only do something the first time. |
492 static bool already_ended = false; | 492 static bool already_ended = false; |
493 // We may get called in the middle of shutdown, e.g. http://crbug.com/70852 | 493 // We may get called in the middle of shutdown, e.g. http://crbug.com/70852 |
494 // In this case, do nothing. | 494 // In this case, do nothing. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 // If no more TabContents from Browsers, check the BackgroundPrintingManager. | 726 // If no more TabContents from Browsers, check the BackgroundPrintingManager. |
727 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { | 727 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { |
728 cur_ = *bg_printing_iterator_; | 728 cur_ = *bg_printing_iterator_; |
729 CHECK(cur_); | 729 CHECK(cur_); |
730 ++bg_printing_iterator_; | 730 ++bg_printing_iterator_; |
731 return; | 731 return; |
732 } | 732 } |
733 // Reached the end - no more TabContents. | 733 // Reached the end - no more TabContents. |
734 cur_ = NULL; | 734 cur_ = NULL; |
735 } | 735 } |
OLD | NEW |