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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 Client* client) override; | 51 Client* client) override; |
52 bool MatchCsdWhitelistUrl(const GURL& url) override; | 52 bool MatchCsdWhitelistUrl(const GURL& url) override; |
53 bool MatchMalwareIP(const std::string& ip_address) override; | 53 bool MatchMalwareIP(const std::string& ip_address) override; |
54 bool MatchDownloadWhitelistUrl(const GURL& url) override; | 54 bool MatchDownloadWhitelistUrl(const GURL& url) override; |
55 bool MatchDownloadWhitelistString(const std::string& str) override; | 55 bool MatchDownloadWhitelistString(const std::string& str) override; |
56 bool MatchModuleWhitelistString(const std::string& str) override; | 56 bool MatchModuleWhitelistString(const std::string& str) override; |
57 bool CheckResourceUrl(const GURL& url, Client* client) override; | 57 bool CheckResourceUrl(const GURL& url, Client* client) override; |
58 bool IsMalwareKillSwitchOn() override; | 58 bool IsMalwareKillSwitchOn() override; |
59 bool IsCsdWhitelistKillSwitchOn() override; | 59 bool IsCsdWhitelistKillSwitchOn() override; |
60 | 60 |
| 61 protected: |
| 62 std::unordered_set<UpdateListIdentifier> GetStoresForFullHashRequests() |
| 63 override; |
| 64 |
61 private: | 65 private: |
62 friend class V4LocalDatabaseManagerTest; | 66 friend class V4LocalDatabaseManagerTest; |
63 void SetTaskRunnerForTest( | 67 void SetTaskRunnerForTest( |
64 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | 68 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
65 task_runner_ = task_runner; | 69 task_runner_ = task_runner; |
66 } | 70 } |
67 | 71 |
68 ~V4LocalDatabaseManager() override; | 72 ~V4LocalDatabaseManager() override; |
69 | 73 |
70 // The callback called each time the protocol manager downloads updates | 74 // The callback called each time the protocol manager downloads updates |
(...skipping 19 matching lines...) Expand all Loading... |
90 | 94 |
91 // Whether the service is running. | 95 // Whether the service is running. |
92 bool enabled_; | 96 bool enabled_; |
93 | 97 |
94 // Stores the current status of the lists to download from the SafeBrowsing | 98 // Stores the current status of the lists to download from the SafeBrowsing |
95 // servers. | 99 // servers. |
96 // TODO(vakh): current_list_states_ doesn't really belong here. | 100 // TODO(vakh): current_list_states_ doesn't really belong here. |
97 // It should come through the database, from the various V4Stores. | 101 // It should come through the database, from the various V4Stores. |
98 base::hash_map<UpdateListIdentifier, std::string> current_list_states_; | 102 base::hash_map<UpdateListIdentifier, std::string> current_list_states_; |
99 | 103 |
| 104 // The list of stores to manage (for hash prefixes and full hashes), along |
| 105 // with the corresponding filename on disk for each of them. |
| 106 StoreIdAndFileNames store_id_file_names_; |
| 107 |
100 // The protocol manager that downloads the hash prefix updates. | 108 // The protocol manager that downloads the hash prefix updates. |
101 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; | 109 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; |
102 | 110 |
103 // The database that manages the stores containing the hash prefix updates. | 111 // The database that manages the stores containing the hash prefix updates. |
104 // All writes to this variable must happen on the IO thread only. | 112 // All writes to this variable must happen on the IO thread only. |
105 std::unique_ptr<V4Database> v4_database_; | 113 std::unique_ptr<V4Database> v4_database_; |
106 | 114 |
107 // Called when the V4Database has finished applying the latest update and is | 115 // Called when the V4Database has finished applying the latest update and is |
108 // ready to process next update. | 116 // ready to process next update. |
109 DatabaseUpdatedCallback db_updated_callback_; | 117 DatabaseUpdatedCallback db_updated_callback_; |
110 | 118 |
111 // The sequenced task runner for running safe browsing database operations. | 119 // The sequenced task runner for running safe browsing database operations. |
112 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 120 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
113 | 121 |
114 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; | 122 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; |
115 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); | 123 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); |
116 }; // class V4LocalDatabaseManager | 124 }; // class V4LocalDatabaseManager |
117 | 125 |
118 } // namespace safe_browsing | 126 } // namespace safe_browsing |
119 | 127 |
120 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 128 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
OLD | NEW |