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

Unified Diff: components/password_manager/core/browser/password_manager.cc

Issue 421563003: [Password Manager] Add experiment controlling sync credential saving behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/password_manager/core/common/password_manager_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_manager.cc
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
index cf6ef7dab13cec0dd7f3bd050503b4f6f8953df5..e05dab3878ac5999bb8748d898a43b44507c6458 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -19,6 +19,7 @@
#include "components/password_manager/core/browser/password_manager_driver.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
+#include "components/password_manager/core/common/password_manager_switches.h"
#include "components/pref_registry/pref_registry_syncable.h"
using autofill::PasswordForm;
@@ -53,6 +54,21 @@ void ReportMetrics(bool password_manager_enabled) {
UMA_HISTOGRAM_BOOLEAN("PasswordManager.Enabled", password_manager_enabled);
}
+bool ShouldDropSyncCredential() {
+ std::string group_name =
+ base::FieldTrialList::FindFullName("PasswordManagerDropSyncCredential");
+
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kEnableDropSyncCredential))
+ return true;
+
+ if (command_line->HasSwitch(switches::kDisableDropSyncCredential))
+ return false;
+
+ // Default to not saving.
+ return group_name != "Disabled";
+}
+
} // namespace
const char PasswordManager::kOtherPossibleUsernamesExperiment[] =
@@ -218,7 +234,8 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) {
// Don't save credentials for the syncing account. See crbug.com/365832 for
// background.
- if (client_->IsSyncAccountCredential(
+ if (ShouldDropSyncCredential() &&
+ client_->IsSyncAccountCredential(
base::UTF16ToUTF8(form.username_value), form.signon_realm)) {
RecordFailure(SYNC_CREDENTIAL, form.origin.host(), logger.get());
return;
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/password_manager/core/common/password_manager_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698