OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATED_MATCH_HELPER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATED_MATCH_HELPER_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATED_MATCH_HELPER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATED_MATCH_HELPER_H_ |
7 | 7 |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | 8 #include <memory> |
11 #include <string> | 9 #include <string> |
12 #include <vector> | 10 #include <vector> |
13 | 11 |
14 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
15 #include "base/macros.h" | 13 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/time/time.h" |
17 #include "components/password_manager/core/browser/affiliation_utils.h" | 16 #include "components/password_manager/core/browser/affiliation_utils.h" |
18 #include "components/password_manager/core/browser/password_store.h" | 17 #include "components/password_manager/core/browser/password_store.h" |
19 #include "components/password_manager/core/browser/password_store_consumer.h" | 18 #include "components/password_manager/core/browser/password_store_consumer.h" |
20 | 19 |
21 namespace autofill { | 20 namespace autofill { |
22 struct PasswordForm; | 21 struct PasswordForm; |
23 } // namespace autofill | 22 } // namespace autofill |
24 | 23 |
25 namespace password_manager { | 24 namespace password_manager { |
26 | 25 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Removes cached affiliation data that is no longer needed. | 92 // Removes cached affiliation data that is no longer needed. |
94 void TrimAffiliationCache(); | 93 void TrimAffiliationCache(); |
95 | 94 |
96 // Returns whether or not |form| represents an Android credential. | 95 // Returns whether or not |form| represents an Android credential. |
97 static bool IsValidAndroidCredential(const PasswordStore::FormDigest& form); | 96 static bool IsValidAndroidCredential(const PasswordStore::FormDigest& form); |
98 | 97 |
99 // Returns whether or not |form| represents a valid Web credential for the | 98 // Returns whether or not |form| represents a valid Web credential for the |
100 // purposes of affiliation-based matching. | 99 // purposes of affiliation-based matching. |
101 static bool IsValidWebCredential(const PasswordStore::FormDigest& form); | 100 static bool IsValidWebCredential(const PasswordStore::FormDigest& form); |
102 | 101 |
103 // Sets the task runner to be used to delay I/O heavy initialization. Should | |
104 // be called before Initialize(). Used only for testing. | |
105 void SetTaskRunnerUsedForWaitingForTesting( | |
106 const scoped_refptr<base::SingleThreadTaskRunner> task_runner); | |
107 | |
108 // I/O heavy initialization on start-up will be delayed by this long. | 102 // I/O heavy initialization on start-up will be delayed by this long. |
109 // This should be high enough not to exacerbate start-up I/O contention too | 103 // This should be high enough not to exacerbate start-up I/O contention too |
110 // much, but also low enough that the user be able log-in shortly after | 104 // much, but also low enough that the user be able log-in shortly after |
111 // browser start-up into web sites using Android credentials. | 105 // browser start-up into web sites using Android credentials. |
112 // TODO(engedy): See if we can tie this instead to some meaningful event. | 106 // TODO(engedy): See if we can tie this instead to some meaningful event. |
113 static const int64_t kInitializationDelayOnStartupInSeconds = 8; | 107 static constexpr base::TimeDelta kInitializationDelayOnStartup = |
| 108 base::TimeDelta::FromSeconds(8); |
114 | 109 |
115 private: | 110 private: |
116 // Reads all autofillable credentials from the password store and starts | 111 // Reads all autofillable credentials from the password store and starts |
117 // observing the store for future changes. | 112 // observing the store for future changes. |
118 void DoDeferredInitialization(); | 113 void DoDeferredInitialization(); |
119 | 114 |
120 // Called back by AffiliationService to supply the list of facets affiliated | 115 // Called back by AffiliationService to supply the list of facets affiliated |
121 // with |original_facet_uri| so that a GetAffiliatedAndroidRealms() call can | 116 // with |original_facet_uri| so that a GetAffiliatedAndroidRealms() call can |
122 // be completed. | 117 // be completed. |
123 void CompleteGetAffiliatedAndroidRealms( | 118 void CompleteGetAffiliatedAndroidRealms( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 std::unique_ptr<AffiliationService> affiliation_service_; | 151 std::unique_ptr<AffiliationService> affiliation_service_; |
157 | 152 |
158 base::WeakPtrFactory<AffiliatedMatchHelper> weak_ptr_factory_; | 153 base::WeakPtrFactory<AffiliatedMatchHelper> weak_ptr_factory_; |
159 | 154 |
160 DISALLOW_COPY_AND_ASSIGN(AffiliatedMatchHelper); | 155 DISALLOW_COPY_AND_ASSIGN(AffiliatedMatchHelper); |
161 }; | 156 }; |
162 | 157 |
163 } // namespace password_manager | 158 } // namespace password_manager |
164 | 159 |
165 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATED_MATCH_HELPER_H_ | 160 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATED_MATCH_HELPER_H_ |
OLD | NEW |