| 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 appends them to |tabs|. Returns true iff any tabs were |
| 27 // added. |
| 28 virtual bool AddOnboardingTabs(StartupTabs* tabs) const = 0; |
| 29 |
| 30 // Gathers tabs from a Master Preferences file indicating first run logic |
| 31 // specific to this distribution, and appends them to |tabs|. Also clears |
| 32 // the value of first_run_urls_ in the provided BrowserCreator. Returns true |
| 33 // iff any tabs were added. |
| 34 virtual bool AddDistributionFirstRunTabs( |
| 35 StartupBrowserCreator* browser_creator, |
| 36 StartupTabs* tabs) const = 0; |
| 37 |
| 38 // Determines which tabs should be shown as a result of a Reset Trigger |
| 39 // present on this profile, and appends them to |tabs|. Returns true iff any |
| 40 // tabs were added. |
| 41 virtual bool AddResetTriggerTabs(Profile* profile, |
| 42 StartupTabs* tabs) const = 0; |
| 43 |
| 44 // Reads tabs from the user's pinned tabs, and appends them to |tabs|. |
| 45 // Returns true iff any tabs were added. |
| 46 virtual bool AddPinnedTabs(StartupTabs* tabs) const = 0; |
| 47 |
| 48 // Reads tabs specified for new windows from the user's preferences, and |
| 49 // appends them to |tabs|. Returns true iff any tabs were added. |
| 50 virtual bool AddPreferencesTabs(StartupTabs* tabs) const = 0; |
| 51 }; |
| 52 |
| 53 class StartupTabProviderImpl : public StartupTabProvider { |
| 54 public: |
| 55 StartupTabProviderImpl() = default; |
| 56 bool AddOnboardingTabs(StartupTabs* tabs) const override; |
| 57 bool AddDistributionFirstRunTabs(StartupBrowserCreator* browser_creator, |
| 58 StartupTabs* tabs) const override; |
| 59 bool AddResetTriggerTabs(Profile* profile, |
| 60 StartupTabs* tabs) const override; |
| 61 bool AddPinnedTabs(StartupTabs* tabs) const override; |
| 62 bool AddPreferencesTabs(StartupTabs* tabs) const override; |
| 63 |
| 64 static bool CheckStandardOnboardingTabPolicy(bool is_first_run, |
| 65 StartupTabs* tabs); |
| 66 static bool CheckMasterPrefsTabPolicy(bool is_first_run, |
| 67 const std::vector<GURL>& first_run_tabs, |
| 68 StartupTabs* tabs); |
| 69 static bool CheckResetTriggerTabPolicy(bool profile_has_trigger, |
| 70 StartupTabs* tabs); |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(StartupTabProviderImpl); |
| 73 }; |
| 74 |
| 75 // Gets the URL for the "Welcome to Chrome" dialog. |
| 76 // TODO(tmartino): Update to return new Welcome page when complete. |
| 77 GURL GetWelcomePageUrl(); |
| 78 GURL GetTriggeredResetSettingsUrl(); |
| 79 |
| 80 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
| OLD | NEW |