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

Side by Side Diff: chrome/browser/ui/startup/startup_tab_provider.h

Issue 2469363002: Tech Debt Repayment for StartupBrowserCreatorImpl Refactor (Closed)
Patch Set: sky comments Created 3 years, 10 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_
6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Returns the New Tab Page, if the user's preferences indicate a 47 // Returns the New Tab Page, if the user's preferences indicate a
48 // configuration where it must be passed explicitly. 48 // configuration where it must be passed explicitly.
49 virtual StartupTabs GetNewTabPageTabs(const base::CommandLine& command_line, 49 virtual StartupTabs GetNewTabPageTabs(const base::CommandLine& command_line,
50 Profile* profile) const = 0; 50 Profile* profile) const = 0;
51 }; 51 };
52 52
53 class StartupTabProviderImpl : public StartupTabProvider { 53 class StartupTabProviderImpl : public StartupTabProvider {
54 public: 54 public:
55 StartupTabProviderImpl() = default; 55 StartupTabProviderImpl() = default;
56 56
57 // The static Check*TabPolicy methods below enforce the policies relevant to 57 // The static helper methods below implement the policies relevant to the
58 // the respective Get*Tabs methods, but do not gather or interact with any 58 // respective Get*Tabs methods, but do not gather or interact with any
59 // system state relating to making those policy decisions. 59 // system state relating to making those policy decisions. Exposed for
60 // testing.
60 61
61 // Determines which tabs should be shown according to onboarding/first 62 // Determines which tabs should be shown according to onboarding/first
62 // run policy. 63 // run policy.
63 static StartupTabs CheckStandardOnboardingTabPolicy( 64 static StartupTabs GetStandardOnboardingTabsForState(
64 bool is_first_run, 65 bool is_first_run,
65 bool has_seen_welcome_page, 66 bool has_seen_welcome_page,
66 bool is_signed_in, 67 bool is_signed_in,
67 bool is_supervised_user); 68 bool is_supervised_user);
68 69
69 #if defined(OS_WIN) 70 #if defined(OS_WIN)
70 // Determines which tabs should be shown according to onboarding/first run 71 // Determines which tabs should be shown according to onboarding/first run
71 // policy, including promo content specific to Windows 10. 72 // policy, including promo content specific to Windows 10.
72 static StartupTabs CheckWin10OnboardingTabPolicy( 73 static StartupTabs GetWin10OnboardingTabsForState(
73 bool is_first_run, 74 bool is_first_run,
74 bool has_seen_welcome_page, 75 bool has_seen_welcome_page,
75 bool has_seen_win10_promo, 76 bool has_seen_win10_promo,
76 bool is_signed_in, 77 bool is_signed_in,
77 bool set_default_browser_allowed, 78 bool set_default_browser_allowed,
78 bool is_default_browser, 79 bool is_default_browser,
79 bool is_supervised_user); 80 bool is_supervised_user);
80 #endif 81 #endif
81 82
82 // Processes first run URLs specified in Master Preferences file, replacing 83 // Processes first run URLs specified in Master Preferences file, replacing
83 // any "magic word" URL hosts with appropriate URLs. 84 // any "magic word" URL hosts with appropriate URLs.
84 static StartupTabs CheckMasterPrefsTabPolicy( 85 static StartupTabs GetMasterPrefsTabsForState(
85 bool is_first_run, 86 bool is_first_run,
86 const std::vector<GURL>& first_run_tabs); 87 const std::vector<GURL>& first_run_tabs);
87 88
88 // Determines which tabs should be shown as a result of the presence/absence 89 // Determines which tabs should be shown as a result of the presence/absence
89 // of a Reset Trigger on this profile. 90 // of a Reset Trigger on this profile.
90 static StartupTabs CheckResetTriggerTabPolicy(bool profile_has_trigger); 91 static StartupTabs GetResetTriggerTabsForState(bool profile_has_trigger);
91 92
92 // Determines whether the startup preference requires the contents of 93 // Determines whether the startup preference requires the contents of
93 // |pinned_tabs| to be shown. This is needed to avoid duplicates, as the 94 // |pinned_tabs| to be shown. This is needed to avoid duplicates, as the
94 // session restore logic will also resurface pinned tabs on its own. 95 // session restore logic will also resurface pinned tabs on its own.
95 static StartupTabs CheckPinnedTabPolicy(const SessionStartupPref& pref, 96 static StartupTabs GetPinnedTabsForState(const SessionStartupPref& pref,
96 const StartupTabs& pinned_tabs); 97 const StartupTabs& pinned_tabs);
97 98
98 // Determines whether preferences and window state indicate that 99 // Determines whether preferences and window state indicate that
99 // user-specified tabs should be shown as the default new window content, and 100 // user-specified tabs should be shown as the default new window content, and
100 // returns the specified tabs if so. 101 // returns the specified tabs if so.
101 static StartupTabs CheckPreferencesTabPolicy( 102 static StartupTabs GetPreferencesTabsForState(
102 const SessionStartupPref& pref, 103 const SessionStartupPref& pref,
103 bool profile_has_other_tabbed_browser); 104 bool profile_has_other_tabbed_browser);
104 105
105 // Determines whether startup preferences require the New Tab Page to be 106 // Determines whether startup preferences require the New Tab Page to be
106 // explicitly specified. Session Restore does not expect the NTP to be passed. 107 // explicitly specified. Session Restore does not expect the NTP to be passed.
107 static StartupTabs CheckNewTabPageTabPolicy(const SessionStartupPref& pref); 108 static StartupTabs GetNewTabPageTabsForState(const SessionStartupPref& pref);
108 109
109 // Gets the URL for the Welcome page. If |use_later_run_variant| is true, a 110 // Gets the URL for the Welcome page. If |use_later_run_variant| is true, a
110 // URL parameter will be appended so as to access the variant page used when 111 // URL parameter will be appended so as to access the variant page used when
111 // onboarding occurs after the first Chrome execution (e.g., when creating an 112 // onboarding occurs after the first Chrome execution (e.g., when creating an
112 // additional profile). 113 // additional profile).
113 static GURL GetWelcomePageUrl(bool use_later_run_variant); 114 static GURL GetWelcomePageUrl(bool use_later_run_variant);
114 115
115 #if defined(OS_WIN) 116 #if defined(OS_WIN)
116 // Gets the URL for the Windows 10 Welcome page. If |use_later_run_variant| is 117 // Gets the URL for the Windows 10 Welcome page. If |use_later_run_variant| is
117 // true, a URL parameter will be appended so as to access the variant page 118 // true, a URL parameter will be appended so as to access the variant page
(...skipping 15 matching lines...) Expand all
133 StartupTabs GetPreferencesTabs(const base::CommandLine& command_line, 134 StartupTabs GetPreferencesTabs(const base::CommandLine& command_line,
134 Profile* profile) const override; 135 Profile* profile) const override;
135 StartupTabs GetNewTabPageTabs(const base::CommandLine& command_line, 136 StartupTabs GetNewTabPageTabs(const base::CommandLine& command_line,
136 Profile* profile) const override; 137 Profile* profile) const override;
137 138
138 private: 139 private:
139 DISALLOW_COPY_AND_ASSIGN(StartupTabProviderImpl); 140 DISALLOW_COPY_AND_ASSIGN(StartupTabProviderImpl);
140 }; 141 };
141 142
142 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ 143 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc ('k') | chrome/browser/ui/startup/startup_tab_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698