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

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: Adding missing constructor 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..364066f30ca9793eacd282e68d81b0126f6b289a
--- /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() {}
grt (UTC plus 2) 2016/09/09 11:40:30 nit: = default; rather than {} here and on next li
+ virtual ~StartupTabProvider() {}
+
+ // Returns tabs, if any, to be shown according to onboarding/first run policy.
+ virtual StartupTabs GetOnboardingTabs() = 0;
grt (UTC plus 2) 2016/09/09 11:40:30 could these all be const methods?
+
+ // Returns tabs, if any, read from a Master Preferences file indicating custom
+ // first run logic. Reads, processes, and clears the value of first_run_urls_
+ // in the provided BrowserCreator.
+ virtual StartupTabs GetMasterPreferencesTabs(
+ StartupBrowserCreator* browser_creator) = 0;
+
+ // Returns tabs, if any, to be shown as a result of a Reset Trigger present on
+ // this profile.
+ virtual StartupTabs GetResetTriggerTabs(Profile* profile) = 0;
+
+ // Returns tabs, if any, read from the user's pinned tabs.
+ virtual StartupTabs GetPinnedTabs() = 0;
+
+ // Returns tabs, if any, read from the user's preferences.
+ virtual StartupTabs GetPreferencesTabs() = 0;
+};
+
+class StartupTabProviderImpl : public StartupTabProvider {
+ public:
+ StartupTabProviderImpl() {}
+ ~StartupTabProviderImpl() override {}
grt (UTC plus 2) 2016/09/09 11:40:30 this class has no state, so it doesn't need to ove
+ StartupTabs GetOnboardingTabs() override;
+ StartupTabs GetMasterPreferencesTabs(
+ StartupBrowserCreator* browser_creator) override;
+ StartupTabs GetResetTriggerTabs(Profile* profile) override;
+ StartupTabs GetPinnedTabs() override;
+ StartupTabs GetPreferencesTabs() override;
+
+ private:
+ 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);
+
+ FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest,
grt (UTC plus 2) 2016/09/09 11:40:30 since this is an "impl" class, i don't see a probl
+ CheckStandardOnboardingTabPolicy);
+ FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest,
+ CheckStandardOnboardingTabPolicy_FirstRunOnly);
+ FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest, CheckMasterPrefsTabPolicy);
+ FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest,
+ CheckMasterPrefsTabPolicy_FirstRunOnly);
+ FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest, CheckResetTriggerTabPolicy);
+ FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest,
+ CheckResetTriggerTabPolicy_Negative);
+};
grt (UTC plus 2) 2016/09/09 11:40:30 DISALOW_COPY_AND_ASSIGN
+
+// 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