| 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_FACET_MANAGER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FACET_MANAGER_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FACET_MANAGER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FACET_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace password_manager { | 22 namespace password_manager { |
| 23 | 23 |
| 24 class FacetManagerHost; | 24 class FacetManagerHost; |
| 25 | 25 |
| 26 // Encapsulates the state and logic required for handling affiliation requests | 26 // Encapsulates the state and logic required for handling affiliation requests |
| 27 // concerning a single facet. The AffiliationBackend owns one instance for each | 27 // concerning a single facet. The AffiliationBackend owns one instance for each |
| 28 // facet that requires attention, and it itself implements the FacetManagerHost | 28 // facet that requires attention, and it itself implements the FacetManagerHost |
| 29 // interface to provide shared functionality needed by all FacetManagers. | 29 // interface to provide shared functionality needed by all FacetManagers. |
| 30 class FacetManager { | 30 class FacetManager { |
| 31 public: | 31 public: |
| 32 using StrategyOnCacheMiss = AffiliationService::StrategyOnCacheMiss; |
| 33 |
| 32 // Both the |backend| and |clock| must outlive this object. | 34 // Both the |backend| and |clock| must outlive this object. |
| 33 FacetManager(const FacetURI& facet_uri, | 35 FacetManager(const FacetURI& facet_uri, |
| 34 FacetManagerHost* backend, | 36 FacetManagerHost* backend, |
| 35 base::Clock* clock); | 37 base::Clock* clock); |
| 36 ~FacetManager(); | 38 ~FacetManager(); |
| 37 | 39 |
| 38 // Facet-specific implementations for methods in AffiliationService of the | 40 // Facet-specific implementations for methods in AffiliationService of the |
| 39 // same name. See documentation in affiliation_service.h for details: | 41 // same name. See documentation in affiliation_service.h for details: |
| 40 void GetAffiliations( | 42 void GetAffiliations( |
| 41 bool cached_only, | 43 StrategyOnCacheMiss cache_miss_strategy, |
| 42 const AffiliationService::ResultCallback& callback, | 44 const AffiliationService::ResultCallback& callback, |
| 43 const scoped_refptr<base::TaskRunner>& callback_task_runner); | 45 const scoped_refptr<base::TaskRunner>& callback_task_runner); |
| 44 void Prefetch(const base::Time& keep_fresh_until); | 46 void Prefetch(const base::Time& keep_fresh_until); |
| 45 void CancelPrefetch(const base::Time& keep_fresh_until); | 47 void CancelPrefetch(const base::Time& keep_fresh_until); |
| 46 | 48 |
| 47 // Called when |affiliation| information regarding this facet has just been | 49 // Called when |affiliation| information regarding this facet has just been |
| 48 // fetched from the Affiliation API. | 50 // fetched from the Affiliation API. |
| 49 void OnFetchSucceeded(const AffiliatedFacetsWithUpdateTime& affiliation); | 51 void OnFetchSucceeded(const AffiliatedFacetsWithUpdateTime& affiliation); |
| 50 | 52 |
| 51 // Called by the backend when the time specified in RequestNotificationAtTime | 53 // Called by the backend when the time specified in RequestNotificationAtTime |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // This is not a single timestamp but rather a multiset so that cancellation | 124 // This is not a single timestamp but rather a multiset so that cancellation |
| 123 // of individual prefetches can be supported even if there are two requests | 125 // of individual prefetches can be supported even if there are two requests |
| 124 // with the same |keep_fresh_until| threshold. | 126 // with the same |keep_fresh_until| threshold. |
| 125 std::multiset<base::Time> keep_fresh_until_thresholds_; | 127 std::multiset<base::Time> keep_fresh_until_thresholds_; |
| 126 | 128 |
| 127 DISALLOW_COPY_AND_ASSIGN(FacetManager); | 129 DISALLOW_COPY_AND_ASSIGN(FacetManager); |
| 128 }; | 130 }; |
| 129 | 131 |
| 130 } // namespace password_manager | 132 } // namespace password_manager |
| 131 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FACET_MANAGER_H_ | 133 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FACET_MANAGER_H_ |
| OLD | NEW |