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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/password_manager/core/browser/affiliation_utils.h" 5 #include "components/password_manager/core/browser/affiliation_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/command_line.h"
12 #include "base/metrics/field_trial.h"
11 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
12 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "components/password_manager/core/common/password_manager_switches.h"
13 #include "net/base/escape.h" 16 #include "net/base/escape.h"
14 #include "url/third_party/mozilla/url_parse.h" 17 #include "url/third_party/mozilla/url_parse.h"
15 #include "url/url_canon_stdstring.h" 18 #include "url/url_canon_stdstring.h"
16 #include "url/url_util.h" 19 #include "url/url_util.h"
17 20
18 namespace password_manager { 21 namespace password_manager {
19 22
20 namespace { 23 namespace {
21 24
22 // The scheme used for identifying Android applications. 25 // The scheme used for identifying Android applications.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (a.size() != b.size()) 281 if (a.size() != b.size())
279 return false; 282 return false;
280 283
281 std::vector<FacetURI> a_sorted(a.begin(), a.end()); 284 std::vector<FacetURI> a_sorted(a.begin(), a.end());
282 std::vector<FacetURI> b_sorted(b.begin(), b.end()); 285 std::vector<FacetURI> b_sorted(b.begin(), b.end());
283 std::sort(a_sorted.begin(), a_sorted.end()); 286 std::sort(a_sorted.begin(), a_sorted.end());
284 std::sort(b_sorted.begin(), b_sorted.end()); 287 std::sort(b_sorted.begin(), b_sorted.end());
285 return std::equal(a_sorted.begin(), a_sorted.end(), b_sorted.begin()); 288 return std::equal(a_sorted.begin(), a_sorted.end(), b_sorted.begin());
286 } 289 }
287 290
291 bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line) {
292 // 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!
293 // UMA reports the correct group.
294 const std::string group_name =
295 base::FieldTrialList::FindFullName("AffiliationBasedMatching");
296
297 if (command_line.HasSwitch(switches::kDisableAffiliationBasedMatching))
298 return false;
299 if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching))
300 return true;
301 return StartsWithASCII(group_name, "Enabled", /*case_sensitive=*/false);
302 }
303
288 } // namespace password_manager 304 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698