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

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

Issue 1668523002: [Password Manager] Switch password manager code to use the Feature framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses the review inputs. Created 4 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 5fa3ff75d8788097759fc3e76cf01a1221264036..e19196613c3af2a861ccadae3d47ac2aa4491126 100644
--- a/components/password_manager/core/browser/affiliation_utils.cc
+++ b/components/password_manager/core/browser/affiliation_utils.cc
@@ -8,12 +8,12 @@
#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/autofill/core/common/password_form.h"
-#include "components/password_manager/core/common/password_manager_switches.h"
+#include "components/password_manager/core/browser/password_manager_util.h"
+#include "components/password_manager/core/common/password_manager_features.h"
#include "components/url_formatter/elide_url.h"
#include "components/variations/variations_associated_data.h"
#include "net/base/escape.h"
@@ -291,32 +291,39 @@ bool AreEquivalenceClassesEqual(const AffiliatedFacets& a,
return std::equal(a_sorted.begin(), a_sorted.end(), b_sorted.begin());
}
-bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line) {
+bool IsAffiliationBasedMatchingEnabled() {
// Note: It is important to always query the field trial state, to ensure that
// UMA reports the correct group.
const std::string group_name =
base::FieldTrialList::FindFullName(kFieldTrialName);
- if (command_line.HasSwitch(switches::kDisableAffiliationBasedMatching))
- return false;
- if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching))
+ if (base::FeatureList::IsEnabled(features::kAffiliationBasedMatching))
return true;
+
+ if (password_manager_util::IsFeatureDisabledFromCommandLine(
+ features::kAffiliationBasedMatching)) {
+ return false;
+ }
+
return !base::StartsWith(group_name, "Disabled",
base::CompareCase::INSENSITIVE_ASCII);
}
-bool IsPropagatingPasswordChangesToWebCredentialsEnabled(
- const base::CommandLine& command_line) {
+bool IsPropagatingPasswordChangesToWebCredentialsEnabled() {
// Note: It is important to always query the variation param first, which, in
// turn, queries the field trial state, which ensures that UMA reports the
// correct group if it is forced by a command line flag.
const std::string update_enabled = variations::GetVariationParamValue(
kFieldTrialName, "propagate_password_changes_to_web");
- if (command_line.HasSwitch(switches::kDisableAffiliationBasedMatching))
- return false;
- if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching))
+ if (base::FeatureList::IsEnabled(features::kAffiliationBasedMatching))
return true;
+
+ if (password_manager_util::IsFeatureDisabledFromCommandLine(
+ features::kAffiliationBasedMatching)) {
+ return false;
+ }
+
return !base::LowerCaseEqualsASCII(update_enabled, "disabled");
}

Powered by Google App Engine
This is Rietveld 408576698