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(
// available.
const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url;
GURL origin(url.GetOrigin());
bool is_gaia_origin = switches::IsEnableInlineSignin() &&
bool is_gaia_origin = !switches::IsEnableWebBasedSignin() &&
switches::IsNewProfileManagement() &&
gaia::IsGaiaSignonRealm(origin);
if (!is_gaia_origin && !IsDriveOrigin(origin))
......
......@@ -180,7 +180,7 @@ GURL GetPromoURL(Source source, bool auto_close) {
GURL GetPromoURL(Source source, bool auto_close, bool is_constrained) {
DCHECK_NE(SOURCE_UNKNOWN, source);
if (switches::IsEnableInlineSignin()) {
if (!switches::IsEnableWebBasedSignin()) {
std::string url(chrome::kChromeUIChromeSigninURL);
base::StringAppendF(&url, "?%s=%d", kSignInPromoQueryKeySource, source);
if (auto_close)
......
......@@ -411,7 +411,7 @@ void StartExplicitSync(const StartSyncArgs& args,
content::WebContents* contents,
OneClickSigninSyncStarter::StartSyncMode start_mode,
ConfirmEmailDialogDelegate::Action action) {
bool enable_inline = switches::IsEnableInlineSignin();
bool enable_inline = !switches::IsEnableWebBasedSignin();
if (action == ConfirmEmailDialogDelegate::START_SYNC) {
StartSync(args, start_mode);
if (!enable_inline) {
......
......@@ -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.*=sky@chromium.org
per-file crash_keys.*=rsesek@chromium.org
per-file profile_management_switches.*=bcwhite@chromium.org
......@@ -5,23 +5,39 @@
#include "chrome/common/profile_management_switches.h"
#include "base/command_line.h"
#include "base/metrics/field_trial.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 {
bool IsEnableInlineSignin() {
return !CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableWebBasedSignin);
bool IsEnableWebBasedSignin() {
return CheckProfileManagementFlag(switches::kEnableWebBasedSignin, false);
}
bool IsGoogleProfileInfo() {
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kGoogleProfileInfo);
return CheckProfileManagementFlag(switches::kGoogleProfileInfo, true);
}
bool IsNewProfileManagement() {
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNewProfileManagement);
return CheckProfileManagementFlag(switches::kNewProfileManagement, true);
}
} // namespace switches
......@@ -11,8 +11,8 @@
namespace switches {
// Enables the inline sign in flow on Chrome desktop.
bool IsEnableInlineSignin();
// Enables the web-based sign in flow on Chrome desktop.
bool IsEnableWebBasedSignin();
// Enables using GAIA information to populate profile name and icon.
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