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) {
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
bool SessionStartupPref::URLsAreManaged(PrefService* prefs) {
DCHECK(prefs);
......@@ -149,6 +140,15 @@ bool SessionStartupPref::URLsAreManaged(PrefService* prefs) {
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
bool SessionStartupPref::TypeIsDefault(PrefService* prefs) {
DCHECK(prefs);
......
......@@ -55,12 +55,14 @@ struct SessionStartupPref {
static SessionStartupPref GetStartupPref(Profile* profile);
static SessionStartupPref GetStartupPref(PrefService* prefs);
// Whether the startup type and URLs are managed via either mandatory or
// recommended policy.
// Whether the startup type and URLs are managed via mandatory policy.
static bool TypeIsManaged(PrefService* prefs);
static bool TypeIsRecommended(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.
static bool TypeIsDefault(PrefService* prefs);
......
......@@ -683,12 +683,12 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch(
IncompatibleApplicationsUpdater::HasCachedApplications();
}
#endif
const auto session_startup_pref =
StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_);
// Both mandatory and recommended startup policies should skip promo pages.
bool are_startup_urls_managed =
session_startup_pref.TypeIsManaged(profile_->GetPrefs()) ||
session_startup_pref.TypeIsRecommended(profile_->GetPrefs());
// Infer an intent to suppress promo pages if any value for the
// RestoreOnStartup policy is mandatory or recommended.
const bool are_startup_urls_managed =
SessionStartupPref::TypeIsManaged(profile_->GetPrefs()) ||
SessionStartupPref::TypeHasRecommendedValue(profile_->GetPrefs());
StartupTabs tabs = DetermineStartupTabs(
StartupTabProviderImpl(), cmd_line_tabs, process_startup,
is_incognito_or_guest, is_post_crash_launch,
......@@ -709,8 +709,9 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch(
if (!cmd_line_tabs.empty())
behavior_options |= HAS_CMD_LINE_TABS;
BrowserOpenBehavior behavior =
DetermineBrowserOpenBehavior(session_startup_pref, behavior_options);
BrowserOpenBehavior behavior = DetermineBrowserOpenBehavior(
StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_),
behavior_options);
SessionRestore::BehaviorBitmask restore_options = 0;
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