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

Side by Side Diff: chrome/browser/safe_browsing/database_manager.h

Issue 280013002: [safe browsing] Switch to independent cache lifetimes for gethash items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: const that lifetime Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/database_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // The Safe Browsing service is responsible for downloading anti-phishing and 5 // The Safe Browsing service is responsible for downloading anti-phishing and
6 // anti-malware tables and checking urls against them. 6 // anti-malware tables and checking urls against them.
7 7
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ 9 #define CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 // Check if the CSD malware IP matching kill switch is turned on. 173 // Check if the CSD malware IP matching kill switch is turned on.
174 virtual bool IsMalwareKillSwitchOn(); 174 virtual bool IsMalwareKillSwitchOn();
175 175
176 // Called on the IO thread to cancel a pending check if the result is no 176 // Called on the IO thread to cancel a pending check if the result is no
177 // longer needed. 177 // longer needed.
178 void CancelCheck(Client* client); 178 void CancelCheck(Client* client);
179 179
180 // Called on the IO thread when the SafeBrowsingProtocolManager has received 180 // Called on the IO thread when the SafeBrowsingProtocolManager has received
181 // the full hash results for prefix hits detected in the database. 181 // the full hash results for prefix hits detected in the database.
182 void HandleGetHashResults( 182 void HandleGetHashResults(SafeBrowsingCheck* check,
183 SafeBrowsingCheck* check, 183 const std::vector<SBFullHashResult>& full_hashes,
184 const std::vector<SBFullHashResult>& full_hashes, 184 const base::TimeDelta& cache_lifetime);
185 bool can_cache);
186 185
187 // Log the user perceived delay caused by SafeBrowsing. This delay is the time 186 // Log the user perceived delay caused by SafeBrowsing. This delay is the time
188 // delta starting from when we would have started reading data from the 187 // delta starting from when we would have started reading data from the
189 // network, and ending when the SafeBrowsing check completes indicating that 188 // network, and ending when the SafeBrowsing check completes indicating that
190 // the current page is 'safe'. 189 // the current page is 'safe'.
191 void LogPauseDelay(base::TimeDelta time); 190 void LogPauseDelay(base::TimeDelta time);
192 191
193 // Called to initialize objects that are used on the io_thread. This may be 192 // Called to initialize objects that are used on the io_thread. This may be
194 // called multiple times during the life of the DatabaseManager. Should be 193 // called multiple times during the life of the DatabaseManager. Should be
195 // called on IO thread. 194 // called on IO thread.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 280
282 void DatabaseUpdateFinished(bool update_succeeded); 281 void DatabaseUpdateFinished(bool update_succeeded);
283 282
284 // Called on the db thread to close the database. See CloseDatabase(). 283 // Called on the db thread to close the database. See CloseDatabase().
285 void OnCloseDatabase(); 284 void OnCloseDatabase();
286 285
287 // Runs on the db thread to reset the database. We assume that resetting the 286 // Runs on the db thread to reset the database. We assume that resetting the
288 // database is a synchronous operation. 287 // database is a synchronous operation.
289 void OnResetDatabase(); 288 void OnResetDatabase();
290 289
291 // Store in-memory the GetHash response. Runs on the database thread.
292 void CacheHashResults(const std::vector<SBPrefix>& prefixes,
293 const std::vector<SBFullHashResult>& full_hashes);
294
295 // Internal worker function for processing full hashes. 290 // Internal worker function for processing full hashes.
296 void OnHandleGetHashResults(SafeBrowsingCheck* check, 291 void OnHandleGetHashResults(SafeBrowsingCheck* check,
297 const std::vector<SBFullHashResult>& full_hashes); 292 const std::vector<SBFullHashResult>& full_hashes);
298 293
299 // Run one check against |full_hashes|. Returns |true| if the check 294 // Run one check against |full_hashes|. Returns |true| if the check
300 // finds a match in |full_hashes|. 295 // finds a match in |full_hashes|.
301 bool HandleOneCheck(SafeBrowsingCheck* check, 296 bool HandleOneCheck(SafeBrowsingCheck* check,
302 const std::vector<SBFullHashResult>& full_hashes); 297 const std::vector<SBFullHashResult>& full_hashes);
303 298
304 // Invoked by CheckDownloadUrl. It checks the download URL on 299 // Invoked by CheckDownloadUrl. It checks the download URL on
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 387
393 std::deque<QueuedCheck> queued_checks_; 388 std::deque<QueuedCheck> queued_checks_;
394 389
395 // Timeout to use for safe browsing checks. 390 // Timeout to use for safe browsing checks.
396 base::TimeDelta check_timeout_; 391 base::TimeDelta check_timeout_;
397 392
398 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager); 393 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager);
399 }; 394 };
400 395
401 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_ 396 #endif // CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698