| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
| 7 | 7 |
| 8 // A class that provides the interface between the SafeBrowsing protocol manager | 8 // A class that provides the interface between the SafeBrowsing protocol manager |
| 9 // and database that holds the downloaded updates. | 9 // and database that holds the downloaded updates. |
| 10 | 10 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // Returns the SBThreatType for a given ListIdentifier. | 196 // Returns the SBThreatType for a given ListIdentifier. |
| 197 SBThreatType GetSBThreatTypeForList(const ListIdentifier& list_id); | 197 SBThreatType GetSBThreatTypeForList(const ListIdentifier& list_id); |
| 198 | 198 |
| 199 // Queues the check for async response if the database isn't ready yet. | 199 // Queues the check for async response if the database isn't ready yet. |
| 200 // If the database is ready, checks the database for prefix matches and | 200 // If the database is ready, checks the database for prefix matches and |
| 201 // returns true immediately if there's no match. If a match is found, it | 201 // returns true immediately if there's no match. If a match is found, it |
| 202 // schedules a task to perform full hash check and returns false. | 202 // schedules a task to perform full hash check and returns false. |
| 203 bool HandleCheck(std::unique_ptr<PendingCheck> check); | 203 bool HandleCheck(std::unique_ptr<PendingCheck> check); |
| 204 | 204 |
| 205 // Checks |stores_to_check| in database synchronously for hash prefixes | 205 // Checks |stores_to_check| in database synchronously for hash prefixes |
| 206 // matching |hash|. Returns false if the database isn't ready or if there's no | 206 // matching |hash|. Returns true if there's a match; false otherwise. This is |
| 207 // match; true otherwise. This is used for lists that have full hash | 207 // used for lists that have full hash information in the database. |
| 208 // information in the database. | |
| 209 bool HandleHashSynchronously(const FullHash& hash, | 208 bool HandleHashSynchronously(const FullHash& hash, |
| 210 const StoresToCheck& stores_to_check); | 209 const StoresToCheck& stores_to_check); |
| 211 | 210 |
| 212 // Checks |stores_to_check| in database synchronously for hash prefixes | 211 // Checks |stores_to_check| in database synchronously for hash prefixes |
| 213 // matching the full hashes for |url|. See |HandleHashSynchronously| for | 212 // matching the full hashes for |url|. See |HandleHashSynchronously| for |
| 214 // details. | 213 // details. |
| 215 bool HandleUrlSynchronously(const GURL& url, | 214 bool HandleUrlSynchronously(const GURL& url, |
| 216 const StoresToCheck& stores_to_check); | 215 const StoresToCheck& stores_to_check); |
| 217 | 216 |
| 218 // Called when the |v4_get_hash_protocol_manager_| has the full hash response | 217 // Called when the |v4_get_hash_protocol_manager_| has the full hash response |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 287 |
| 289 base::WeakPtrFactory<V4LocalDatabaseManager> weak_factory_; | 288 base::WeakPtrFactory<V4LocalDatabaseManager> weak_factory_; |
| 290 | 289 |
| 291 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; | 290 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; |
| 292 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); | 291 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); |
| 293 }; // class V4LocalDatabaseManager | 292 }; // class V4LocalDatabaseManager |
| 294 | 293 |
| 295 } // namespace safe_browsing | 294 } // namespace safe_browsing |
| 296 | 295 |
| 297 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 296 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
| OLD | NEW |