Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 23 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 24 #include "chrome/browser/defaults.h" | 24 #include "chrome/browser/defaults.h" |
| 25 #include "chrome/browser/extensions/extension_creator.h" | 25 #include "chrome/browser/extensions/extension_creator.h" |
| 26 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
| 27 #include "chrome/browser/extensions/pack_extension_job.h" | 27 #include "chrome/browser/extensions/pack_extension_job.h" |
| 28 #include "chrome/browser/first_run/first_run.h" | 28 #include "chrome/browser/first_run/first_run.h" |
| 29 #include "chrome/browser/net/predictor.h" | 29 #include "chrome/browser/net/predictor.h" |
| 30 #include "chrome/browser/net/url_fixer_upper.h" | 30 #include "chrome/browser/net/url_fixer_upper.h" |
| 31 #include "chrome/browser/notifications/desktop_notification_service.h" | 31 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 32 #include "chrome/browser/performance_monitor/startup_timer.h" | |
| 32 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 33 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 33 #include "chrome/browser/prefs/pref_service.h" | 34 #include "chrome/browser/prefs/pref_service.h" |
| 34 #include "chrome/browser/prefs/session_startup_pref.h" | 35 #include "chrome/browser/prefs/session_startup_pref.h" |
| 35 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
| 36 #include "chrome/browser/profiles/profile_io_data.h" | 37 #include "chrome/browser/profiles/profile_io_data.h" |
| 37 #include "chrome/browser/protector/protected_prefs_watcher.h" | 38 #include "chrome/browser/protector/protected_prefs_watcher.h" |
| 38 #include "chrome/browser/protector/protector_service.h" | 39 #include "chrome/browser/protector/protector_service.h" |
| 39 #include "chrome/browser/protector/protector_service_factory.h" | 40 #include "chrome/browser/protector/protector_service_factory.h" |
| 40 #include "chrome/browser/protector/protector_utils.h" | 41 #include "chrome/browser/protector/protector_utils.h" |
| 41 #include "chrome/browser/sessions/session_restore.h" | 42 #include "chrome/browser/sessions/session_restore.h" |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 591 if (!profile_->DidLastSessionExitCleanly() && | 592 if (!profile_->DidLastSessionExitCleanly() && |
| 592 !command_line_.HasSwitch(switches::kRestoreLastSession)) { | 593 !command_line_.HasSwitch(switches::kRestoreLastSession)) { |
| 593 // The last session crashed. It's possible automatically loading the | 594 // The last session crashed. It's possible automatically loading the |
| 594 // page will trigger another crash, locking the user out of chrome. | 595 // page will trigger another crash, locking the user out of chrome. |
| 595 // To avoid this, don't restore on startup but instead show the crashed | 596 // To avoid this, don't restore on startup but instead show the crashed |
| 596 // infobar. | 597 // infobar. |
| 597 VLOG(1) << "Unclean exit; not processing"; | 598 VLOG(1) << "Unclean exit; not processing"; |
| 598 return false; | 599 return false; |
| 599 } | 600 } |
| 600 | 601 |
| 601 uint32 restore_behavior = SessionRestore::SYNCHRONOUS | | 602 uint32 restore_behavior = SessionRestore::SYNCHRONOUS | |
| 602 SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; | 603 SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; |
| 603 #if defined(OS_MACOSX) | 604 #if defined(OS_MACOSX) |
| 604 // On Mac, when restoring a session with no windows, suppress the creation | 605 // On Mac, when restoring a session with no windows, suppress the creation |
| 605 // of a new window in the case where the system is launching Chrome via a | 606 // of a new window in the case where the system is launching Chrome via a |
| 606 // login item or Lion's resume feature. | 607 // login item or Lion's resume feature. |
| 607 if (base::mac::WasLaunchedAsLoginOrResumeItem()) { | 608 if (base::mac::WasLaunchedAsLoginOrResumeItem()) { |
| 608 restore_behavior = restore_behavior & | 609 restore_behavior = restore_behavior & |
| 609 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; | 610 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; |
| 610 } | 611 } |
| 611 #endif | 612 #endif |
| 612 | 613 |
| 614 // Pause the StartupTimer. Since the restore here is synchronous, we can | |
| 615 // keep these two metrics (browser startup time and session restore time) | |
| 616 // separate. | |
| 617 DCHECK(performance_monitor::StartupTimer::PauseTimer()); | |
|
sky
2012/08/07 19:48:04
This structure means PauseTimer isn't invoked in r
Devlin
2012/08/07 22:51:22
D'oh! Was using that as a shortcut for "bool x = P
| |
| 618 | |
| 613 Browser* browser = SessionRestore::RestoreSession(profile_, | 619 Browser* browser = SessionRestore::RestoreSession(profile_, |
| 614 NULL, | 620 NULL, |
| 615 restore_behavior, | 621 restore_behavior, |
| 616 urls_to_open); | 622 urls_to_open); |
| 623 | |
| 624 DCHECK(performance_monitor::StartupTimer::UnpauseTimer()); | |
| 625 | |
| 617 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 626 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
| 618 return true; | 627 return true; |
| 619 } | 628 } |
| 620 | 629 |
| 621 Browser* browser = ProcessSpecifiedURLs(urls_to_open); | 630 Browser* browser = ProcessSpecifiedURLs(urls_to_open); |
| 622 if (!browser) | 631 if (!browser) |
| 623 return false; | 632 return false; |
| 624 | 633 |
| 625 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 634 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
| 626 return true; | 635 return true; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 // New: | 915 // New: |
| 907 prefs->GetString(prefs::kHomePage), | 916 prefs->GetString(prefs::kHomePage), |
| 908 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 917 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
| 909 prefs->GetBoolean(prefs::kShowHomeButton), | 918 prefs->GetBoolean(prefs::kShowHomeButton), |
| 910 // Backup: | 919 // Backup: |
| 911 backup_homepage, | 920 backup_homepage, |
| 912 backup_homepage_is_ntp, | 921 backup_homepage_is_ntp, |
| 913 backup_show_home_button)); | 922 backup_show_home_button)); |
| 914 } | 923 } |
| 915 } | 924 } |
| OLD | NEW |