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

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

Issue 947563002: Add prefetch support to AffiliationBackend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment phrasing. 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 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_AFFILIATION_BACKEND_H_ 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void GetAffiliations( 63 void GetAffiliations(
64 const FacetURI& facet_uri, 64 const FacetURI& facet_uri,
65 bool cached_only, 65 bool cached_only,
66 const AffiliationService::ResultCallback& callback, 66 const AffiliationService::ResultCallback& callback,
67 const scoped_refptr<base::TaskRunner>& callback_task_runner); 67 const scoped_refptr<base::TaskRunner>& callback_task_runner);
68 void Prefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until); 68 void Prefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until);
69 void CancelPrefetch(const FacetURI& facet_uri, 69 void CancelPrefetch(const FacetURI& facet_uri,
70 const base::Time& keep_fresh_until); 70 const base::Time& keep_fresh_until);
71 void TrimCache(); 71 void TrimCache();
72 72
73 // Used only for testing.
74 size_t facet_manager_count() { return facet_managers_.size(); }
75
73 private: 76 private:
77 // Retrieves the FacetManager corresponding to |facet_uri|, creating it and
78 // storing it into |facet_managers_| if it did not exist.
79 FacetManager* GetOrCreateFacetManager(const FacetURI& facet_uri);
80
74 // Collects facet URIs that require fetching and issues a network request 81 // Collects facet URIs that require fetching and issues a network request
75 // against the Affiliation API to fetch corresponding affiliation information. 82 // against the Affiliation API to fetch corresponding affiliation information.
76 void SendNetworkRequest(); 83 void SendNetworkRequest();
77 84
85 // Scheduled by RequestNotificationAtTime() to be called back at times when a
86 // FacetManager needs to be notified.
87 void OnSendNotification(const FacetURI& facet_uri);
88
78 // FacetManagerHost: 89 // FacetManagerHost:
79 base::Time GetCurrentTime() override;
80 base::Time ReadLastUpdateTimeFromDatabase(const FacetURI& facet_uri) override;
81 bool ReadAffiliationsFromDatabase( 90 bool ReadAffiliationsFromDatabase(
82 const FacetURI& facet_uri, 91 const FacetURI& facet_uri,
83 AffiliatedFacetsWithUpdateTime* affiliations) override; 92 AffiliatedFacetsWithUpdateTime* affiliations) override;
84 void SignalNeedNetworkRequest() override; 93 void SignalNeedNetworkRequest() override;
94 void RequestNotificationAtTime(const FacetURI& facet_uri,
95 base::Time time) override;
85 96
86 // AffiliationFetcherDelegate: 97 // AffiliationFetcherDelegate:
87 void OnFetchSucceeded( 98 void OnFetchSucceeded(
88 scoped_ptr<AffiliationFetcherDelegate::Result> result) override; 99 scoped_ptr<AffiliationFetcherDelegate::Result> result) override;
89 void OnFetchFailed() override; 100 void OnFetchFailed() override;
90 void OnMalformedResponse() override; 101 void OnMalformedResponse() override;
91 102
92 // Created in Initialize(), and ensures that all subsequent methods are called 103 // Created in Initialize(), and ensures that all subsequent methods are called
93 // on the same thread. 104 // on the same thread.
94 scoped_ptr<base::ThreadChecker> thread_checker_; 105 scoped_ptr<base::ThreadChecker> thread_checker_;
(...skipping 11 matching lines...) Expand all
106 base::ScopedPtrHashMap<FacetURI, FacetManager> facet_managers_; 117 base::ScopedPtrHashMap<FacetURI, FacetManager> facet_managers_;
107 118
108 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_; 119 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_;
109 120
110 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend); 121 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend);
111 }; 122 };
112 123
113 } // namespace password_manager 124 } // namespace password_manager
114 125
115 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ 126 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698