| 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 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_); |
| 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 |
| 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)}); |
| 616 else |
| 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 } else { |
| 639 // Policies for onboarding (e.g., first run) may show promotional and |
| 640 // introductory content depending on a number of system status factors, |
| 641 // including OS and whether or not this is First Run. |
| 642 bool onboarding_added = provider.AddOnboardingTabs(&tabs); |
| 643 |
| 644 // If the user has set the preference indicating URLs to show on opening, |
| 645 // read and add those. |
| 646 bool prefs_added = provider.AddPreferencesTabs(&tabs); |
| 647 |
| 648 // Potentially add the New Tab Page. Onboarding content is designed to |
| 649 // replace (and eventually funnel the user to) the NTP. Likewise, URLs read |
| 650 // from preferences are explicitly meant to override showing the NTP. |
| 651 if (!onboarding_added && !prefs_added) |
| 652 tabs.push_back(StartupTab(GURL(chrome::kChromeUINewTabURL), false)); |
| 653 |
| 654 // Reads and adds any tabs which the user has previously pinned. |
| 655 provider.AddPinnedTabs(&tabs); |
| 656 } |
| 657 |
| 658 return tabs; |
| 659 } |
| 660 |
| 661 Browser* StartupBrowserCreatorImpl::RestoreOrCreateBrowser( |
| 662 bool process_startup, |
| 663 const StartupTabs& tabs) { |
| 664 // TODO(tmartino): Based on passed behavior flag, possibly restore session |
| 665 // instead of creating a new Browser. |
| 666 |
| 667 return OpenTabsInBrowser(nullptr, process_startup, tabs); |
| 668 } |
| 669 |
| 571 bool StartupBrowserCreatorImpl::ProcessStartupURLs( | 670 bool StartupBrowserCreatorImpl::ProcessStartupURLs( |
| 572 const std::vector<GURL>& urls_to_open) { | 671 const std::vector<GURL>& urls_to_open) { |
| 573 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; | 672 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; |
| 574 SessionStartupPref pref = | 673 SessionStartupPref pref = |
| 575 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 674 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
| 576 if (pref.type == SessionStartupPref::LAST) | 675 if (pref.type == SessionStartupPref::LAST) |
| 577 VLOG(1) << "Pref: last"; | 676 VLOG(1) << "Pref: last"; |
| 578 else if (pref.type == SessionStartupPref::URLS) | 677 else if (pref.type == SessionStartupPref::URLS) |
| 579 VLOG(1) << "Pref: urls"; | 678 VLOG(1) << "Pref: urls"; |
| 580 else if (pref.type == SessionStartupPref::DEFAULT) | 679 else if (pref.type == SessionStartupPref::DEFAULT) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 !HasPendingUncleanExit(profile_)) { | 742 !HasPendingUncleanExit(profile_)) { |
| 644 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 743 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
| 645 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); | 744 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); |
| 646 } | 745 } |
| 647 | 746 |
| 648 return true; | 747 return true; |
| 649 } | 748 } |
| 650 | 749 |
| 651 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( | 750 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( |
| 652 const std::vector<GURL>& urls_to_open) { | 751 const std::vector<GURL>& urls_to_open) { |
| 752 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is |
| 753 // enabled. |
| 754 |
| 653 SessionStartupPref pref = | 755 SessionStartupPref pref = |
| 654 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 756 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
| 655 StartupTabs tabs; | 757 StartupTabs tabs; |
| 656 // Pinned tabs should not be displayed when chrome is launched in incognito | 758 // Pinned tabs should not be displayed when chrome is launched in incognito |
| 657 // mode. Also, no pages should be opened automatically if the session | 759 // mode. Also, no pages should be opened automatically if the session |
| 658 // crashed. Otherwise it might trigger another crash, locking the user out of | 760 // crashed. Otherwise it might trigger another crash, locking the user out of |
| 659 // chrome. The crash infobar is shown in this case. | 761 // chrome. The crash infobar is shown in this case. |
| 660 if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_, | 762 if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_, |
| 661 profile_->GetPrefs()) && | 763 profile_->GetPrefs()) && |
| 662 !HasPendingUncleanExit(profile_)) { | 764 !HasPendingUncleanExit(profile_)) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 browser_creator_->is_default_browser_dialog_suppressed())) { | 924 browser_creator_->is_default_browser_dialog_suppressed())) { |
| 823 chrome::ShowDefaultBrowserPrompt(profile_); | 925 chrome::ShowDefaultBrowserPrompt(profile_); |
| 824 } | 926 } |
| 825 } | 927 } |
| 826 #endif | 928 #endif |
| 827 } | 929 } |
| 828 } | 930 } |
| 829 | 931 |
| 830 void StartupBrowserCreatorImpl::AddStartupURLs( | 932 void StartupBrowserCreatorImpl::AddStartupURLs( |
| 831 std::vector<GURL>* startup_urls) const { | 933 std::vector<GURL>* startup_urls) const { |
| 832 // TODO(atwilson): Simplify the logic that decides which tabs to open on | 934 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is |
| 833 // start-up and make it more consistent. http://crbug.com/248883 | 935 // enabled. |
| 834 | 936 |
| 835 // If we have urls specified by the first run master preferences use them | 937 // If we have urls specified by the first run master preferences use them |
| 836 // and nothing else. | 938 // and nothing else. |
| 837 if (browser_creator_ && startup_urls->empty()) { | 939 if (browser_creator_ && startup_urls->empty()) { |
| 838 if (!browser_creator_->first_run_tabs_.empty()) { | 940 if (!browser_creator_->first_run_tabs_.empty()) { |
| 839 std::vector<GURL>::iterator it = | 941 std::vector<GURL>::iterator it = |
| 840 browser_creator_->first_run_tabs_.begin(); | 942 browser_creator_->first_run_tabs_.begin(); |
| 841 while (it != browser_creator_->first_run_tabs_.end()) { | 943 while (it != browser_creator_->first_run_tabs_.end()) { |
| 842 // Replace magic names for the actual urls. | 944 // Replace magic names for the actual urls. |
| 843 if (it->host() == "new_tab_page") { | 945 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)) | 991 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) |
| 890 startup_urls->at(0) = sync_promo_url; | 992 startup_urls->at(0) = sync_promo_url; |
| 891 else | 993 else |
| 892 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 994 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
| 893 } | 995 } |
| 894 } | 996 } |
| 895 } | 997 } |
| 896 | 998 |
| 897 void StartupBrowserCreatorImpl::AddSpecialURLs( | 999 void StartupBrowserCreatorImpl::AddSpecialURLs( |
| 898 std::vector<GURL>* url_list) const { | 1000 std::vector<GURL>* url_list) const { |
| 1001 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is |
| 1002 // enabled. |
| 1003 |
| 899 // Optionally include the welcome page. | 1004 // Optionally include the welcome page. |
| 900 if (welcome_run_type_ == WelcomeRunType::FIRST_TAB) | 1005 if (welcome_run_type_ == WelcomeRunType::FIRST_TAB) |
| 901 url_list->insert(url_list->begin(), internals::GetWelcomePageURL()); | 1006 url_list->insert(url_list->begin(), internals::GetWelcomePageURL()); |
| 902 | 1007 |
| 903 // If this Profile is marked for a reset prompt, ensure the reset | 1008 // If this Profile is marked for a reset prompt, ensure the reset |
| 904 // settings dialog appears. | 1009 // settings dialog appears. |
| 905 if (ProfileHasResetTrigger()) { | 1010 if (ProfileHasResetTrigger()) { |
| 906 url_list->insert(url_list->begin(), | 1011 url_list->insert(url_list->begin(), |
| 907 internals::GetTriggeredResetSettingsURL()); | 1012 internals::GetTriggeredResetSettingsURL()); |
| 908 } | 1013 } |
| 909 } | 1014 } |
| 910 | 1015 |
| 911 // For first-run, the type will be FIRST_RUN_LAST for all systems except for | 1016 // 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 | 1017 // 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 | 1018 // 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 | 1019 // ANY_RUN_FIRST if this is the first somewhat normal launch since an OS |
| 915 // upgrade. | 1020 // upgrade. |
| 1021 |
| 1022 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is |
| 1023 // enabled. |
| 916 void StartupBrowserCreatorImpl::InitializeWelcomeRunType( | 1024 void StartupBrowserCreatorImpl::InitializeWelcomeRunType( |
| 917 const std::vector<GURL>& urls_to_open) { | 1025 const std::vector<GURL>& urls_to_open) { |
| 918 DCHECK_EQ(static_cast<int>(WelcomeRunType::NONE), | 1026 DCHECK_EQ(static_cast<int>(WelcomeRunType::NONE), |
| 919 static_cast<int>(welcome_run_type_)); | 1027 static_cast<int>(welcome_run_type_)); |
| 920 #if defined(OS_WIN) | 1028 #if defined(OS_WIN) |
| 921 // Do not welcome if there are any URLs to open. | 1029 // Do not welcome if there are any URLs to open. |
| 922 if (!urls_to_open.empty()) | 1030 if (!urls_to_open.empty()) |
| 923 return; | 1031 return; |
| 924 | 1032 |
| 925 base::win::OSInfo* const os_info = base::win::OSInfo::GetInstance(); | 1033 base::win::OSInfo* const os_info = base::win::OSInfo::GetInstance(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 } | 1088 } |
| 981 | 1089 |
| 982 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs( | 1090 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs( |
| 983 const std::vector<GURL>& urls_to_open) { | 1091 const std::vector<GURL>& urls_to_open) { |
| 984 for (const GURL& url : urls_to_open) { | 1092 for (const GURL& url : urls_to_open) { |
| 985 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 1093 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
| 986 "Startup.BrowserLaunchURL", url); | 1094 "Startup.BrowserLaunchURL", url); |
| 987 } | 1095 } |
| 988 } | 1096 } |
| 989 | 1097 |
| 1098 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is |
| 1099 // enabled. |
| 990 bool StartupBrowserCreatorImpl::ProfileHasResetTrigger() const { | 1100 bool StartupBrowserCreatorImpl::ProfileHasResetTrigger() const { |
| 991 bool has_reset_trigger = false; | 1101 bool has_reset_trigger = false; |
| 992 #if defined(OS_WIN) | 1102 #if defined(OS_WIN) |
| 993 TriggeredProfileResetter* triggered_profile_resetter = | 1103 TriggeredProfileResetter* triggered_profile_resetter = |
| 994 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1104 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
| 995 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1105 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
| 996 if (triggered_profile_resetter) { | 1106 if (triggered_profile_resetter) { |
| 997 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1107 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
| 998 } | 1108 } |
| 999 #endif // defined(OS_WIN) | 1109 #endif // defined(OS_WIN) |
| 1000 return has_reset_trigger; | 1110 return has_reset_trigger; |
| 1001 } | 1111 } |
| OLD | NEW |