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

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..d01296a68e6d29139b91dba13b014bde4805bd53 100644
--- a/components/signin/core/common/profile_management_switches.cc
+++ b/components/signin/core/common/profile_management_switches.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
+#include "build/build_config.h"
#include "components/signin/core/common/signin_switches.h"
namespace {
@@ -23,42 +24,66 @@ enum State {
State GetProcessState() {
// Get the full name of the field trial so that the underlying mechanism
- // is properly initialize.
+ // is properly initialized.
std::string trial_type =
base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName);
// 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);
-
- State state = STATE_NONE;
-
- // 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 (is_new_profile_management && is_consistent_identity) {
+ bool not_new_profile_management =
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableNewProfileManagement);
+ bool not_consistent_identity =
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableAccountConsistency);
+ int count_args = (is_new_profile_management ? 1 : 0) +
+ (is_consistent_identity ? 1 : 0) +
+ (not_new_profile_management ? 1 : 0) +
+ (not_consistent_identity ? 1 : 0);
+ bool invalid_commandline = count_args > 1;
+
+ // At most only one of the command line args should be specified, otherwise
+ // the finch group assignment is undefined. If this is the case, disable
+ // the field trial so that data is not collected in the wrong group.
+ if (invalid_commandline) {
base::FieldTrial* field_trial =
base::FieldTrialList::Find(kNewProfileManagementFieldTrialName);
if (field_trial)
field_trial->Disable();
+ trial_type.clear();
+ }
+
+ // Enable command line args take precedent over disable command line args.
+ // Consistent identity args take precedent over new profile management args.
+ if (is_consistent_identity) {
return STATE_ACCOUNT_CONSISTENCY;
} else if (is_new_profile_management) {
return STATE_NEW_PROFILE_MANAGEMENT;
- } else if (is_consistent_identity) {
- return STATE_ACCOUNT_CONSISTENCY;
+ } else if (not_new_profile_management) {
+ return STATE_NONE;
+ } else if (not_consistent_identity) {
+ return STATE_NEW_PROFILE_MANAGEMENT;
}
- if (state == STATE_NONE && !trial_type.empty()) {
+#if defined(OS_ANDROID)
+ State state = STATE_ACCOUNT_CONSISTENCY;
+#else
+ State state = STATE_NONE;
+#endif
+
+ if (!trial_type.empty()) {
if (trial_type == "Enabled") {
state = STATE_NEW_PROFILE_MANAGEMENT;
} else if (trial_type == "AccountConsistency") {
state = STATE_ACCOUNT_CONSISTENCY;
+ } else {
+ state = STATE_NONE;
}
}
@@ -120,4 +145,14 @@ bool IsNewProfileManagementPreviewEnabled() {
return is_new_avatar_menu && IsNewProfileManagement();
}
+void EnableNewProfileManagementForTesting(base::CommandLine* command_line) {
+ command_line->AppendSwitch(switches::kEnableNewProfileManagement);
+ DCHECK(!command_line->HasSwitch(switches::kDisableNewProfileManagement));
+}
+
+void EnableAccountConsistencyForTesting(base::CommandLine* command_line) {
+ command_line->AppendSwitch(switches::kEnableAccountConsistency);
+ DCHECK(!command_line->HasSwitch(switches::kDisableAccountConsistency));
+}
+
} // namespace switches
« no previous file with comments | « components/signin/core/common/profile_management_switches.h ('k') | components/signin/core/common/signin_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698