OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/gtest_prod_util.h" |
| 11 #include "chrome/browser/first_run/first_run.h" |
| 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 14 #include "chrome/browser/ui/startup/startup_tab.h" |
| 15 #include "url/gurl.h" |
| 16 |
| 17 // Provides the sets of tabs to be shown at startup for given sets of policy. |
| 18 // For instance, this class answers the question, "which tabs, if any, need to |
| 19 // be shown for first run/onboarding?" |
| 20 class StartupTabProvider { |
| 21 public: |
| 22 StartupTabProvider() = default; |
| 23 virtual ~StartupTabProvider() = default; |
| 24 |
| 25 // Determines which tabs which should be shown according to onboarding/first |
| 26 // run policy, and adds them to |tabs|. Returns true iff any tabs were added. |
| 27 virtual bool AddOnboardingTabs(StartupTabs* tabs) const = 0; |
| 28 |
| 29 // Gathers tabs from a Master Preferences file indicating first run logic |
| 30 // specific to this distribution, and adds them to |tabs|. Also clears the |
| 31 // value of first_run_urls_ in the provided BrowserCreator. Returns true iff |
| 32 // any tabs were added. |
| 33 virtual bool AddDistributionFirstRunTabs( |
| 34 StartupBrowserCreator* browser_creator, |
| 35 StartupTabs* tabs) const = 0; |
| 36 |
| 37 // Determines which tabs should be shown as a result of a Reset Trigger |
| 38 // present on |
| 39 // this profile. Returns true iff any tabs were added. |
| 40 virtual bool AddResetTriggerTabs(Profile* profile, |
| 41 StartupTabs* tabs) const = 0; |
| 42 |
| 43 // Reads tabs from the user's pinned tabs and adds them to |tabs|. Returns |
| 44 // true iff any tabs were added. |
| 45 virtual bool AddPinnedTabs(StartupTabs* tabs) const = 0; |
| 46 |
| 47 // Reads tabs from the user's preferences and adds them to |tabs|. Returns |
| 48 // true iff any tabs were added. |
| 49 virtual bool AddPreferencesTabs(StartupTabs* tabs) const = 0; |
| 50 }; |
| 51 |
| 52 class StartupTabProviderImpl : public StartupTabProvider { |
| 53 public: |
| 54 StartupTabProviderImpl() = default; |
| 55 bool AddOnboardingTabs(StartupTabs* tabs) const override; |
| 56 bool AddDistributionFirstRunTabs(StartupBrowserCreator* browser_creator, |
| 57 StartupTabs* tabs) const override; |
| 58 bool AddResetTriggerTabs(Profile* profile, StartupTabs* tabs) const override; |
| 59 bool AddPinnedTabs(StartupTabs* tabs) const override; |
| 60 bool AddPreferencesTabs(StartupTabs* tabs) const override; |
| 61 |
| 62 static StartupTabs CheckStandardOnboardingTabPolicy(bool is_first_run); |
| 63 static StartupTabs CheckMasterPrefsTabPolicy( |
| 64 bool is_first_run, |
| 65 const std::vector<GURL>& first_run_tabs); |
| 66 static StartupTabs CheckResetTriggerTabPolicy(bool profile_has_trigger); |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(StartupTabProviderImpl); |
| 69 }; |
| 70 |
| 71 // Gets the URL for the "Welcome to Chrome" dialog. |
| 72 // TODO(tmartino): Update to return new Welcome page when complete. |
| 73 GURL GetWelcomePageUrl(); |
| 74 GURL GetTriggeredResetSettingsUrl(); |
| 75 |
| 76 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
OLD | NEW |