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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "apps/app_restore_service.h" | 14 #include "apps/app_restore_service.h" |
15 #include "apps/app_restore_service_factory.h" | 15 #include "apps/app_restore_service_factory.h" |
16 #include "base/bind.h" | 16 #include "base/bind.h" |
17 #include "base/bind_helpers.h" | 17 #include "base/bind_helpers.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
20 #include "base/environment.h" | 20 #include "base/environment.h" |
21 #include "base/feature_list.h" | |
21 #include "base/lazy_instance.h" | 22 #include "base/lazy_instance.h" |
22 #include "base/metrics/histogram_macros.h" | 23 #include "base/metrics/histogram_macros.h" |
23 #include "base/metrics/statistics_recorder.h" | 24 #include "base/metrics/statistics_recorder.h" |
24 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
25 #include "base/strings/string_split.h" | 26 #include "base/strings/string_split.h" |
26 #include "base/strings/string_util.h" | 27 #include "base/strings/string_util.h" |
27 #include "base/strings/stringprintf.h" | 28 #include "base/strings/stringprintf.h" |
28 #include "base/strings/utf_string_conversions.h" | 29 #include "base/strings/utf_string_conversions.h" |
29 #include "base/threading/thread_restrictions.h" | 30 #include "base/threading/thread_restrictions.h" |
30 #include "build/build_config.h" | 31 #include "build/build_config.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 #include "chrome/browser/ui/chrome_pages.h" | 64 #include "chrome/browser/ui/chrome_pages.h" |
64 #include "chrome/browser/ui/extensions/app_launch_params.h" | 65 #include "chrome/browser/ui/extensions/app_launch_params.h" |
65 #include "chrome/browser/ui/extensions/application_launch.h" | 66 #include "chrome/browser/ui/extensions/application_launch.h" |
66 #include "chrome/browser/ui/session_crashed_bubble.h" | 67 #include "chrome/browser/ui/session_crashed_bubble.h" |
67 #include "chrome/browser/ui/startup/bad_flags_prompt.h" | 68 #include "chrome/browser/ui/startup/bad_flags_prompt.h" |
68 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 69 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
69 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" | 70 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" |
70 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" | 71 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" |
71 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" | 72 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" |
72 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 73 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
74 #include "chrome/browser/ui/startup/startup_features.h" | |
73 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 75 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
74 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 76 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
75 #include "chrome/common/chrome_constants.h" | 77 #include "chrome/common/chrome_constants.h" |
76 #include "chrome/common/chrome_paths.h" | 78 #include "chrome/common/chrome_paths.h" |
77 #include "chrome/common/chrome_result_codes.h" | 79 #include "chrome/common/chrome_result_codes.h" |
78 #include "chrome/common/chrome_switches.h" | 80 #include "chrome/common/chrome_switches.h" |
79 #include "chrome/common/extensions/extension_constants.h" | 81 #include "chrome/common/extensions/extension_constants.h" |
80 #include "chrome/common/extensions/extension_metrics.h" | 82 #include "chrome/common/extensions/extension_metrics.h" |
81 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
82 #include "chrome/common/url_constants.h" | 84 #include "chrome/common/url_constants.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 WebContents* app_tab = ::OpenAppShortcutWindow(profile, url); | 496 WebContents* app_tab = ::OpenAppShortcutWindow(profile, url); |
495 return (app_tab != NULL); | 497 return (app_tab != NULL); |
496 } | 498 } |
497 } | 499 } |
498 return false; | 500 return false; |
499 } | 501 } |
500 | 502 |
501 void StartupBrowserCreatorImpl::ProcessLaunchURLs( | 503 void StartupBrowserCreatorImpl::ProcessLaunchURLs( |
502 bool process_startup, | 504 bool process_startup, |
503 const std::vector<GURL>& urls_to_open) { | 505 const std::vector<GURL>& urls_to_open) { |
506 if (base::FeatureList::IsEnabled(features::kUseConsolidatedStartupFlow)) { | |
507 ProcessLaunchUrlsUsingConsolidatedFlow(process_startup, urls_to_open); | |
508 return; | |
509 } | |
510 // TODO(tmartino): Remainder of this function is deprecated. Remove when | |
511 // kUseConsolidatedStartupFlow is on by default. | |
512 | |
504 // Don't open any browser windows if we're starting up in "background mode". | 513 // Don't open any browser windows if we're starting up in "background mode". |
505 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow)) | 514 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow)) |
506 return; | 515 return; |
507 | 516 |
508 // Determine whether or not this launch must include the welcome page. | 517 // Determine whether or not this launch must include the welcome page. |
509 InitializeWelcomeRunType(urls_to_open); | 518 InitializeWelcomeRunType(urls_to_open); |
510 | 519 |
511 // TODO(tapted): Move this to startup_browser_creator_win.cc after refactor. | |
512 #if defined(OS_WIN) | |
513 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | |
514 // See if there are apps for this profile that should be launched on startup | |
515 // due to a switch from Metro mode. | |
516 app_metro_launch::HandleAppLaunchForMetroRestart(profile_); | |
517 } | |
518 #endif | |
519 | |
520 if (process_startup && ProcessStartupURLs(urls_to_open)) { | 520 if (process_startup && ProcessStartupURLs(urls_to_open)) { |
521 // ProcessStartupURLs processed the urls, nothing else to do. | 521 // ProcessStartupURLs processed the urls, nothing else to do. |
522 return; | 522 return; |
523 } | 523 } |
524 | 524 |
525 chrome::startup::IsProcessStartup is_process_startup = process_startup ? | 525 chrome::startup::IsProcessStartup is_process_startup = process_startup ? |
526 chrome::startup::IS_PROCESS_STARTUP : | 526 chrome::startup::IS_PROCESS_STARTUP : |
527 chrome::startup::IS_NOT_PROCESS_STARTUP; | 527 chrome::startup::IS_NOT_PROCESS_STARTUP; |
528 if (!process_startup) { | 528 if (!process_startup) { |
529 // Even if we're not starting a new process, this may conceptually be | 529 // Even if we're not starting a new process, this may conceptually be |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 // Always open a list of urls in a window on the native desktop. | 561 // Always open a list of urls in a window on the native desktop. |
562 browser = chrome::FindTabbedBrowser(profile_, false); | 562 browser = chrome::FindTabbedBrowser(profile_, false); |
563 } | 563 } |
564 // This will launch a browser; prevent session restore. | 564 // This will launch a browser; prevent session restore. |
565 StartupBrowserCreator::in_synchronous_profile_launch_ = true; | 565 StartupBrowserCreator::in_synchronous_profile_launch_ = true; |
566 browser = OpenURLsInBrowser(browser, process_startup, adjusted_urls); | 566 browser = OpenURLsInBrowser(browser, process_startup, adjusted_urls); |
567 StartupBrowserCreator::in_synchronous_profile_launch_ = false; | 567 StartupBrowserCreator::in_synchronous_profile_launch_ = false; |
568 AddInfoBarsIfNecessary(browser, is_process_startup); | 568 AddInfoBarsIfNecessary(browser, is_process_startup); |
569 } | 569 } |
570 | 570 |
571 void StartupBrowserCreatorImpl::ProcessLaunchUrlsUsingConsolidatedFlow( | |
572 bool process_startup, | |
573 const std::vector<GURL>& cmd_line_urls) { | |
574 // Don't open any browser windows if starting up in "background mode". | |
575 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow)) | |
576 return; | |
577 | |
578 std::unique_ptr<StartupTabProvider> provider(new StartupTabProviderImpl()); | |
grt (UTC plus 2)
2016/09/09 11:40:30
can you put this on the stack here:
StartupTabPr
tmartino
2016/09/10 00:19:41
My understanding is that this needs to be a pointe
grt (UTC plus 2)
2016/09/12 07:28:46
Were you passing by value or by constref? The latt
| |
579 // If command-line URLs were passed, they supercede all other policies and | |
580 // logic. | |
581 StartupTabs tabs; | |
582 if (cmd_line_urls.empty()) { | |
grt (UTC plus 2)
2016/09/09 11:40:29
nit: i think the code will follow the comment abov
| |
583 bool is_incognito = IncognitoModePrefs::ShouldLaunchIncognito( | |
584 command_line_, profile_->GetPrefs()); | |
585 bool is_crash = HasPendingUncleanExit(profile_); | |
586 tabs = DetermineStartupTabs(provider.get(), is_incognito, is_crash); | |
587 } else { | |
588 UrlsToTabs(cmd_line_urls, &tabs); | |
589 } | |
590 | |
591 // TODO(tmartino): If this is not process startup, attempt to restore | |
592 // asynchronously and return here. This logic is self-contained in | |
593 // SessionService and therefore can't be combined with the other Browser | |
594 // creation logic. | |
595 | |
596 // TODO(tmartino): Function which determines what behavior of session | |
597 // restore, if any, is necessary. Incorporates code from ProcessStartupUrls. | |
598 | |
599 Browser* browser = | |
600 RestoreOrCreateBrowser(tabs | |
601 /* TODO(tmartino): Also pass behavior here */); | |
602 | |
603 // Finally, add info bars. | |
604 chrome::startup::IsProcessStartup is_process_startup = | |
605 process_startup ? chrome::startup::IS_PROCESS_STARTUP | |
grt (UTC plus 2)
2016/09/09 11:40:29
nit: inline this below?
| |
606 : chrome::startup::IS_NOT_PROCESS_STARTUP; | |
607 AddInfoBarsIfNecessary(browser, is_process_startup); | |
608 } | |
609 | |
610 StartupTabs StartupBrowserCreatorImpl::DetermineStartupTabs( | |
611 StartupTabProvider* provider, | |
grt (UTC plus 2)
2016/09/09 11:40:30
if this doesn't mutate the provider, pass it by co
tmartino
2016/09/10 00:19:41
See discussion above re: pointers. However, I did
| |
612 bool is_incognito, | |
613 bool is_crash) { | |
grt (UTC plus 2)
2016/09/09 11:40:29
is_crash -> is_post_crash_launch?
| |
614 StartupTabs tabs; | |
615 | |
616 // No policy- or profile-related content is shown in incognito mode. | |
617 // Similarly, when recovering from a crash, nothing should be opened | |
618 // automatically to prevent getting the user stuck in a crash loop. | |
619 if (!is_incognito && !is_crash) { | |
620 StartupTabs master_prefs_tabs = | |
621 provider->GetMasterPreferencesTabs(browser_creator_); | |
grt (UTC plus 2)
2016/09/09 11:40:29
do you need a nullptr check on browser_creator_ ei
grt (UTC plus 2)
2016/09/09 11:40:29
i think it should be more clear here that this is
tmartino
2016/09/10 00:19:41
I think it does. In my mind, the fact that this on
| |
622 if (!master_prefs_tabs.empty()) { | |
623 // Master Preferences content overrides any other policy. | |
624 tabs.insert(tabs.end(), master_prefs_tabs.begin(), | |
grt (UTC plus 2)
2016/09/09 11:40:29
to avoid the extra churn here, what do you think o
| |
625 master_prefs_tabs.end()); | |
626 return tabs; | |
627 } | |
628 | |
629 StartupTabs onboarding_tabs = provider->GetOnboardingTabs(); | |
grt (UTC plus 2)
2016/09/09 11:40:29
how about all of these being Add...(&tabs);? lots
| |
630 if (!onboarding_tabs.empty()) | |
631 tabs.insert(tabs.end(), onboarding_tabs.begin(), onboarding_tabs.end()); | |
632 | |
633 StartupTabs reset_trigger_tabs = provider->GetResetTriggerTabs(profile_); | |
634 if (!reset_trigger_tabs.empty()) | |
635 tabs.insert(tabs.end(), reset_trigger_tabs.begin(), | |
636 reset_trigger_tabs.end()); | |
637 | |
638 StartupTabs prefs_tabs = provider->GetPreferencesTabs(); | |
639 if (!prefs_tabs.empty()) | |
640 tabs.insert(tabs.end(), prefs_tabs.begin(), prefs_tabs.end()); | |
641 | |
642 StartupTabs pinned_tabs = provider->GetPinnedTabs(); | |
grt (UTC plus 2)
2016/09/09 11:40:29
can this be Add, too, with it happening before Onb
| |
643 if (!pinned_tabs.empty()) | |
644 // Pinned tabs always appear as the leftmost tabs; insert at the beginning | |
645 // for consistency's sake. | |
646 tabs.insert(tabs.begin(), pinned_tabs.begin(), pinned_tabs.end()); | |
647 } | |
648 | |
649 // Default to showing New Tab Page when nothing else is cued up. | |
650 if (tabs.empty()) | |
651 tabs.push_back(StartupTab(GURL(chrome::kChromeUINewTabURL), 0)); | |
652 | |
653 return tabs; | |
654 } | |
655 | |
656 Browser* StartupBrowserCreatorImpl::RestoreOrCreateBrowser(StartupTabs tabs) { | |
657 // TODO(tmartino): Based on passed behavior flag, possibly restore session | |
658 // instead of creating a new Browser. | |
659 | |
660 return OpenTabsInBrowser(nullptr, true, tabs); | |
661 } | |
662 | |
571 bool StartupBrowserCreatorImpl::ProcessStartupURLs( | 663 bool StartupBrowserCreatorImpl::ProcessStartupURLs( |
572 const std::vector<GURL>& urls_to_open) { | 664 const std::vector<GURL>& urls_to_open) { |
573 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; | 665 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; |
574 SessionStartupPref pref = | 666 SessionStartupPref pref = |
575 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 667 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
576 if (pref.type == SessionStartupPref::LAST) | 668 if (pref.type == SessionStartupPref::LAST) |
577 VLOG(1) << "Pref: last"; | 669 VLOG(1) << "Pref: last"; |
578 else if (pref.type == SessionStartupPref::URLS) | 670 else if (pref.type == SessionStartupPref::URLS) |
579 VLOG(1) << "Pref: urls"; | 671 VLOG(1) << "Pref: urls"; |
580 else if (pref.type == SessionStartupPref::DEFAULT) | 672 else if (pref.type == SessionStartupPref::DEFAULT) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
643 !HasPendingUncleanExit(profile_)) { | 735 !HasPendingUncleanExit(profile_)) { |
644 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 736 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
645 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); | 737 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); |
646 } | 738 } |
647 | 739 |
648 return true; | 740 return true; |
649 } | 741 } |
650 | 742 |
651 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( | 743 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( |
652 const std::vector<GURL>& urls_to_open) { | 744 const std::vector<GURL>& urls_to_open) { |
745 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
746 // enabled. | |
747 | |
653 SessionStartupPref pref = | 748 SessionStartupPref pref = |
654 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 749 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
655 StartupTabs tabs; | 750 StartupTabs tabs; |
656 // Pinned tabs should not be displayed when chrome is launched in incognito | 751 // Pinned tabs should not be displayed when chrome is launched in incognito |
657 // mode. Also, no pages should be opened automatically if the session | 752 // mode. Also, no pages should be opened automatically if the session |
658 // crashed. Otherwise it might trigger another crash, locking the user out of | 753 // crashed. Otherwise it might trigger another crash, locking the user out of |
659 // chrome. The crash infobar is shown in this case. | 754 // chrome. The crash infobar is shown in this case. |
660 if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_, | 755 if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_, |
661 profile_->GetPrefs()) && | 756 profile_->GetPrefs()) && |
662 !HasPendingUncleanExit(profile_)) { | 757 !HasPendingUncleanExit(profile_)) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
822 browser_creator_->is_default_browser_dialog_suppressed())) { | 917 browser_creator_->is_default_browser_dialog_suppressed())) { |
823 chrome::ShowDefaultBrowserPrompt(profile_); | 918 chrome::ShowDefaultBrowserPrompt(profile_); |
824 } | 919 } |
825 } | 920 } |
826 #endif | 921 #endif |
827 } | 922 } |
828 } | 923 } |
829 | 924 |
830 void StartupBrowserCreatorImpl::AddStartupURLs( | 925 void StartupBrowserCreatorImpl::AddStartupURLs( |
831 std::vector<GURL>* startup_urls) const { | 926 std::vector<GURL>* startup_urls) const { |
832 // TODO(atwilson): Simplify the logic that decides which tabs to open on | 927 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is |
833 // start-up and make it more consistent. http://crbug.com/248883 | 928 // enabled. |
834 | 929 |
835 // If we have urls specified by the first run master preferences use them | 930 // If we have urls specified by the first run master preferences use them |
836 // and nothing else. | 931 // and nothing else. |
837 if (browser_creator_ && startup_urls->empty()) { | 932 if (browser_creator_ && startup_urls->empty()) { |
838 if (!browser_creator_->first_run_tabs_.empty()) { | 933 if (!browser_creator_->first_run_tabs_.empty()) { |
839 std::vector<GURL>::iterator it = | 934 std::vector<GURL>::iterator it = |
840 browser_creator_->first_run_tabs_.begin(); | 935 browser_creator_->first_run_tabs_.begin(); |
841 while (it != browser_creator_->first_run_tabs_.end()) { | 936 while (it != browser_creator_->first_run_tabs_.end()) { |
842 // Replace magic names for the actual urls. | 937 // Replace magic names for the actual urls. |
843 if (it->host() == "new_tab_page") { | 938 if (it->host() == "new_tab_page") { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
889 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) | 984 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) |
890 startup_urls->at(0) = sync_promo_url; | 985 startup_urls->at(0) = sync_promo_url; |
891 else | 986 else |
892 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 987 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
893 } | 988 } |
894 } | 989 } |
895 } | 990 } |
896 | 991 |
897 void StartupBrowserCreatorImpl::AddSpecialURLs( | 992 void StartupBrowserCreatorImpl::AddSpecialURLs( |
898 std::vector<GURL>* url_list) const { | 993 std::vector<GURL>* url_list) const { |
994 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
995 // enabled. | |
996 | |
899 // Optionally include the welcome page. | 997 // Optionally include the welcome page. |
900 if (welcome_run_type_ == WelcomeRunType::FIRST_TAB) | 998 if (welcome_run_type_ == WelcomeRunType::FIRST_TAB) |
901 url_list->insert(url_list->begin(), internals::GetWelcomePageURL()); | 999 url_list->insert(url_list->begin(), internals::GetWelcomePageURL()); |
902 | 1000 |
903 // If this Profile is marked for a reset prompt, ensure the reset | 1001 // If this Profile is marked for a reset prompt, ensure the reset |
904 // settings dialog appears. | 1002 // settings dialog appears. |
905 if (ProfileHasResetTrigger()) { | 1003 if (ProfileHasResetTrigger()) { |
906 url_list->insert(url_list->begin(), | 1004 url_list->insert(url_list->begin(), |
907 internals::GetTriggeredResetSettingsURL()); | 1005 internals::GetTriggeredResetSettingsURL()); |
908 } | 1006 } |
909 } | 1007 } |
910 | 1008 |
911 // For first-run, the type will be FIRST_RUN_LAST for all systems except for | 1009 // For first-run, the type will be FIRST_RUN_LAST for all systems except for |
912 // Windows 10+, where it will be FIRST_RUN_FIRST. For non-first run, the type | 1010 // Windows 10+, where it will be FIRST_RUN_FIRST. For non-first run, the type |
913 // will be NONE for all systems except for Windows 10+, where it will be | 1011 // will be NONE for all systems except for Windows 10+, where it will be |
914 // ANY_RUN_FIRST if this is the first somewhat normal launch since an OS | 1012 // ANY_RUN_FIRST if this is the first somewhat normal launch since an OS |
915 // upgrade. | 1013 // upgrade. |
1014 | |
1015 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
1016 // enabled. | |
916 void StartupBrowserCreatorImpl::InitializeWelcomeRunType( | 1017 void StartupBrowserCreatorImpl::InitializeWelcomeRunType( |
917 const std::vector<GURL>& urls_to_open) { | 1018 const std::vector<GURL>& urls_to_open) { |
918 DCHECK_EQ(static_cast<int>(WelcomeRunType::NONE), | 1019 DCHECK_EQ(static_cast<int>(WelcomeRunType::NONE), |
919 static_cast<int>(welcome_run_type_)); | 1020 static_cast<int>(welcome_run_type_)); |
920 #if defined(OS_WIN) | 1021 #if defined(OS_WIN) |
921 // Do not welcome if there are any URLs to open. | 1022 // Do not welcome if there are any URLs to open. |
922 if (!urls_to_open.empty()) | 1023 if (!urls_to_open.empty()) |
923 return; | 1024 return; |
924 | 1025 |
925 base::win::OSInfo* const os_info = base::win::OSInfo::GetInstance(); | 1026 base::win::OSInfo* const os_info = base::win::OSInfo::GetInstance(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 } | 1081 } |
981 | 1082 |
982 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs( | 1083 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs( |
983 const std::vector<GURL>& urls_to_open) { | 1084 const std::vector<GURL>& urls_to_open) { |
984 for (const GURL& url : urls_to_open) { | 1085 for (const GURL& url : urls_to_open) { |
985 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 1086 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
986 "Startup.BrowserLaunchURL", url); | 1087 "Startup.BrowserLaunchURL", url); |
987 } | 1088 } |
988 } | 1089 } |
989 | 1090 |
1091 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
1092 // enabled. | |
990 bool StartupBrowserCreatorImpl::ProfileHasResetTrigger() const { | 1093 bool StartupBrowserCreatorImpl::ProfileHasResetTrigger() const { |
991 bool has_reset_trigger = false; | 1094 bool has_reset_trigger = false; |
992 #if defined(OS_WIN) | 1095 #if defined(OS_WIN) |
993 TriggeredProfileResetter* triggered_profile_resetter = | 1096 TriggeredProfileResetter* triggered_profile_resetter = |
994 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1097 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
995 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1098 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
996 if (triggered_profile_resetter) { | 1099 if (triggered_profile_resetter) { |
997 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1100 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
998 } | 1101 } |
999 #endif // defined(OS_WIN) | 1102 #endif // defined(OS_WIN) |
1000 return has_reset_trigger; | 1103 return has_reset_trigger; |
1001 } | 1104 } |
OLD | NEW |