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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_restore_service.h" | 10 #include "apps/app_restore_service.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 33 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
34 #include "chrome/browser/defaults.h" | 34 #include "chrome/browser/defaults.h" |
35 #include "chrome/browser/extensions/extension_creator.h" | 35 #include "chrome/browser/extensions/extension_creator.h" |
36 #include "chrome/browser/extensions/extension_util.h" | 36 #include "chrome/browser/extensions/extension_util.h" |
37 #include "chrome/browser/extensions/launch_util.h" | 37 #include "chrome/browser/extensions/launch_util.h" |
38 #include "chrome/browser/extensions/pack_extension_job.h" | 38 #include "chrome/browser/extensions/pack_extension_job.h" |
39 #include "chrome/browser/first_run/first_run.h" | 39 #include "chrome/browser/first_run/first_run.h" |
40 #include "chrome/browser/infobars/infobar_service.h" | 40 #include "chrome/browser/infobars/infobar_service.h" |
41 #include "chrome/browser/net/predictor.h" | 41 #include "chrome/browser/net/predictor.h" |
42 #include "chrome/browser/notifications/desktop_notification_service.h" | 42 #include "chrome/browser/notifications/desktop_notification_service.h" |
43 #include "chrome/browser/performance_monitor/startup_timer.h" | |
44 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 43 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
45 #include "chrome/browser/prefs/session_startup_pref.h" | 44 #include "chrome/browser/prefs/session_startup_pref.h" |
46 #include "chrome/browser/profiles/profile.h" | 45 #include "chrome/browser/profiles/profile.h" |
47 #include "chrome/browser/profiles/profile_io_data.h" | 46 #include "chrome/browser/profiles/profile_io_data.h" |
48 #include "chrome/browser/rlz/rlz.h" | 47 #include "chrome/browser/rlz/rlz.h" |
49 #include "chrome/browser/sessions/session_restore.h" | 48 #include "chrome/browser/sessions/session_restore.h" |
50 #include "chrome/browser/sessions/session_service.h" | 49 #include "chrome/browser/sessions/session_service.h" |
51 #include "chrome/browser/sessions/session_service_factory.h" | 50 #include "chrome/browser/sessions/session_service_factory.h" |
52 #include "chrome/browser/shell_integration.h" | 51 #include "chrome/browser/shell_integration.h" |
53 #include "chrome/browser/signin/signin_promo.h" | 52 #include "chrome/browser/signin/signin_promo.h" |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 #if defined(OS_MACOSX) | 626 #if defined(OS_MACOSX) |
628 // On Mac, when restoring a session with no windows, suppress the creation | 627 // On Mac, when restoring a session with no windows, suppress the creation |
629 // of a new window in the case where the system is launching Chrome via a | 628 // of a new window in the case where the system is launching Chrome via a |
630 // login item or Lion's resume feature. | 629 // login item or Lion's resume feature. |
631 if (base::mac::WasLaunchedAsLoginOrResumeItem()) { | 630 if (base::mac::WasLaunchedAsLoginOrResumeItem()) { |
632 restore_behavior = restore_behavior & | 631 restore_behavior = restore_behavior & |
633 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; | 632 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; |
634 } | 633 } |
635 #endif | 634 #endif |
636 | 635 |
637 // Pause the StartupTimer. Since the restore here is synchronous, we can | |
638 // keep these two metrics (browser startup time and session restore time) | |
639 // separate. | |
640 performance_monitor::StartupTimer::PauseTimer(); | |
641 | |
642 // The startup code only executes for browsers launched in desktop mode. | 636 // The startup code only executes for browsers launched in desktop mode. |
643 // i.e. HOST_DESKTOP_TYPE_NATIVE. Ash should never get here. | 637 // i.e. HOST_DESKTOP_TYPE_NATIVE. Ash should never get here. |
644 Browser* browser = SessionRestore::RestoreSession( | 638 Browser* browser = SessionRestore::RestoreSession( |
645 profile_, NULL, desktop_type, restore_behavior, | 639 profile_, NULL, desktop_type, restore_behavior, |
646 urls_to_open); | 640 urls_to_open); |
647 | 641 |
648 performance_monitor::StartupTimer::UnpauseTimer(); | |
649 | |
650 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 642 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
651 return true; | 643 return true; |
652 } | 644 } |
653 | 645 |
654 Browser* browser = ProcessSpecifiedURLs(urls_to_open, desktop_type); | 646 Browser* browser = ProcessSpecifiedURLs(urls_to_open, desktop_type); |
655 if (!browser) | 647 if (!browser) |
656 return false; | 648 return false; |
657 | 649 |
658 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 650 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
659 | 651 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 // behavior is desired because completing or skipping the sync promo | 907 // behavior is desired because completing or skipping the sync promo |
916 // causes a redirect to the NTP. | 908 // causes a redirect to the NTP. |
917 if (!startup_urls->empty() && | 909 if (!startup_urls->empty() && |
918 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) | 910 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) |
919 startup_urls->at(0) = sync_promo_url; | 911 startup_urls->at(0) = sync_promo_url; |
920 else | 912 else |
921 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 913 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
922 } | 914 } |
923 } | 915 } |
924 } | 916 } |
OLD | NEW |