| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ | 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // returns them. Also clears the value of first_run_urls_ in the provided | 29 // returns them. Also clears the value of first_run_urls_ in the provided |
| 30 // BrowserCreator. | 30 // BrowserCreator. |
| 31 virtual StartupTabs GetDistributionFirstRunTabs( | 31 virtual StartupTabs GetDistributionFirstRunTabs( |
| 32 StartupBrowserCreator* browser_creator) const = 0; | 32 StartupBrowserCreator* browser_creator) const = 0; |
| 33 | 33 |
| 34 // Checks for the presence of a trigger indicating the need to offer a Profile | 34 // Checks for the presence of a trigger indicating the need to offer a Profile |
| 35 // Reset on this profile. Returns any tabs which should be shown accordingly. | 35 // Reset on this profile. Returns any tabs which should be shown accordingly. |
| 36 virtual StartupTabs GetResetTriggerTabs(Profile* profile) const = 0; | 36 virtual StartupTabs GetResetTriggerTabs(Profile* profile) const = 0; |
| 37 | 37 |
| 38 // Returns the user's pinned tabs. | 38 // Returns the user's pinned tabs. |
| 39 virtual StartupTabs GetPinnedTabs() const = 0; | 39 virtual StartupTabs GetPinnedTabs(Profile* profile) const = 0; |
| 40 | 40 |
| 41 // Returns tabs, if any, specified in the user's preferences as the default | 41 // Returns tabs, if any, specified in the user's preferences as the default |
| 42 // content for a new window. | 42 // content for a new window. |
| 43 virtual StartupTabs GetPreferencesTabs() const = 0; | 43 virtual StartupTabs GetPreferencesTabs(const base::CommandLine& command_line, |
| 44 Profile* profile) const = 0; |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 class StartupTabProviderImpl : public StartupTabProvider { | 47 class StartupTabProviderImpl : public StartupTabProvider { |
| 47 public: | 48 public: |
| 48 StartupTabProviderImpl() = default; | 49 StartupTabProviderImpl() = default; |
| 49 | 50 |
| 50 // The static Check*TabPolicy methods below enforce the policies relevant to | 51 // The static Check*TabPolicy methods below enforce the policies relevant to |
| 51 // the respective Get*Tabs methods, but do not gather or interact with any | 52 // the respective Get*Tabs methods, but do not gather or interact with any |
| 52 // system state relating to making those policy decisions. | 53 // system state relating to making those policy decisions. |
| 53 | 54 |
| 54 // Determines which tabs which should be shown according to onboarding/first | 55 // Determines which tabs which should be shown according to onboarding/first |
| 55 // run policy. | 56 // run policy. |
| 56 static StartupTabs CheckStandardOnboardingTabPolicy(bool is_first_run); | 57 static StartupTabs CheckStandardOnboardingTabPolicy(bool is_first_run); |
| 57 | 58 |
| 58 // Processes first run URLs specified in Master Preferences file, replacing | 59 // Processes first run URLs specified in Master Preferences file, replacing |
| 59 // any "magic word" URL hosts with appropriate URLs. | 60 // any "magic word" URL hosts with appropriate URLs. |
| 60 static StartupTabs CheckMasterPrefsTabPolicy( | 61 static StartupTabs CheckMasterPrefsTabPolicy( |
| 61 bool is_first_run, | 62 bool is_first_run, |
| 62 const std::vector<GURL>& first_run_tabs); | 63 const std::vector<GURL>& first_run_tabs); |
| 63 | 64 |
| 64 // Determines which tabs should be shown as a result of the presence/absence | 65 // Determines which tabs should be shown as a result of the presence/absence |
| 65 // of a Reset Trigger on this profile. | 66 // of a Reset Trigger on this profile. |
| 66 static StartupTabs CheckResetTriggerTabPolicy(bool profile_has_trigger); | 67 static StartupTabs CheckResetTriggerTabPolicy(bool profile_has_trigger); |
| 67 | 68 |
| 69 // Determines whether preferences indicate that user-specified tabs should be |
| 70 // shown as the default new window content, and returns the specified tabs if |
| 71 // so. |
| 72 static StartupTabs CheckPreferencesTabPolicy(SessionStartupPref pref); |
| 73 |
| 68 // Gets the URL for the "Welcome to Chrome" page. | 74 // Gets the URL for the "Welcome to Chrome" page. |
| 69 static GURL GetWelcomePageUrl(); | 75 static GURL GetWelcomePageUrl(); |
| 70 | 76 |
| 71 // Gets the URL for the page which offers to reset the user's profile | 77 // Gets the URL for the page which offers to reset the user's profile |
| 72 // settings. | 78 // settings. |
| 73 static GURL GetTriggeredResetSettingsUrl(); | 79 static GURL GetTriggeredResetSettingsUrl(); |
| 74 | 80 |
| 75 // StartupTabProvider: | 81 // StartupTabProvider: |
| 76 StartupTabs GetOnboardingTabs() const override; | 82 StartupTabs GetOnboardingTabs() const override; |
| 77 StartupTabs GetDistributionFirstRunTabs( | 83 StartupTabs GetDistributionFirstRunTabs( |
| 78 StartupBrowserCreator* browser_creator) const override; | 84 StartupBrowserCreator* browser_creator) const override; |
| 79 StartupTabs GetResetTriggerTabs(Profile* profile) const override; | 85 StartupTabs GetResetTriggerTabs(Profile* profile) const override; |
| 80 StartupTabs GetPinnedTabs() const override; | 86 StartupTabs GetPinnedTabs(Profile* profile) const override; |
| 81 StartupTabs GetPreferencesTabs() const override; | 87 StartupTabs GetPreferencesTabs(const base::CommandLine& command_line, |
| 88 Profile* profile) const override; |
| 82 | 89 |
| 83 private: | 90 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(StartupTabProviderImpl); | 91 DISALLOW_COPY_AND_ASSIGN(StartupTabProviderImpl); |
| 85 }; | 92 }; |
| 86 | 93 |
| 87 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ | 94 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
| OLD | NEW |