Commit 117b5f5a authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Broaden implicit suppression of welcome pages.

Also suppress them when the RestoreOnStartup policy has a recommended
value that is overridden with a user-provided value.

BUG=824059

Change-Id: I586411b9fded82841e174468cb830604b7121906
Reviewed-on: https://chromium-review.googlesource.com/1100755
Commit-Queue: Greg Thompson <grt@chromium.org>
Reviewed-by: default avatarTommy Martino <tmartino@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567391}
parent 27ff5a42
...@@ -131,15 +131,6 @@ bool SessionStartupPref::TypeIsManaged(PrefService* prefs) { ...@@ -131,15 +131,6 @@ bool SessionStartupPref::TypeIsManaged(PrefService* prefs) {
return pref_restore->IsManaged(); return pref_restore->IsManaged();
} }
// static
bool SessionStartupPref::TypeIsRecommended(PrefService* prefs) {
DCHECK(prefs);
const PrefService::Preference* pref_restore =
prefs->FindPreference(prefs::kRestoreOnStartup);
DCHECK(pref_restore);
return pref_restore->IsRecommended();
}
// static // static
bool SessionStartupPref::URLsAreManaged(PrefService* prefs) { bool SessionStartupPref::URLsAreManaged(PrefService* prefs) {
DCHECK(prefs); DCHECK(prefs);
...@@ -149,6 +140,15 @@ bool SessionStartupPref::URLsAreManaged(PrefService* prefs) { ...@@ -149,6 +140,15 @@ bool SessionStartupPref::URLsAreManaged(PrefService* prefs) {
return pref_urls->IsManaged(); return pref_urls->IsManaged();
} }
// static
bool SessionStartupPref::TypeHasRecommendedValue(PrefService* prefs) {
DCHECK(prefs);
const PrefService::Preference* pref_restore =
prefs->FindPreference(prefs::kRestoreOnStartup);
DCHECK(pref_restore);
return pref_restore->GetRecommendedValue() != nullptr;
}
// static // static
bool SessionStartupPref::TypeIsDefault(PrefService* prefs) { bool SessionStartupPref::TypeIsDefault(PrefService* prefs) {
DCHECK(prefs); DCHECK(prefs);
......
...@@ -55,12 +55,14 @@ struct SessionStartupPref { ...@@ -55,12 +55,14 @@ struct SessionStartupPref {
static SessionStartupPref GetStartupPref(Profile* profile); static SessionStartupPref GetStartupPref(Profile* profile);
static SessionStartupPref GetStartupPref(PrefService* prefs); static SessionStartupPref GetStartupPref(PrefService* prefs);
// Whether the startup type and URLs are managed via either mandatory or // Whether the startup type and URLs are managed via mandatory policy.
// recommended policy.
static bool TypeIsManaged(PrefService* prefs); static bool TypeIsManaged(PrefService* prefs);
static bool TypeIsRecommended(PrefService* prefs);
static bool URLsAreManaged(PrefService* prefs); static bool URLsAreManaged(PrefService* prefs);
// Whether the startup type has a recommended value (regardless of whether or
// not that value is in use).
static bool TypeHasRecommendedValue(PrefService* prefs);
// Whether the startup type has not been overridden from its default. // Whether the startup type has not been overridden from its default.
static bool TypeIsDefault(PrefService* prefs); static bool TypeIsDefault(PrefService* prefs);
......
...@@ -683,12 +683,12 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch( ...@@ -683,12 +683,12 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch(
IncompatibleApplicationsUpdater::HasCachedApplications(); IncompatibleApplicationsUpdater::HasCachedApplications();
} }
#endif #endif
const auto session_startup_pref = // Infer an intent to suppress promo pages if any value for the
StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); // RestoreOnStartup policy is mandatory or recommended.
// Both mandatory and recommended startup policies should skip promo pages. const bool are_startup_urls_managed =
bool are_startup_urls_managed = SessionStartupPref::TypeIsManaged(profile_->GetPrefs()) ||
session_startup_pref.TypeIsManaged(profile_->GetPrefs()) || SessionStartupPref::TypeHasRecommendedValue(profile_->GetPrefs());
session_startup_pref.TypeIsRecommended(profile_->GetPrefs());
StartupTabs tabs = DetermineStartupTabs( StartupTabs tabs = DetermineStartupTabs(
StartupTabProviderImpl(), cmd_line_tabs, process_startup, StartupTabProviderImpl(), cmd_line_tabs, process_startup,
is_incognito_or_guest, is_post_crash_launch, is_incognito_or_guest, is_post_crash_launch,
...@@ -709,8 +709,9 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch( ...@@ -709,8 +709,9 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch(
if (!cmd_line_tabs.empty()) if (!cmd_line_tabs.empty())
behavior_options |= HAS_CMD_LINE_TABS; behavior_options |= HAS_CMD_LINE_TABS;
BrowserOpenBehavior behavior = BrowserOpenBehavior behavior = DetermineBrowserOpenBehavior(
DetermineBrowserOpenBehavior(session_startup_pref, behavior_options); StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_),
behavior_options);
SessionRestore::BehaviorBitmask restore_options = 0; SessionRestore::BehaviorBitmask restore_options = 0;
if (behavior == BrowserOpenBehavior::SYNCHRONOUS_RESTORE) { if (behavior == BrowserOpenBehavior::SYNCHRONOUS_RESTORE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment