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

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: Using new welcome page URL Created 4 years, 2 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?" Provided as a virtual interface to allow
20 // faking in unit tests.
21 class StartupTabProvider {
22 public:
23 // Gathers relevant system state and returns any tabs which should be
24 // shown according to onboarding/first run policy.
25 virtual StartupTabs GetOnboardingTabs() const = 0;
26
27 // Gathers URLs from a Master Preferences file indicating first run logic
28 // specific to this distribution. Transforms any such URLs per policy and
29 // returns them. Also clears the value of first_run_urls_ in the provided
30 // BrowserCreator.
31 virtual StartupTabs GetDistributionFirstRunTabs(
32 StartupBrowserCreator* browser_creator) const = 0;
33
34 // Checks for the presence of a trigger indicating the need to offer a Profile
35 // Reset on this profile. Returns any tabs which should be shown accordingly.
36 virtual StartupTabs GetResetTriggerTabs(Profile* profile) const = 0;
37
38 // Returns the user's pinned tabs.
39 virtual StartupTabs GetPinnedTabs() const = 0;
40
41 // Returns tabs, if any, specified in the user's preferences as the default
42 // content for a
43 // new window.
Peter Kasting 2016/10/06 05:49:09 Nit: Line wrapping
44 virtual StartupTabs GetPreferencesTabs() const = 0;
45 };
46
47 class StartupTabProviderImpl : public StartupTabProvider {
48 public:
49 StartupTabProviderImpl() = default;
50
51 // The static Check*TabPolicy methods below enforce the policies relevant to
52 // the respective Get*Tabs methods, but do not gather or interact with any
53 // system state relating to making those policy decisions.
54
55 // Determines which tabs which should be shown according to onboarding/first
56 // run policy.
57 static StartupTabs CheckStandardOnboardingTabPolicy(bool is_first_run);
58
59 // Processes first run URLs specified in Master Preferences file, replacing
60 // any "magic word" URL hosts with appropriate URLs.
61 static StartupTabs CheckMasterPrefsTabPolicy(
62 bool is_first_run,
63 const std::vector<GURL>& first_run_tabs);
64
65 // Determines which tabs should be shown as a result of the presence/absence
66 // of a Reset Trigger on this profile.
67 static StartupTabs CheckResetTriggerTabPolicy(bool profile_has_trigger);
68
69 // Gets the URL for the "Welcome to Chrome" page.
70 static GURL GetWelcomePageUrl();
71
72 // Gets the URL for the page which offers to reset the user's profile
73 // settings.
74 static GURL GetTriggeredResetSettingsUrl();
75
76 // StartupTabProvider:
77 StartupTabs GetOnboardingTabs() const override;
78 StartupTabs GetDistributionFirstRunTabs(
79 StartupBrowserCreator* browser_creator) const override;
80 StartupTabs GetResetTriggerTabs(Profile* profile) const override;
81 StartupTabs GetPinnedTabs() const override;
82 StartupTabs GetPreferencesTabs() const override;
83
84 private:
85 DISALLOW_COPY_AND_ASSIGN(StartupTabProviderImpl);
86 };
87
88 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698