OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 16 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
17 | 17 |
18 namespace safe_browsing { | |
19 class PrefixSetBuilder; | |
20 }; | |
21 | |
22 namespace base { | 18 namespace base { |
23 class FilePath; | 19 class FilePath; |
24 } | 20 } |
25 | 21 |
| 22 namespace safe_browsing { |
| 23 |
| 24 class PrefixSetBuilder; |
| 25 |
26 // SafeBrowsingStore provides a storage abstraction for the | 26 // SafeBrowsingStore provides a storage abstraction for the |
27 // safe-browsing data used to build the bloom filter. The items | 27 // safe-browsing data used to build the bloom filter. The items |
28 // stored are: | 28 // stored are: |
29 // The set of add and sub chunks seen. | 29 // The set of add and sub chunks seen. |
30 // List of SBAddPrefix (chunk_id and SBPrefix). | 30 // List of SBAddPrefix (chunk_id and SBPrefix). |
31 // List of SBSubPrefix (chunk_id and the target SBAddPrefix). | 31 // List of SBSubPrefix (chunk_id and the target SBAddPrefix). |
32 // List of SBAddFullHash (SBAddPrefix, time received and an SBFullHash). | 32 // List of SBAddFullHash (SBAddPrefix, time received and an SBFullHash). |
33 // List of SBSubFullHash (chunk_id, target SBAddPrefix, and an SBFullHash). | 33 // List of SBSubFullHash (chunk_id, target SBAddPrefix, and an SBFullHash). |
34 // | 34 // |
35 // The store is geared towards updating the data, not runtime access | 35 // The store is geared towards updating the data, not runtime access |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // NOTE(shess): When storage was SQLite, there was no guarantee that | 211 // NOTE(shess): When storage was SQLite, there was no guarantee that |
212 // a structurally sound database actually contained valid data, | 212 // a structurally sound database actually contained valid data, |
213 // whereas SafeBrowsingStoreFile checksums the data. For now, this | 213 // whereas SafeBrowsingStoreFile checksums the data. For now, this |
214 // distinction doesn't matter. | 214 // distinction doesn't matter. |
215 virtual bool CheckValidity() = 0; | 215 virtual bool CheckValidity() = 0; |
216 | 216 |
217 // Pass the collected chunks through SBPRocessSubs() and commit to | 217 // Pass the collected chunks through SBPRocessSubs() and commit to |
218 // permanent storage. The resulting add prefixes and hashes will be | 218 // permanent storage. The resulting add prefixes and hashes will be |
219 // stored in |add_prefixes_result| and |add_full_hashes_result|. | 219 // stored in |add_prefixes_result| and |add_full_hashes_result|. |
220 virtual bool FinishUpdate( | 220 virtual bool FinishUpdate( |
221 safe_browsing::PrefixSetBuilder* builder, | 221 PrefixSetBuilder* builder, |
222 std::vector<SBAddFullHash>* add_full_hashes_result) = 0; | 222 std::vector<SBAddFullHash>* add_full_hashes_result) = 0; |
223 | 223 |
224 // Cancel the update in process and remove any temporary disk | 224 // Cancel the update in process and remove any temporary disk |
225 // storage, leaving the original data unmodified. | 225 // storage, leaving the original data unmodified. |
226 virtual bool CancelUpdate() = 0; | 226 virtual bool CancelUpdate() = 0; |
227 | 227 |
228 private: | 228 private: |
229 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStore); | 229 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStore); |
230 }; | 230 }; |
231 | 231 |
| 232 } // namespace safe_browsing |
| 233 |
232 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_ | 234 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_ |
OLD | NEW |