OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 SafeBrowsingStore* csd_whitelist_store, | 216 SafeBrowsingStore* csd_whitelist_store, |
217 SafeBrowsingStore* download_whitelist_store); | 217 SafeBrowsingStore* download_whitelist_store); |
218 | 218 |
219 // Create a database with a browse store. This is a legacy interface that | 219 // Create a database with a browse store. This is a legacy interface that |
220 // useds Sqlite. | 220 // useds Sqlite. |
221 SafeBrowsingDatabaseNew(); | 221 SafeBrowsingDatabaseNew(); |
222 | 222 |
223 virtual ~SafeBrowsingDatabaseNew(); | 223 virtual ~SafeBrowsingDatabaseNew(); |
224 | 224 |
225 // Implement SafeBrowsingDatabase interface. | 225 // Implement SafeBrowsingDatabase interface. |
226 virtual void Init(const FilePath& filename); | 226 virtual void Init(const FilePath& filename) OVERRIDE; |
227 virtual bool ResetDatabase(); | 227 virtual bool ResetDatabase() OVERRIDE; |
228 virtual bool ContainsBrowseUrl(const GURL& url, | 228 virtual bool ContainsBrowseUrl(const GURL& url, |
229 std::string* matching_list, | 229 std::string* matching_list, |
230 std::vector<SBPrefix>* prefix_hits, | 230 std::vector<SBPrefix>* prefix_hits, |
231 std::vector<SBFullHashResult>* full_hits, | 231 std::vector<SBFullHashResult>* full_hits, |
232 base::Time last_update); | 232 base::Time last_update) OVERRIDE; |
233 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, | 233 virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, |
234 std::vector<SBPrefix>* prefix_hits); | 234 std::vector<SBPrefix>* prefix_hits) OVERRIDE; |
235 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix); | 235 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix) OVERRIDE; |
236 virtual bool ContainsCsdWhitelistedUrl(const GURL& url); | 236 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) OVERRIDE; |
237 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url); | 237 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) OVERRIDE; |
238 virtual bool ContainsDownloadWhitelistedString(const std::string& str); | 238 virtual bool ContainsDownloadWhitelistedString( |
239 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists); | 239 const std::string& str) OVERRIDE; |
| 240 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) OVERRIDE; |
240 virtual void InsertChunks(const std::string& list_name, | 241 virtual void InsertChunks(const std::string& list_name, |
241 const SBChunkList& chunks); | 242 const SBChunkList& chunks) OVERRIDE; |
242 virtual void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes); | 243 virtual void DeleteChunks( |
243 virtual void UpdateFinished(bool update_succeeded); | 244 const std::vector<SBChunkDelete>& chunk_deletes) OVERRIDE; |
244 virtual void CacheHashResults(const std::vector<SBPrefix>& prefixes, | 245 virtual void UpdateFinished(bool update_succeeded) OVERRIDE; |
245 const std::vector<SBFullHashResult>& full_hits); | 246 virtual void CacheHashResults( |
| 247 const std::vector<SBPrefix>& prefixes, |
| 248 const std::vector<SBFullHashResult>& full_hits) OVERRIDE; |
246 | 249 |
247 private: | 250 private: |
248 friend class SafeBrowsingDatabaseTest; | 251 friend class SafeBrowsingDatabaseTest; |
249 FRIEND_TEST(SafeBrowsingDatabaseTest, HashCaching); | 252 FRIEND_TEST(SafeBrowsingDatabaseTest, HashCaching); |
250 | 253 |
251 // A SafeBrowsing whitelist contains a list of whitelisted full-hashes (stored | 254 // A SafeBrowsing whitelist contains a list of whitelisted full-hashes (stored |
252 // in a sorted vector) as well as a boolean flag indicating whether all | 255 // in a sorted vector) as well as a boolean flag indicating whether all |
253 // lookups in the whitelist should be considered matches for safety. | 256 // lookups in the whitelist should be considered matches for safety. |
254 typedef std::pair<std::vector<SBFullHash>, bool> SBWhitelist; | 257 typedef std::pair<std::vector<SBFullHash>, bool> SBWhitelist; |
255 | 258 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 375 |
373 // Set to true if any chunks are added or deleted during an update. | 376 // Set to true if any chunks are added or deleted during an update. |
374 // Used to optimize away database update. | 377 // Used to optimize away database update. |
375 bool change_detected_; | 378 bool change_detected_; |
376 | 379 |
377 // Used to check if a prefix was in the database. | 380 // Used to check if a prefix was in the database. |
378 scoped_ptr<safe_browsing::PrefixSet> prefix_set_; | 381 scoped_ptr<safe_browsing::PrefixSet> prefix_set_; |
379 }; | 382 }; |
380 | 383 |
381 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ | 384 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ |
OLD | NEW |