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