Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7305)

Unified Diff: chrome/browser/ui/startup/startup_tab_provider.h

Issue 2164033002: Refactoring startup logic for upcoming FRE changes (non-Win 10). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing getters to adders Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3f44afc16c0753124202b1020b885fdb0f9f3c7d
--- /dev/null
+++ b/chrome/browser/ui/startup/startup_tab_provider.h
@@ -0,0 +1,76 @@
+// 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 adds them to |tabs|. Returns true iff any tabs were added.
+ virtual bool AddOnboardingTabs(StartupTabs* tabs) const = 0;
+
+ // Gathers tabs from a Master Preferences file indicating first run logic
+ // specific to this distribution, and adds them to |tabs|. 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. Returns true iff any tabs were added.
+ virtual bool AddResetTriggerTabs(Profile* profile,
+ StartupTabs* tabs) const = 0;
+
+ // Reads tabs from the user's pinned tabs and adds them to |tabs|. Returns
+ // true iff any tabs were added.
+ virtual bool AddPinnedTabs(StartupTabs* tabs) const = 0;
+
+ // Reads tabs from the user's preferences and adds them to |tabs|. Returns
+ // true iff any tabs were added.
+ virtual bool AddPreferencesTabs(StartupTabs* tabs) const = 0;
+};
+
+class StartupTabProviderImpl : public StartupTabProvider {
+ public:
+ StartupTabProviderImpl() = default;
+ bool AddOnboardingTabs(StartupTabs* tabs) const override;
+ bool AddDistributionFirstRunTabs(StartupBrowserCreator* browser_creator,
+ StartupTabs* tabs) const override;
+ bool AddResetTriggerTabs(Profile* profile, StartupTabs* tabs) const override;
+ bool AddPinnedTabs(StartupTabs* tabs) const override;
+ bool AddPreferencesTabs(StartupTabs* tabs) const override;
+
+ static StartupTabs CheckStandardOnboardingTabPolicy(bool is_first_run);
+ static StartupTabs CheckMasterPrefsTabPolicy(
+ bool is_first_run,
+ const std::vector<GURL>& first_run_tabs);
+ static StartupTabs CheckResetTriggerTabPolicy(bool profile_has_trigger);
+
+ 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_

Powered by Google App Engine
This is Rietveld 408576698