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)) { | |
Peter Kasting
2016/09/29 07:23:34
Nit: I think it would be slightly clearer to move
| |
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 StartupTabs cmd_line_tabs; | |
579 UrlsToTabs(cmd_line_urls, &cmd_line_tabs); | |
580 | |
581 bool is_incognito = IncognitoModePrefs::ShouldLaunchIncognito( | |
582 command_line_, profile_->GetPrefs()); | |
583 bool is_crash = HasPendingUncleanExit(profile_); | |
Peter Kasting
2016/09/29 07:23:34
Nit: |is_post_crash_launch| would be more descript
| |
584 StartupTabs tabs = DetermineStartupTabs( | |
585 StartupTabProviderImpl(), cmd_line_tabs, is_incognito, is_crash); | |
586 | |
587 // TODO(tmartino): If this is not process startup, attempt to restore | |
588 // asynchronously and return here. This logic is self-contained in | |
589 // SessionService and therefore can't be combined with the other Browser | |
590 // creation logic. | |
591 | |
592 // TODO(tmartino): Function which determines what behavior of session | |
Peter Kasting
2016/09/29 07:23:34
Nit: Function which determines -> Determine? (Not
tmartino
2016/09/30 20:55:01
The reason was simply to give a better idea of the
| |
593 // restore, if any, is necessary. Incorporates code from ProcessStartupUrls. | |
594 | |
595 Browser* browser = | |
596 RestoreOrCreateBrowser(process_startup, tabs | |
597 /* TODO(tmartino): Also pass behavior here */); | |
598 | |
599 // Finally, add info bars. | |
600 AddInfoBarsIfNecessary( | |
601 browser, process_startup ? chrome::startup::IS_PROCESS_STARTUP | |
602 : chrome::startup::IS_NOT_PROCESS_STARTUP); | |
603 } | |
604 | |
605 StartupTabs StartupBrowserCreatorImpl::DetermineStartupTabs( | |
606 const StartupTabProvider& provider, | |
607 const StartupTabs& cmd_line_tabs, | |
608 bool is_incognito, | |
609 bool is_post_crash_launch) { | |
610 // Only the New Tab Page or command line URLs may be shown in incognito mode. | |
611 // A similar policy exists for crash recovery launches, to prevent getting the | |
612 // user stuck in a crash loop. | |
613 if (is_incognito || is_post_crash_launch) { | |
614 if (cmd_line_tabs.empty()) | |
615 return StartupTabs({StartupTab(GURL(chrome::kChromeUINewTabURL), false)}); | |
Peter Kasting
2016/09/29 07:23:33
Nit: Is there any way to avoid having both ( and {
tmartino
2016/09/30 20:55:01
I've tried this a few ways (this way was actually
Peter Kasting
2016/09/30 21:50:03
Right, I'm mostly looking for different syntax for
tmartino
2016/10/03 23:26:06
OK, I went with moving the |tabs| declaration up.
| |
616 else | |
Peter Kasting
2016/09/29 07:23:34
Nit: No else after return
| |
617 return cmd_line_tabs; | |
618 } | |
619 | |
620 StartupTabs tabs; | |
621 | |
622 // A Master Preferences file provided with this distribution may specify | |
623 // tabs to be displayed on first run, overriding any other tabs which would | |
624 // normally be shown. Only command line tabs take priority. | |
625 if (cmd_line_tabs.empty() && | |
626 provider.AddDistributionFirstRunTabs(browser_creator_, &tabs)) | |
627 return tabs; | |
628 | |
629 // A trigger on a profile may indicate that we should show a tab which | |
630 // offers to reset the user's settings. Unlike other policy-based tabs, | |
631 // this may be shown alongside command line tabs, and always appears first. | |
632 provider.AddResetTriggerTabs(profile_, &tabs); | |
633 | |
634 // URLs passed at the command line supersede onboarding content as well as | |
635 // user-specified defaults. | |
636 if (!cmd_line_tabs.empty()) { | |
637 tabs.insert(tabs.end(), cmd_line_tabs.begin(), cmd_line_tabs.end()); | |
638 return tabs; | |
639 } | |
640 | |
641 // Policies for onboarding (e.g., first run) may show promotional and | |
642 // introductory content depending on a number of system status factors, | |
643 // including OS and whether or not this is First Run. | |
644 bool onboarding_added = provider.AddOnboardingTabs(&tabs); | |
645 | |
646 // If the user has set the preference indicating URLs to show on opening, | |
647 // read and add those. | |
648 bool prefs_added = provider.AddPreferencesTabs(&tabs); | |
649 | |
650 // Potentially add the New Tab Page. Onboarding content is designed to | |
651 // replace (and eventually funnel the user to) the NTP. Likewise, URLs read | |
652 // from preferences are explicitly meant to override showing the NTP. | |
653 if (!onboarding_added && !prefs_added) | |
654 tabs.push_back(StartupTab(GURL(chrome::kChromeUINewTabURL), false)); | |
Peter Kasting
2016/09/29 07:23:34
Nit: Up to you, but I tend to prefer emplace_back(
tmartino
2016/09/30 20:55:01
Changed to emplace_back here and throughout startu
| |
655 | |
656 // Reads and adds any tabs which the user has previously pinned. | |
Peter Kasting
2016/09/29 07:23:34
Nit: Reads and adds -> Add? (For parallel structur
| |
657 provider.AddPinnedTabs(&tabs); | |
658 | |
659 return tabs; | |
660 } | |
661 | |
662 Browser* StartupBrowserCreatorImpl::RestoreOrCreateBrowser( | |
663 bool process_startup, | |
664 const StartupTabs& tabs) { | |
665 // TODO(tmartino): Based on passed behavior flag, possibly restore session | |
666 // instead of creating a new Browser. | |
667 | |
668 return OpenTabsInBrowser(nullptr, process_startup, tabs); | |
669 } | |
670 | |
571 bool StartupBrowserCreatorImpl::ProcessStartupURLs( | 671 bool StartupBrowserCreatorImpl::ProcessStartupURLs( |
572 const std::vector<GURL>& urls_to_open) { | 672 const std::vector<GURL>& urls_to_open) { |
573 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; | 673 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; |
574 SessionStartupPref pref = | 674 SessionStartupPref pref = |
575 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 675 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
576 if (pref.type == SessionStartupPref::LAST) | 676 if (pref.type == SessionStartupPref::LAST) |
577 VLOG(1) << "Pref: last"; | 677 VLOG(1) << "Pref: last"; |
578 else if (pref.type == SessionStartupPref::URLS) | 678 else if (pref.type == SessionStartupPref::URLS) |
579 VLOG(1) << "Pref: urls"; | 679 VLOG(1) << "Pref: urls"; |
580 else if (pref.type == SessionStartupPref::DEFAULT) | 680 else if (pref.type == SessionStartupPref::DEFAULT) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
643 !HasPendingUncleanExit(profile_)) { | 743 !HasPendingUncleanExit(profile_)) { |
644 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 744 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
645 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); | 745 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); |
646 } | 746 } |
647 | 747 |
648 return true; | 748 return true; |
649 } | 749 } |
650 | 750 |
651 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( | 751 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( |
652 const std::vector<GURL>& urls_to_open) { | 752 const std::vector<GURL>& urls_to_open) { |
753 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
754 // enabled. | |
Peter Kasting
2016/09/29 07:23:33
Nit: Some of these comments you put inside the fun
| |
755 | |
653 SessionStartupPref pref = | 756 SessionStartupPref pref = |
654 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 757 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
655 StartupTabs tabs; | 758 StartupTabs tabs; |
656 // Pinned tabs should not be displayed when chrome is launched in incognito | 759 // Pinned tabs should not be displayed when chrome is launched in incognito |
657 // mode. Also, no pages should be opened automatically if the session | 760 // mode. Also, no pages should be opened automatically if the session |
658 // crashed. Otherwise it might trigger another crash, locking the user out of | 761 // crashed. Otherwise it might trigger another crash, locking the user out of |
659 // chrome. The crash infobar is shown in this case. | 762 // chrome. The crash infobar is shown in this case. |
660 if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_, | 763 if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_, |
661 profile_->GetPrefs()) && | 764 profile_->GetPrefs()) && |
662 !HasPendingUncleanExit(profile_)) { | 765 !HasPendingUncleanExit(profile_)) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
822 browser_creator_->is_default_browser_dialog_suppressed())) { | 925 browser_creator_->is_default_browser_dialog_suppressed())) { |
823 chrome::ShowDefaultBrowserPrompt(profile_); | 926 chrome::ShowDefaultBrowserPrompt(profile_); |
824 } | 927 } |
825 } | 928 } |
826 #endif | 929 #endif |
827 } | 930 } |
828 } | 931 } |
829 | 932 |
830 void StartupBrowserCreatorImpl::AddStartupURLs( | 933 void StartupBrowserCreatorImpl::AddStartupURLs( |
831 std::vector<GURL>* startup_urls) const { | 934 std::vector<GURL>* startup_urls) const { |
832 // TODO(atwilson): Simplify the logic that decides which tabs to open on | 935 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is |
833 // start-up and make it more consistent. http://crbug.com/248883 | 936 // enabled. |
834 | 937 |
835 // If we have urls specified by the first run master preferences use them | 938 // If we have urls specified by the first run master preferences use them |
836 // and nothing else. | 939 // and nothing else. |
837 if (browser_creator_ && startup_urls->empty()) { | 940 if (browser_creator_ && startup_urls->empty()) { |
838 if (!browser_creator_->first_run_tabs_.empty()) { | 941 if (!browser_creator_->first_run_tabs_.empty()) { |
839 std::vector<GURL>::iterator it = | 942 std::vector<GURL>::iterator it = |
840 browser_creator_->first_run_tabs_.begin(); | 943 browser_creator_->first_run_tabs_.begin(); |
841 while (it != browser_creator_->first_run_tabs_.end()) { | 944 while (it != browser_creator_->first_run_tabs_.end()) { |
842 // Replace magic names for the actual urls. | 945 // Replace magic names for the actual urls. |
843 if (it->host() == "new_tab_page") { | 946 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)) | 992 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) |
890 startup_urls->at(0) = sync_promo_url; | 993 startup_urls->at(0) = sync_promo_url; |
891 else | 994 else |
892 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 995 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
893 } | 996 } |
894 } | 997 } |
895 } | 998 } |
896 | 999 |
897 void StartupBrowserCreatorImpl::AddSpecialURLs( | 1000 void StartupBrowserCreatorImpl::AddSpecialURLs( |
898 std::vector<GURL>* url_list) const { | 1001 std::vector<GURL>* url_list) const { |
1002 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
1003 // enabled. | |
1004 | |
899 // Optionally include the welcome page. | 1005 // Optionally include the welcome page. |
900 if (welcome_run_type_ == WelcomeRunType::FIRST_TAB) | 1006 if (welcome_run_type_ == WelcomeRunType::FIRST_TAB) |
901 url_list->insert(url_list->begin(), internals::GetWelcomePageURL()); | 1007 url_list->insert(url_list->begin(), internals::GetWelcomePageURL()); |
902 | 1008 |
903 // If this Profile is marked for a reset prompt, ensure the reset | 1009 // If this Profile is marked for a reset prompt, ensure the reset |
904 // settings dialog appears. | 1010 // settings dialog appears. |
905 if (ProfileHasResetTrigger()) { | 1011 if (ProfileHasResetTrigger()) { |
906 url_list->insert(url_list->begin(), | 1012 url_list->insert(url_list->begin(), |
907 internals::GetTriggeredResetSettingsURL()); | 1013 internals::GetTriggeredResetSettingsURL()); |
908 } | 1014 } |
909 } | 1015 } |
910 | 1016 |
911 // For first-run, the type will be FIRST_RUN_LAST for all systems except for | 1017 // 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 | 1018 // 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 | 1019 // 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 | 1020 // ANY_RUN_FIRST if this is the first somewhat normal launch since an OS |
915 // upgrade. | 1021 // upgrade. |
1022 | |
1023 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
1024 // enabled. | |
916 void StartupBrowserCreatorImpl::InitializeWelcomeRunType( | 1025 void StartupBrowserCreatorImpl::InitializeWelcomeRunType( |
917 const std::vector<GURL>& urls_to_open) { | 1026 const std::vector<GURL>& urls_to_open) { |
918 DCHECK_EQ(static_cast<int>(WelcomeRunType::NONE), | 1027 DCHECK_EQ(static_cast<int>(WelcomeRunType::NONE), |
919 static_cast<int>(welcome_run_type_)); | 1028 static_cast<int>(welcome_run_type_)); |
920 #if defined(OS_WIN) | 1029 #if defined(OS_WIN) |
921 // Do not welcome if there are any URLs to open. | 1030 // Do not welcome if there are any URLs to open. |
922 if (!urls_to_open.empty()) | 1031 if (!urls_to_open.empty()) |
923 return; | 1032 return; |
924 | 1033 |
925 base::win::OSInfo* const os_info = base::win::OSInfo::GetInstance(); | 1034 base::win::OSInfo* const os_info = base::win::OSInfo::GetInstance(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 } | 1089 } |
981 | 1090 |
982 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs( | 1091 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs( |
983 const std::vector<GURL>& urls_to_open) { | 1092 const std::vector<GURL>& urls_to_open) { |
984 for (const GURL& url : urls_to_open) { | 1093 for (const GURL& url : urls_to_open) { |
985 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 1094 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
986 "Startup.BrowserLaunchURL", url); | 1095 "Startup.BrowserLaunchURL", url); |
987 } | 1096 } |
988 } | 1097 } |
989 | 1098 |
1099 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
1100 // enabled. | |
990 bool StartupBrowserCreatorImpl::ProfileHasResetTrigger() const { | 1101 bool StartupBrowserCreatorImpl::ProfileHasResetTrigger() const { |
991 bool has_reset_trigger = false; | 1102 bool has_reset_trigger = false; |
992 #if defined(OS_WIN) | 1103 #if defined(OS_WIN) |
993 TriggeredProfileResetter* triggered_profile_resetter = | 1104 TriggeredProfileResetter* triggered_profile_resetter = |
994 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1105 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
995 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1106 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
996 if (triggered_profile_resetter) { | 1107 if (triggered_profile_resetter) { |
997 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1108 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
998 } | 1109 } |
999 #endif // defined(OS_WIN) | 1110 #endif // defined(OS_WIN) |
1000 return has_reset_trigger; | 1111 return has_reset_trigger; |
1001 } | 1112 } |
OLD | NEW |