Index: chrome/browser/ui/startup/startup_tab_provider.h |
diff --git a/chrome/browser/ui/startup/startup_tab_provider.h b/chrome/browser/ui/startup/startup_tab_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..27ad6910971bc1c03bc86475bd58143c3b2fbdc3 |
--- /dev/null |
+++ b/chrome/browser/ui/startup/startup_tab_provider.h |
@@ -0,0 +1,80 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
+#define CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |
+ |
+#include <vector> |
+ |
+#include "base/gtest_prod_util.h" |
+#include "chrome/browser/first_run/first_run.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/ui/startup/startup_browser_creator.h" |
+#include "chrome/browser/ui/startup/startup_tab.h" |
+#include "url/gurl.h" |
+ |
+// Provides the sets of tabs to be shown at startup for given sets of policy. |
+// For instance, this class answers the question, "which tabs, if any, need to |
+// be shown for first run/onboarding?" |
+class StartupTabProvider { |
+ public: |
+ StartupTabProvider() = default; |
+ virtual ~StartupTabProvider() = default; |
+ |
+ // Determines which tabs which should be shown according to onboarding/first |
+ // run policy, and appends them to |output|. Returns true iff any tabs were |
grt (UTC plus 2)
2016/09/14 11:21:22
"output" doesn't say anything about what it is. i
tmartino
2016/09/15 00:14:47
My concern was more that people editing these func
|
+ // added. |
+ virtual bool AddOnboardingTabs(StartupTabs* tabs) const = 0; |
+ |
+ // Gathers tabs from a Master Preferences file indicating first run logic |
+ // specific to this distribution, and appends them to |output|. Also clears |
+ // the value of first_run_urls_ in the provided BrowserCreator. Returns true |
+ // iff any tabs were added. |
+ virtual bool AddDistributionFirstRunTabs( |
+ StartupBrowserCreator* browser_creator, |
+ StartupTabs* tabs) const = 0; |
+ |
+ // Determines which tabs should be shown as a result of a Reset Trigger |
+ // present on this profile, and appends them to |output|. Returns true iff any |
+ // tabs were added. |
+ virtual bool AddResetTriggerTabs(Profile* profile, |
+ StartupTabs* output) const = 0; |
+ |
+ // Reads tabs from the user's pinned tabs, and appends them to |output|. |
+ // Returns true iff any tabs were added. |
+ virtual bool AddPinnedTabs(StartupTabs* output) const = 0; |
+ |
+ // Reads tabs specified for new windows from the user's preferences, and |
+ // appends them to |output|. Returns true iff any tabs were added. |
+ virtual bool AddPreferencesTabs(StartupTabs* output) const = 0; |
+}; |
+ |
+class StartupTabProviderImpl : public StartupTabProvider { |
+ public: |
+ StartupTabProviderImpl() = default; |
+ bool AddOnboardingTabs(StartupTabs* output) const override; |
+ bool AddDistributionFirstRunTabs(StartupBrowserCreator* browser_creator, |
+ StartupTabs* output) const override; |
+ bool AddResetTriggerTabs(Profile* profile, |
+ StartupTabs* output) const override; |
+ bool AddPinnedTabs(StartupTabs* output) const override; |
+ bool AddPreferencesTabs(StartupTabs* output) const override; |
+ |
+ static bool CheckStandardOnboardingTabPolicy(bool is_first_run, |
+ StartupTabs* output); |
+ static bool CheckMasterPrefsTabPolicy(bool is_first_run, |
+ const std::vector<GURL>& first_run_tabs, |
+ StartupTabs* output); |
+ static bool CheckResetTriggerTabPolicy(bool profile_has_trigger, |
+ StartupTabs* output); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(StartupTabProviderImpl); |
+}; |
+ |
+// Gets the URL for the "Welcome to Chrome" dialog. |
+// TODO(tmartino): Update to return new Welcome page when complete. |
+GURL GetWelcomePageUrl(); |
+GURL GetTriggeredResetSettingsUrl(); |
+ |
+#endif // CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ |