OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 // openssl sha -sha512 -binary | base64 | tr '+/' '-_' | 41 // openssl sha -sha512 -binary | base64 | tr '+/' '-_' |
42 // | 42 // |
43 | 43 |
44 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ | 44 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ |
45 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ | 45 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ |
46 | 46 |
47 #include <string> | 47 #include <string> |
48 #include <vector> | 48 #include <vector> |
49 | 49 |
50 #include "base/logging.h" | 50 #include "base/logging.h" |
| 51 #include "base/time/time.h" |
51 #include "url/url_parse.h" | 52 #include "url/url_parse.h" |
52 | 53 |
53 namespace password_manager { | 54 namespace password_manager { |
54 | 55 |
55 // Encapsulates a facet URI in canonical form. | 56 // Encapsulates a facet URI in canonical form. |
56 // | 57 // |
57 // This is a very light-weight wrapper around an std::string containing the text | 58 // This is a very light-weight wrapper around an std::string containing the text |
58 // of the URI, and can be passed around as a value. The main rationale for the | 59 // of the URI, and can be passed around as a value. The main rationale for the |
59 // existance of this class is to make it clearer in the code when a certain URI | 60 // existance of this class is to make it clearer in the code when a certain URI |
60 // is known to be a valid facet URI in canonical form, and to allow verifying | 61 // is known to be a valid facet URI in canonical form, and to allow verifying |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // |is_valid_| is true. | 131 // |is_valid_| is true. |
131 std::string canonical_spec_; | 132 std::string canonical_spec_; |
132 | 133 |
133 // Identified components of the canonical spec. | 134 // Identified components of the canonical spec. |
134 url::Parsed parsed_; | 135 url::Parsed parsed_; |
135 }; | 136 }; |
136 | 137 |
137 // A collection of facets affiliated with each other, i.e. an equivalence class. | 138 // A collection of facets affiliated with each other, i.e. an equivalence class. |
138 typedef std::vector<FacetURI> AffiliatedFacets; | 139 typedef std::vector<FacetURI> AffiliatedFacets; |
139 | 140 |
| 141 // A collection of facets affiliated with each other, i.e. an equivalence class, |
| 142 // plus a timestamp that indicates the last time the data was updated from an |
| 143 // authoritative source. |
| 144 struct AffiliatedFacetsWithUpdateTime { |
| 145 AffiliatedFacetsWithUpdateTime(); |
| 146 ~AffiliatedFacetsWithUpdateTime(); |
| 147 |
| 148 AffiliatedFacets facets; |
| 149 base::Time last_update_time; |
| 150 }; |
| 151 |
140 // Returns whether or not equivalence classes |a| and |b| are equal, that is, | 152 // Returns whether or not equivalence classes |a| and |b| are equal, that is, |
141 // whether or not they consist of the same set of facets. | 153 // whether or not they consist of the same set of facets. |
142 // | 154 // |
143 // Note that this will do some sorting, so it can be expensive for large inputs. | 155 // Note that this will do some sorting, so it can be expensive for large inputs. |
144 bool AreEquivalenceClassesEqual(const AffiliatedFacets& a, | 156 bool AreEquivalenceClassesEqual(const AffiliatedFacets& a, |
145 const AffiliatedFacets& b); | 157 const AffiliatedFacets& b); |
146 | 158 |
147 } // namespace password_manager | 159 } // namespace password_manager |
148 | 160 |
149 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ | 161 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ |
OLD | NEW |