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

Unified Diff: components/signin/core/common/profile_management_switches.cc

Issue 323133005: Enable consistent identity on android platform by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/signin/core/common/profile_management_switches.cc
diff --git a/components/signin/core/common/profile_management_switches.cc b/components/signin/core/common/profile_management_switches.cc
index dfe855b46df887a66996010fb331f50ebf3f812e..2f3da082eba50ffde44565da671edfb1a69124df 100644
--- a/components/signin/core/common/profile_management_switches.cc
+++ b/components/signin/core/common/profile_management_switches.cc
@@ -21,6 +21,54 @@ enum State {
STATE_ACCOUNT_CONSISTENCY
};
+#if defined(OS_ANDROID)
+
+State GetProcessState() {
guohui 2014/06/11 15:53:01 eh this method is essentially a copy/paste of the
+ // Get the full name of the field trial so that the underlying mechanism
+ // is properly initialize.
noms (inactive) 2014/06/11 14:14:12 nit: s/initialize/initialized, here and below. sor
Roger Tawa OOO till Jul 10th 2014/06/13 02:17:19 Done.
+ std::string trial_type =
+ base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName);
+
+ // Find the state of both command line args.
+ bool not_new_profile_management =
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableNewProfileManagement);
+ bool not_consistent_identity =
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableAccountConsistency);
+
+ State state = STATE_ACCOUNT_CONSISTENCY;
+
+ // If both command line args are set, disable the field trial completely
+ // since the assigned group is undefined. Otherwise use the state of the
+ // command line flag specified. If neither command line arg is specified,
+ // see if the group was set from the server.
+ if (not_new_profile_management && not_consistent_identity) {
+ base::FieldTrial* field_trial =
+ base::FieldTrialList::Find(kNewProfileManagementFieldTrialName);
+ if (field_trial)
+ field_trial->Disable();
+
+ return STATE_NONE;
+ } else if (not_new_profile_management) {
+ return STATE_NONE;
+ } else if (not_consistent_identity) {
+ return STATE_NEW_PROFILE_MANAGEMENT;
+ }
+
+ if (!trial_type.empty()) {
+ if (trial_type == "Enabled") {
+ state = STATE_NEW_PROFILE_MANAGEMENT;
+ } else if (trial_type == "AccountConsistency") {
+ state = STATE_ACCOUNT_CONSISTENCY;
+ }
+ }
+
+ return state;
+}
+
+#else
+
State GetProcessState() {
// Get the full name of the field trial so that the underlying mechanism
// is properly initialize.
@@ -30,7 +78,7 @@ State GetProcessState() {
// Find the state of both command line args.
bool is_new_profile_management =
CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kNewProfileManagement);
+ switches::kEnableNewProfileManagement);
bool is_consistent_identity =
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableAccountConsistency);
@@ -54,7 +102,7 @@ State GetProcessState() {
return STATE_ACCOUNT_CONSISTENCY;
}
- if (state == STATE_NONE && !trial_type.empty()) {
+ if (!trial_type.empty()) {
if (trial_type == "Enabled") {
state = STATE_NEW_PROFILE_MANAGEMENT;
} else if (trial_type == "AccountConsistency") {
@@ -65,6 +113,8 @@ State GetProcessState() {
return state;
}
+#endif
+
bool CheckFlag(std::string command_switch, State min_state) {
// Individiual flag settings take precedence.
if (CommandLine::ForCurrentProcess()->HasSwitch(command_switch))

Powered by Google App Engine
This is Rietveld 408576698