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

Side by Side Diff: components/safe_browsing/password_protection/password_protection_service.h

Issue 2870193002: Clean up expired verdicts at shutdown (Closed)
Patch Set: nit Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE _H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE _H_
6 #define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE _H_ 6 #define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE _H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 LoginReputationClientResponse::VerdictType GetCachedVerdict( 64 LoginReputationClientResponse::VerdictType GetCachedVerdict(
65 const GURL& url, 65 const GURL& url,
66 LoginReputationClientResponse* out_response); 66 LoginReputationClientResponse* out_response);
67 67
68 // Stores |verdict| in |settings| based on |url|, |verdict| and 68 // Stores |verdict| in |settings| based on |url|, |verdict| and
69 // |receive_time|. 69 // |receive_time|.
70 void CacheVerdict(const GURL& url, 70 void CacheVerdict(const GURL& url,
71 LoginReputationClientResponse* verdict, 71 LoginReputationClientResponse* verdict,
72 const base::Time& receive_time); 72 const base::Time& receive_time);
73 73
74 // Removes all the expired verdicts from cache.
75 void CleanUpExpiredVerdicts();
76
74 // Creates an instance of PasswordProtectionRequest and call Start() on that 77 // Creates an instance of PasswordProtectionRequest and call Start() on that
75 // instance. This function also insert this request object in |requests_| for 78 // instance. This function also insert this request object in |requests_| for
76 // record keeping. 79 // record keeping.
77 void StartRequest(const GURL& main_frame_url, 80 void StartRequest(const GURL& main_frame_url,
78 const GURL& password_form_action, 81 const GURL& password_form_action,
79 const GURL& password_form_frame_url, 82 const GURL& password_form_frame_url,
80 LoginReputationClientRequest::TriggerType type); 83 LoginReputationClientRequest::TriggerType type);
81 84
82 virtual void MaybeStartLowReputationRequest( 85 virtual void MaybeStartLowReputationRequest(
83 const GURL& main_frame_url, 86 const GURL& main_frame_url,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 private: 146 private:
144 friend class PasswordProtectionServiceTest; 147 friend class PasswordProtectionServiceTest;
145 friend class TestPasswordProtectionService; 148 friend class TestPasswordProtectionService;
146 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 149 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
147 TestParseInvalidVerdictEntry); 150 TestParseInvalidVerdictEntry);
148 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 151 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
149 TestParseValidVerdictEntry); 152 TestParseValidVerdictEntry);
150 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 153 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
151 TestPathVariantsMatchCacheExpression); 154 TestPathVariantsMatchCacheExpression);
152 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 155 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
153 TestCleanUpCachedVerdicts); 156 TestRemoveCachedVerdictOnURLsDeleted);
157 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
158 TestCleanUpExpiredVerdict);
154 159
155 // Overridden from history::HistoryServiceObserver. 160 // Overridden from history::HistoryServiceObserver.
156 void OnURLsDeleted(history::HistoryService* history_service, 161 void OnURLsDeleted(history::HistoryService* history_service,
157 bool all_history, 162 bool all_history,
158 bool expired, 163 bool expired,
159 const history::URLRows& deleted_rows, 164 const history::URLRows& deleted_rows,
160 const std::set<GURL>& favicon_urls) override; 165 const std::set<GURL>& favicon_urls) override;
161 166
162 void HistoryServiceBeingDeleted( 167 void HistoryServiceBeingDeleted(
163 history::HistoryService* history_service) override; 168 history::HistoryService* history_service) override;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // we need CancelableTaskTracker to cancel tasks posted to IO thread. 215 // we need CancelableTaskTracker to cancel tasks posted to IO thread.
211 base::CancelableTaskTracker tracker_; 216 base::CancelableTaskTracker tracker_;
212 217
213 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; 218 base::WeakPtrFactory<PasswordProtectionService> weak_factory_;
214 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); 219 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService);
215 }; 220 };
216 221
217 } // namespace safe_browsing 222 } // namespace safe_browsing
218 223
219 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV ICE_H_ 224 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV ICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698