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

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

Issue 898553002: Add flag to enable/disable affiliaton based matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Work on terminology. Created 5 years, 10 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/password_manager/core/browser/affiliation_utils.cc
diff --git a/components/password_manager/core/browser/affiliation_utils.cc b/components/password_manager/core/browser/affiliation_utils.cc
index 23de0888f10eb74166816650c07644adf92f40bc..4f57b861b7d682e188ca10c34974e806a6dfd044 100644
--- a/components/password_manager/core/browser/affiliation_utils.cc
+++ b/components/password_manager/core/browser/affiliation_utils.cc
@@ -8,8 +8,11 @@
#include <ostream>
#include "base/base64.h"
+#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
+#include "components/password_manager/core/common/password_manager_switches.h"
#include "net/base/escape.h"
#include "url/third_party/mozilla/url_parse.h"
#include "url/url_canon_stdstring.h"
@@ -285,4 +288,17 @@ bool AreEquivalenceClassesEqual(const AffiliatedFacets& a,
return std::equal(a_sorted.begin(), a_sorted.end(), b_sorted.begin());
}
+bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line) {
+ // Note: It is important to always query the field trial state, to ensure that
vabr (Chromium) 2015/02/04 11:04:06 This is much clearer now!
+ // UMA reports the correct group.
+ const std::string group_name =
+ base::FieldTrialList::FindFullName("AffiliationBasedMatching");
+
+ if (command_line.HasSwitch(switches::kDisableAffiliationBasedMatching))
+ return false;
+ if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching))
+ return true;
+ return StartsWithASCII(group_name, "Enabled", /*case_sensitive=*/false);
+}
+
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698