| 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "components/safe_browsing_db/database_manager.h" | 13 #include "components/safe_browsing_db/database_manager.h" |
| 14 #include "components/safe_browsing_db/hit_report.h" | 14 #include "components/safe_browsing_db/hit_report.h" |
| 15 #include "components/safe_browsing_db/v4_database.h" | |
| 16 #include "components/safe_browsing_db/v4_protocol_manager_util.h" | 15 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
| 17 #include "components/safe_browsing_db/v4_update_protocol_manager.h" | 16 #include "components/safe_browsing_db/v4_update_protocol_manager.h" |
| 18 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 19 | 18 |
| 20 using content::ResourceType; | 19 using content::ResourceType; |
| 21 | 20 |
| 22 namespace safe_browsing { | 21 namespace safe_browsing { |
| 23 | 22 |
| 24 // Manages the local, on-disk database of updates downloaded from the | 23 // Manages the local, on-disk database of updates downloaded from the |
| 25 // SafeBrowsing service and interfaces with the protocol manager. | 24 // SafeBrowsing service and interfaces with the protocol manager. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ~V4LocalDatabaseManager() override; | 62 ~V4LocalDatabaseManager() override; |
| 64 | 63 |
| 65 // The callback called each time the protocol manager downloads updates | 64 // The callback called each time the protocol manager downloads updates |
| 66 // successfully. | 65 // successfully. |
| 67 void UpdateRequestCompleted(const std::vector<ListUpdateResponse>& responses); | 66 void UpdateRequestCompleted(const std::vector<ListUpdateResponse>& responses); |
| 68 | 67 |
| 69 bool enabled_; | 68 bool enabled_; |
| 70 | 69 |
| 71 // Stores the current status of the lists to download from the SafeBrowsing | 70 // Stores the current status of the lists to download from the SafeBrowsing |
| 72 // servers. | 71 // servers. |
| 73 // TODO(vakh): current_list_states_ doesn't really belong here. | |
| 74 // It should come through the database, from the various V4Stores. | |
| 75 base::hash_map<UpdateListIdentifier, std::string> current_list_states_; | 72 base::hash_map<UpdateListIdentifier, std::string> current_list_states_; |
| 76 | 73 |
| 77 // The protocol manager that downloads the hash prefix updates. | 74 // The protocol manager that downloads the hash prefix updates. |
| 78 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; | 75 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; |
| 79 | 76 |
| 80 // The database that manages the stores containing the hash prefix updates. | |
| 81 std::unique_ptr<V4Database> v4_database_; | |
| 82 | |
| 83 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; | 77 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; |
| 84 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); | 78 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); |
| 85 }; // class V4LocalDatabaseManager | 79 }; // class V4LocalDatabaseManager |
| 86 | 80 |
| 87 } // namespace safe_browsing | 81 } // namespace safe_browsing |
| 88 | 82 |
| 89 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 83 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
| OLD | NEW |