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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, | 50 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, |
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 std::unordered_set<UpdateListIdentifier> GetStoresForFullHashRequests() | |
Nathan Parker
2016/09/15 21:12:54
protected as well
vakh (use Gerrit instead)
2016/09/15 21:33:37
Done.
| |
61 override; | |
60 | 62 |
61 private: | 63 private: |
62 friend class V4LocalDatabaseManagerTest; | 64 friend class V4LocalDatabaseManagerTest; |
63 void SetTaskRunnerForTest( | 65 void SetTaskRunnerForTest( |
64 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | 66 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
65 task_runner_ = task_runner; | 67 task_runner_ = task_runner; |
66 } | 68 } |
67 | 69 |
68 ~V4LocalDatabaseManager() override; | 70 ~V4LocalDatabaseManager() override; |
69 | 71 |
(...skipping 20 matching lines...) Expand all Loading... | |
90 | 92 |
91 // Whether the service is running. | 93 // Whether the service is running. |
92 bool enabled_; | 94 bool enabled_; |
93 | 95 |
94 // Stores the current status of the lists to download from the SafeBrowsing | 96 // Stores the current status of the lists to download from the SafeBrowsing |
95 // servers. | 97 // servers. |
96 // TODO(vakh): current_list_states_ doesn't really belong here. | 98 // TODO(vakh): current_list_states_ doesn't really belong here. |
97 // It should come through the database, from the various V4Stores. | 99 // It should come through the database, from the various V4Stores. |
98 base::hash_map<UpdateListIdentifier, std::string> current_list_states_; | 100 base::hash_map<UpdateListIdentifier, std::string> current_list_states_; |
99 | 101 |
102 // The list of stores to manage (for hash prefixes and full hashes), along | |
103 // with the corresponding filename on disk for each of them. | |
104 StoreIdAndFileNames store_id_file_names_; | |
105 | |
100 // The protocol manager that downloads the hash prefix updates. | 106 // The protocol manager that downloads the hash prefix updates. |
101 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; | 107 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; |
102 | 108 |
103 // The database that manages the stores containing the hash prefix updates. | 109 // The database that manages the stores containing the hash prefix updates. |
104 // All writes to this variable must happen on the IO thread only. | 110 // All writes to this variable must happen on the IO thread only. |
105 std::unique_ptr<V4Database> v4_database_; | 111 std::unique_ptr<V4Database> v4_database_; |
106 | 112 |
107 // Called when the V4Database has finished applying the latest update and is | 113 // Called when the V4Database has finished applying the latest update and is |
108 // ready to process next update. | 114 // ready to process next update. |
109 DatabaseUpdatedCallback db_updated_callback_; | 115 DatabaseUpdatedCallback db_updated_callback_; |
110 | 116 |
111 // The sequenced task runner for running safe browsing database operations. | 117 // The sequenced task runner for running safe browsing database operations. |
112 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 118 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
113 | 119 |
114 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; | 120 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; |
115 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); | 121 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); |
116 }; // class V4LocalDatabaseManager | 122 }; // class V4LocalDatabaseManager |
117 | 123 |
118 } // namespace safe_browsing | 124 } // namespace safe_browsing |
119 | 125 |
120 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 126 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
OLD | NEW |