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 <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 // If command-line URLs were passed, they supercede all other policies and | |
|
grt (UTC plus 2)
2016/09/21 08:59:08
at least some(!) of the old codepaths put the sett
| |
| 579 // logic. | |
| 580 StartupTabs tabs; | |
| 581 if (!cmd_line_urls.empty()) { | |
| 582 UrlsToTabs(cmd_line_urls, &tabs); | |
| 583 } else { | |
| 584 bool is_incognito = IncognitoModePrefs::ShouldLaunchIncognito( | |
| 585 command_line_, profile_->GetPrefs()); | |
| 586 bool is_crash = HasPendingUncleanExit(profile_); | |
| 587 tabs = | |
| 588 DetermineStartupTabs(StartupTabProviderImpl(), is_incognito, is_crash); | |
| 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(process_startup, tabs | |
| 601 /* TODO(tmartino): Also pass behavior here */); | |
| 602 | |
| 603 // Finally, add info bars. | |
| 604 AddInfoBarsIfNecessary( | |
| 605 browser, process_startup ? chrome::startup::IS_PROCESS_STARTUP | |
| 606 : chrome::startup::IS_NOT_PROCESS_STARTUP); | |
| 607 } | |
| 608 | |
| 609 StartupTabs StartupBrowserCreatorImpl::DetermineStartupTabs( | |
| 610 const StartupTabProvider& provider, | |
| 611 bool is_incognito, | |
| 612 bool is_post_crash_launch) { | |
| 613 StartupTabs tabs; | |
| 614 | |
| 615 // No policy- or profile-related content is shown in incognito mode. | |
| 616 // Similarly, when recovering from a crash, nothing should be opened | |
| 617 // automatically to prevent getting the user stuck in a crash loop. | |
| 618 if (!is_incognito && !is_post_crash_launch) { | |
| 619 // A Master Preferences file provided with this distribution may specify | |
| 620 // tabs to be displayed on first run, overriding any other tabs which would | |
| 621 // normally be shown. | |
| 622 if (provider.AddDistributionFirstRunTabs(browser_creator_, &tabs)) { | |
|
grt (UTC plus 2)
2016/09/21 08:59:08
nit: omit braces :-)
| |
| 623 return tabs; | |
| 624 } | |
| 625 | |
| 626 // Reads and adds any tabs which the user has previously pinned. Pinned tabs | |
| 627 // always appear as the leftmost tabs; insert at the beginning for | |
| 628 // consistency's sake. | |
| 629 provider.AddPinnedTabs(&tabs); | |
| 630 | |
| 631 // Policies for onboarding (e.g., first run) may show promotional and | |
| 632 // introductory content depending on a number of system status factors, | |
| 633 // including OS and whether or not this is First Run. | |
| 634 provider.AddOnboardingTabs(&tabs); | |
| 635 | |
| 636 // A trigger on a profile may indicate that we should show a tab which | |
| 637 // offers to reset the user's settings. | |
| 638 provider.AddResetTriggerTabs(profile_, &tabs); | |
|
grt (UTC plus 2)
2016/09/21 08:59:08
i think the settings reset page is supposed to be
| |
| 639 | |
| 640 // If the user has set the preference indicating URLs to show on opening, | |
| 641 // read and add those. | |
| 642 provider.AddPreferencesTabs(&tabs); | |
| 643 } | |
| 644 | |
| 645 // Default to showing New Tab Page when nothing else is cued up. | |
| 646 if (tabs.empty()) | |
| 647 tabs.push_back(StartupTab(GURL(chrome::kChromeUINewTabURL), false)); | |
|
grt (UTC plus 2)
2016/09/21 08:59:08
the old code would add the NTP if no URLs were spe
| |
| 648 | |
| 649 return tabs; | |
| 650 } | |
| 651 | |
| 652 Browser* StartupBrowserCreatorImpl::RestoreOrCreateBrowser( | |
| 653 bool process_startup, | |
| 654 const StartupTabs& tabs) { | |
| 655 // TODO(tmartino): Based on passed behavior flag, possibly restore session | |
| 656 // instead of creating a new Browser. | |
| 657 | |
| 658 return OpenTabsInBrowser(nullptr, process_startup, tabs); | |
| 659 } | |
| 660 | |
| 571 bool StartupBrowserCreatorImpl::ProcessStartupURLs( | 661 bool StartupBrowserCreatorImpl::ProcessStartupURLs( |
| 572 const std::vector<GURL>& urls_to_open) { | 662 const std::vector<GURL>& urls_to_open) { |
| 573 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; | 663 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; |
| 574 SessionStartupPref pref = | 664 SessionStartupPref pref = |
| 575 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 665 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
| 576 if (pref.type == SessionStartupPref::LAST) | 666 if (pref.type == SessionStartupPref::LAST) |
| 577 VLOG(1) << "Pref: last"; | 667 VLOG(1) << "Pref: last"; |
| 578 else if (pref.type == SessionStartupPref::URLS) | 668 else if (pref.type == SessionStartupPref::URLS) |
| 579 VLOG(1) << "Pref: urls"; | 669 VLOG(1) << "Pref: urls"; |
| 580 else if (pref.type == SessionStartupPref::DEFAULT) | 670 else if (pref.type == SessionStartupPref::DEFAULT) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 !HasPendingUncleanExit(profile_)) { | 733 !HasPendingUncleanExit(profile_)) { |
| 644 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 734 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
| 645 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); | 735 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); |
| 646 } | 736 } |
| 647 | 737 |
| 648 return true; | 738 return true; |
| 649 } | 739 } |
| 650 | 740 |
| 651 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( | 741 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( |
| 652 const std::vector<GURL>& urls_to_open) { | 742 const std::vector<GURL>& urls_to_open) { |
| 743 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
| 744 // enabled. | |
| 745 | |
| 653 SessionStartupPref pref = | 746 SessionStartupPref pref = |
| 654 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 747 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
| 655 StartupTabs tabs; | 748 StartupTabs tabs; |
| 656 // Pinned tabs should not be displayed when chrome is launched in incognito | 749 // Pinned tabs should not be displayed when chrome is launched in incognito |
| 657 // mode. Also, no pages should be opened automatically if the session | 750 // mode. Also, no pages should be opened automatically if the session |
| 658 // crashed. Otherwise it might trigger another crash, locking the user out of | 751 // crashed. Otherwise it might trigger another crash, locking the user out of |
| 659 // chrome. The crash infobar is shown in this case. | 752 // chrome. The crash infobar is shown in this case. |
| 660 if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_, | 753 if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_, |
| 661 profile_->GetPrefs()) && | 754 profile_->GetPrefs()) && |
| 662 !HasPendingUncleanExit(profile_)) { | 755 !HasPendingUncleanExit(profile_)) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 browser_creator_->is_default_browser_dialog_suppressed())) { | 915 browser_creator_->is_default_browser_dialog_suppressed())) { |
| 823 chrome::ShowDefaultBrowserPrompt(profile_); | 916 chrome::ShowDefaultBrowserPrompt(profile_); |
| 824 } | 917 } |
| 825 } | 918 } |
| 826 #endif | 919 #endif |
| 827 } | 920 } |
| 828 } | 921 } |
| 829 | 922 |
| 830 void StartupBrowserCreatorImpl::AddStartupURLs( | 923 void StartupBrowserCreatorImpl::AddStartupURLs( |
| 831 std::vector<GURL>* startup_urls) const { | 924 std::vector<GURL>* startup_urls) const { |
| 832 // TODO(atwilson): Simplify the logic that decides which tabs to open on | 925 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is |
| 833 // start-up and make it more consistent. http://crbug.com/248883 | 926 // enabled. |
| 834 | 927 |
| 835 // If we have urls specified by the first run master preferences use them | 928 // If we have urls specified by the first run master preferences use them |
| 836 // and nothing else. | 929 // and nothing else. |
| 837 if (browser_creator_ && startup_urls->empty()) { | 930 if (browser_creator_ && startup_urls->empty()) { |
| 838 if (!browser_creator_->first_run_tabs_.empty()) { | 931 if (!browser_creator_->first_run_tabs_.empty()) { |
| 839 std::vector<GURL>::iterator it = | 932 std::vector<GURL>::iterator it = |
| 840 browser_creator_->first_run_tabs_.begin(); | 933 browser_creator_->first_run_tabs_.begin(); |
| 841 while (it != browser_creator_->first_run_tabs_.end()) { | 934 while (it != browser_creator_->first_run_tabs_.end()) { |
| 842 // Replace magic names for the actual urls. | 935 // Replace magic names for the actual urls. |
| 843 if (it->host() == "new_tab_page") { | 936 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)) | 982 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) |
| 890 startup_urls->at(0) = sync_promo_url; | 983 startup_urls->at(0) = sync_promo_url; |
| 891 else | 984 else |
| 892 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 985 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
| 893 } | 986 } |
| 894 } | 987 } |
| 895 } | 988 } |
| 896 | 989 |
| 897 void StartupBrowserCreatorImpl::AddSpecialURLs( | 990 void StartupBrowserCreatorImpl::AddSpecialURLs( |
| 898 std::vector<GURL>* url_list) const { | 991 std::vector<GURL>* url_list) const { |
| 992 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
| 993 // enabled. | |
| 994 | |
| 899 // Optionally include the welcome page. | 995 // Optionally include the welcome page. |
| 900 if (welcome_run_type_ == WelcomeRunType::FIRST_TAB) | 996 if (welcome_run_type_ == WelcomeRunType::FIRST_TAB) |
| 901 url_list->insert(url_list->begin(), internals::GetWelcomePageURL()); | 997 url_list->insert(url_list->begin(), internals::GetWelcomePageURL()); |
| 902 | 998 |
| 903 // If this Profile is marked for a reset prompt, ensure the reset | 999 // If this Profile is marked for a reset prompt, ensure the reset |
| 904 // settings dialog appears. | 1000 // settings dialog appears. |
| 905 if (ProfileHasResetTrigger()) { | 1001 if (ProfileHasResetTrigger()) { |
| 906 url_list->insert(url_list->begin(), | 1002 url_list->insert(url_list->begin(), |
| 907 internals::GetTriggeredResetSettingsURL()); | 1003 internals::GetTriggeredResetSettingsURL()); |
| 908 } | 1004 } |
| 909 } | 1005 } |
| 910 | 1006 |
| 911 // For first-run, the type will be FIRST_RUN_LAST for all systems except for | 1007 // 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 | 1008 // 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 | 1009 // 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 | 1010 // ANY_RUN_FIRST if this is the first somewhat normal launch since an OS |
| 915 // upgrade. | 1011 // upgrade. |
| 1012 | |
| 1013 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
| 1014 // enabled. | |
| 916 void StartupBrowserCreatorImpl::InitializeWelcomeRunType( | 1015 void StartupBrowserCreatorImpl::InitializeWelcomeRunType( |
| 917 const std::vector<GURL>& urls_to_open) { | 1016 const std::vector<GURL>& urls_to_open) { |
| 918 DCHECK_EQ(static_cast<int>(WelcomeRunType::NONE), | 1017 DCHECK_EQ(static_cast<int>(WelcomeRunType::NONE), |
| 919 static_cast<int>(welcome_run_type_)); | 1018 static_cast<int>(welcome_run_type_)); |
| 920 #if defined(OS_WIN) | 1019 #if defined(OS_WIN) |
| 921 // Do not welcome if there are any URLs to open. | 1020 // Do not welcome if there are any URLs to open. |
| 922 if (!urls_to_open.empty()) | 1021 if (!urls_to_open.empty()) |
| 923 return; | 1022 return; |
| 924 | 1023 |
| 925 base::win::OSInfo* const os_info = base::win::OSInfo::GetInstance(); | 1024 base::win::OSInfo* const os_info = base::win::OSInfo::GetInstance(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 980 } | 1079 } |
| 981 | 1080 |
| 982 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs( | 1081 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs( |
| 983 const std::vector<GURL>& urls_to_open) { | 1082 const std::vector<GURL>& urls_to_open) { |
| 984 for (const GURL& url : urls_to_open) { | 1083 for (const GURL& url : urls_to_open) { |
| 985 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 1084 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
| 986 "Startup.BrowserLaunchURL", url); | 1085 "Startup.BrowserLaunchURL", url); |
| 987 } | 1086 } |
| 988 } | 1087 } |
| 989 | 1088 |
| 1089 // TODO(tmartino): Deprecated, remove this once UseConsolidatedStartupFlow is | |
| 1090 // enabled. | |
| 990 bool StartupBrowserCreatorImpl::ProfileHasResetTrigger() const { | 1091 bool StartupBrowserCreatorImpl::ProfileHasResetTrigger() const { |
| 991 bool has_reset_trigger = false; | 1092 bool has_reset_trigger = false; |
| 992 #if defined(OS_WIN) | 1093 #if defined(OS_WIN) |
| 993 TriggeredProfileResetter* triggered_profile_resetter = | 1094 TriggeredProfileResetter* triggered_profile_resetter = |
| 994 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1095 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
| 995 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1096 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
| 996 if (triggered_profile_resetter) { | 1097 if (triggered_profile_resetter) { |
| 997 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1098 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
| 998 } | 1099 } |
| 999 #endif // defined(OS_WIN) | 1100 #endif // defined(OS_WIN) |
| 1000 return has_reset_trigger; | 1101 return has_reset_trigger; |
| 1001 } | 1102 } |
| OLD | NEW |