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

Side by Side 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 unified diff | Download patch
OLDNEW
(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() {}
grt (UTC plus 2) 2016/09/09 11:40:30 nit: = default; rather than {} here and on next li
23 virtual ~StartupTabProvider() {}
24
25 // Returns tabs, if any, to be shown according to onboarding/first run policy.
26 virtual StartupTabs GetOnboardingTabs() = 0;
grt (UTC plus 2) 2016/09/09 11:40:30 could these all be const methods?
27
28 // Returns tabs, if any, read from a Master Preferences file indicating custom
29 // first run logic. Reads, processes, and clears the value of first_run_urls_
30 // in the provided BrowserCreator.
31 virtual StartupTabs GetMasterPreferencesTabs(
32 StartupBrowserCreator* browser_creator) = 0;
33
34 // Returns tabs, if any, to be shown as a result of a Reset Trigger present on
35 // this profile.
36 virtual StartupTabs GetResetTriggerTabs(Profile* profile) = 0;
37
38 // Returns tabs, if any, read from the user's pinned tabs.
39 virtual StartupTabs GetPinnedTabs() = 0;
40
41 // Returns tabs, if any, read from the user's preferences.
42 virtual StartupTabs GetPreferencesTabs() = 0;
43 };
44
45 class StartupTabProviderImpl : public StartupTabProvider {
46 public:
47 StartupTabProviderImpl() {}
48 ~StartupTabProviderImpl() override {}
grt (UTC plus 2) 2016/09/09 11:40:30 this class has no state, so it doesn't need to ove
49 StartupTabs GetOnboardingTabs() override;
50 StartupTabs GetMasterPreferencesTabs(
51 StartupBrowserCreator* browser_creator) override;
52 StartupTabs GetResetTriggerTabs(Profile* profile) override;
53 StartupTabs GetPinnedTabs() override;
54 StartupTabs GetPreferencesTabs() override;
55
56 private:
57 static StartupTabs CheckStandardOnboardingTabPolicy(bool is_first_run);
58 static StartupTabs CheckMasterPrefsTabPolicy(
59 bool is_first_run,
60 const std::vector<GURL>& first_run_tabs);
61 static StartupTabs CheckResetTriggerTabPolicy(bool profile_has_trigger);
62
63 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
64 CheckStandardOnboardingTabPolicy);
65 FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest,
66 CheckStandardOnboardingTabPolicy_FirstRunOnly);
67 FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest, CheckMasterPrefsTabPolicy);
68 FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest,
69 CheckMasterPrefsTabPolicy_FirstRunOnly);
70 FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest, CheckResetTriggerTabPolicy);
71 FRIEND_TEST_ALL_PREFIXES(StartupTabProviderTest,
72 CheckResetTriggerTabPolicy_Negative);
73 };
grt (UTC plus 2) 2016/09/09 11:40:30 DISALOW_COPY_AND_ASSIGN
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698