Commit ad914253 authored by bcwhite@chromium.org's avatar bcwhite@chromium.org

Support experiment control of profile-management flags.

Three flags can now be controlled via an "experiment".
  EnableWebBasedSignin
  GoogleProfileInfo
  NewProfileManagement

Also, correct name of function to match command-line flag change:
  EnableInlineSignin => !EnableWebBasedSignin

BUG=324046

Review URL: https://codereview.chromium.org/111033005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243668 0039d316-1c4b-4281-b951-d872f2087c98
parent a547aaf2
...@@ -72,7 +72,7 @@ void AppendMirrorRequestHeaderIfPossible( ...@@ -72,7 +72,7 @@ void AppendMirrorRequestHeaderIfPossible(
// available. // available.
const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url; const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url;
GURL origin(url.GetOrigin()); GURL origin(url.GetOrigin());
bool is_gaia_origin = switches::IsEnableInlineSignin() && bool is_gaia_origin = !switches::IsEnableWebBasedSignin() &&
switches::IsNewProfileManagement() && switches::IsNewProfileManagement() &&
gaia::IsGaiaSignonRealm(origin); gaia::IsGaiaSignonRealm(origin);
if (!is_gaia_origin && !IsDriveOrigin(origin)) if (!is_gaia_origin && !IsDriveOrigin(origin))
......
...@@ -180,7 +180,7 @@ GURL GetPromoURL(Source source, bool auto_close) { ...@@ -180,7 +180,7 @@ GURL GetPromoURL(Source source, bool auto_close) {
GURL GetPromoURL(Source source, bool auto_close, bool is_constrained) { GURL GetPromoURL(Source source, bool auto_close, bool is_constrained) {
DCHECK_NE(SOURCE_UNKNOWN, source); DCHECK_NE(SOURCE_UNKNOWN, source);
if (switches::IsEnableInlineSignin()) { if (!switches::IsEnableWebBasedSignin()) {
std::string url(chrome::kChromeUIChromeSigninURL); std::string url(chrome::kChromeUIChromeSigninURL);
base::StringAppendF(&url, "?%s=%d", kSignInPromoQueryKeySource, source); base::StringAppendF(&url, "?%s=%d", kSignInPromoQueryKeySource, source);
if (auto_close) if (auto_close)
......
...@@ -411,7 +411,7 @@ void StartExplicitSync(const StartSyncArgs& args, ...@@ -411,7 +411,7 @@ void StartExplicitSync(const StartSyncArgs& args,
content::WebContents* contents, content::WebContents* contents,
OneClickSigninSyncStarter::StartSyncMode start_mode, OneClickSigninSyncStarter::StartSyncMode start_mode,
ConfirmEmailDialogDelegate::Action action) { ConfirmEmailDialogDelegate::Action action) {
bool enable_inline = switches::IsEnableInlineSignin(); bool enable_inline = !switches::IsEnableWebBasedSignin();
if (action == ConfirmEmailDialogDelegate::START_SYNC) { if (action == ConfirmEmailDialogDelegate::START_SYNC) {
StartSync(args, start_mode); StartSync(args, start_mode);
if (!enable_inline) { if (!enable_inline) {
......
...@@ -47,3 +47,4 @@ per-file autocomplete_match_type.*=mpearson@chromium.org ...@@ -47,3 +47,4 @@ per-file autocomplete_match_type.*=mpearson@chromium.org
per-file autocomplete_match_type.*=pkasting@chromium.org per-file autocomplete_match_type.*=pkasting@chromium.org
per-file autocomplete_match_type.*=sky@chromium.org per-file autocomplete_match_type.*=sky@chromium.org
per-file crash_keys.*=rsesek@chromium.org per-file crash_keys.*=rsesek@chromium.org
per-file profile_management_switches.*=bcwhite@chromium.org
...@@ -5,23 +5,39 @@ ...@@ -5,23 +5,39 @@
#include "chrome/common/profile_management_switches.h" #include "chrome/common/profile_management_switches.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
namespace {
const char kNewProfileManagementFieldTrialName[] = "NewProfileManagement";
bool CheckProfileManagementFlag(std::string command_switch, bool active_state) {
std::string trial_type =
base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName);
if (!trial_type.empty()) {
if (trial_type == "Enabled")
return active_state;
if (trial_type == "Disabled")
return !active_state;
}
return CommandLine::ForCurrentProcess()->HasSwitch(command_switch);
}
} // namespace
namespace switches { namespace switches {
bool IsEnableInlineSignin() { bool IsEnableWebBasedSignin() {
return !CommandLine::ForCurrentProcess()->HasSwitch( return CheckProfileManagementFlag(switches::kEnableWebBasedSignin, false);
switches::kEnableWebBasedSignin);
} }
bool IsGoogleProfileInfo() { bool IsGoogleProfileInfo() {
return CommandLine::ForCurrentProcess()->HasSwitch( return CheckProfileManagementFlag(switches::kGoogleProfileInfo, true);
switches::kGoogleProfileInfo);
} }
bool IsNewProfileManagement() { bool IsNewProfileManagement() {
return CommandLine::ForCurrentProcess()->HasSwitch( return CheckProfileManagementFlag(switches::kNewProfileManagement, true);
switches::kNewProfileManagement);
} }
} // namespace switches } // namespace switches
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
namespace switches { namespace switches {
// Enables the inline sign in flow on Chrome desktop. // Enables the web-based sign in flow on Chrome desktop.
bool IsEnableInlineSignin(); bool IsEnableWebBasedSignin();
// Enables using GAIA information to populate profile name and icon. // Enables using GAIA information to populate profile name and icon.
bool IsGoogleProfileInfo(); bool IsGoogleProfileInfo();
......
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