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

Side by Side Diff: components/password_manager/core/browser/affiliation_utils.h

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 // This file contains utilities related to working with "facets". 5 // This file contains utilities related to working with "facets".
6 // 6 //
7 // A "facet" is defined as the manifestation of a logical application on a given 7 // A "facet" is defined as the manifestation of a logical application on a given
8 // platform. For example, "My Bank" may have released an Android application 8 // platform. For example, "My Bank" may have released an Android application
9 // and a Web application accessible from a browser. These are all facets of the 9 // and a Web application accessible from a browser. These are all facets of the
10 // "My Bank" logical application. 10 // "My Bank" logical application.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 #include <iosfwd> 47 #include <iosfwd>
48 #include <string> 48 #include <string>
49 #include <vector> 49 #include <vector>
50 50
51 #include "base/containers/hash_tables.h" 51 #include "base/containers/hash_tables.h"
52 #include "base/logging.h" 52 #include "base/logging.h"
53 #include "base/time/time.h" 53 #include "base/time/time.h"
54 #include "url/url_parse.h" 54 #include "url/url_parse.h"
55 55
56 namespace base {
57 class CommandLine;
58 } // namespace base
59
56 namespace password_manager { 60 namespace password_manager {
57 61
58 // Encapsulates a facet URI in canonical form. 62 // Encapsulates a facet URI in canonical form.
59 // 63 //
60 // This is a very light-weight wrapper around an std::string containing the text 64 // This is a very light-weight wrapper around an std::string containing the text
61 // of the URI, and can be passed around as a value. The main rationale for the 65 // of the URI, and can be passed around as a value. The main rationale for the
62 // existance of this class is to make it clearer in the code when a certain URI 66 // existance of this class is to make it clearer in the code when a certain URI
63 // is known to be a valid facet URI in canonical form, and to allow verifying 67 // is known to be a valid facet URI in canonical form, and to allow verifying
64 // and converting URIs to such canonical form. 68 // and converting URIs to such canonical form.
65 // 69 //
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 base::Time last_update_time; 158 base::Time last_update_time;
155 }; 159 };
156 160
157 // Returns whether or not equivalence classes |a| and |b| are equal, that is, 161 // Returns whether or not equivalence classes |a| and |b| are equal, that is,
158 // whether or not they consist of the same set of facets. 162 // whether or not they consist of the same set of facets.
159 // 163 //
160 // Note that this will do some sorting, so it can be expensive for large inputs. 164 // Note that this will do some sorting, so it can be expensive for large inputs.
161 bool AreEquivalenceClassesEqual(const AffiliatedFacets& a, 165 bool AreEquivalenceClassesEqual(const AffiliatedFacets& a,
162 const AffiliatedFacets& b); 166 const AffiliatedFacets& b);
163 167
168 // Returns whether or not affiliation based matching is enabled, either via
169 // command line flags or field trials. The command line flag, if present, always
170 // takes precedence.
171 bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line);
172
164 // For logging use only. 173 // For logging use only.
165 std::ostream& operator<<(std::ostream& os, const FacetURI& facet_uri); 174 std::ostream& operator<<(std::ostream& os, const FacetURI& facet_uri);
166 175
167 } // namespace password_manager 176 } // namespace password_manager
168 177
169 // Provide a hash function so that hash_sets and maps can contain FacetURIs. 178 // Provide a hash function so that hash_sets and maps can contain FacetURIs.
170 namespace BASE_HASH_NAMESPACE { 179 namespace BASE_HASH_NAMESPACE {
171 180
172 template <> 181 template <>
173 struct hash<password_manager::FacetURI> { 182 struct hash<password_manager::FacetURI> {
174 size_t operator()(const password_manager::FacetURI& facet_uri) const { 183 size_t operator()(const password_manager::FacetURI& facet_uri) const {
175 return hash<std::string>()(facet_uri.potentially_invalid_spec()); 184 return hash<std::string>()(facet_uri.potentially_invalid_spec());
176 } 185 }
177 }; 186 };
178 187
179 } // namespace BASE_HASH_NAMESPACE 188 } // namespace BASE_HASH_NAMESPACE
180 189
181 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ 190 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698