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 <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 15 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
16 | 16 |
| 17 namespace base { |
17 class FilePath; | 18 class FilePath; |
| 19 } |
18 | 20 |
19 // SafeBrowsingStore provides a storage abstraction for the | 21 // SafeBrowsingStore provides a storage abstraction for the |
20 // safe-browsing data used to build the bloom filter. The items | 22 // safe-browsing data used to build the bloom filter. The items |
21 // stored are: | 23 // stored are: |
22 // The set of add and sub chunks seen. | 24 // The set of add and sub chunks seen. |
23 // List of SBAddPrefix (chunk_id and SBPrefix). | 25 // List of SBAddPrefix (chunk_id and SBPrefix). |
24 // List of SBSubPrefix (chunk_id and the target SBAddPrefix). | 26 // List of SBSubPrefix (chunk_id and the target SBAddPrefix). |
25 // List of SBAddFullHash (SBAddPrefix, time received and an SBFullHash). | 27 // List of SBAddFullHash (SBAddPrefix, time received and an SBFullHash). |
26 // List of SBSubFullHash (chunk_id, target SBAddPrefix, and an SBFullHash). | 28 // List of SBSubFullHash (chunk_id, target SBAddPrefix, and an SBFullHash). |
27 // | 29 // |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 public: | 158 public: |
157 SafeBrowsingStore() {} | 159 SafeBrowsingStore() {} |
158 virtual ~SafeBrowsingStore() {} | 160 virtual ~SafeBrowsingStore() {} |
159 | 161 |
160 // Sets up the information for later use, but does not necessarily | 162 // Sets up the information for later use, but does not necessarily |
161 // check whether the underlying file exists, or is valid. If | 163 // check whether the underlying file exists, or is valid. If |
162 // |curruption_callback| is non-NULL it will be called if corruption | 164 // |curruption_callback| is non-NULL it will be called if corruption |
163 // is detected, which could happen as part of any call other than | 165 // is detected, which could happen as part of any call other than |
164 // Delete(). The appropriate action is to use Delete() to clear the | 166 // Delete(). The appropriate action is to use Delete() to clear the |
165 // store. | 167 // store. |
166 virtual void Init(const FilePath& filename, | 168 virtual void Init(const base::FilePath& filename, |
167 const base::Closure& corruption_callback) = 0; | 169 const base::Closure& corruption_callback) = 0; |
168 | 170 |
169 // Deletes the files which back the store, returning true if | 171 // Deletes the files which back the store, returning true if |
170 // successful. | 172 // successful. |
171 virtual bool Delete() = 0; | 173 virtual bool Delete() = 0; |
172 | 174 |
173 // Get all Add prefixes out from the store. | 175 // Get all Add prefixes out from the store. |
174 virtual bool GetAddPrefixes(SBAddPrefixes* add_prefixes) = 0; | 176 virtual bool GetAddPrefixes(SBAddPrefixes* add_prefixes) = 0; |
175 | 177 |
176 // Get all add full-length hashes. | 178 // Get all add full-length hashes. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 243 |
242 // Cancel the update in process and remove any temporary disk | 244 // Cancel the update in process and remove any temporary disk |
243 // storage, leaving the original data unmodified. | 245 // storage, leaving the original data unmodified. |
244 virtual bool CancelUpdate() = 0; | 246 virtual bool CancelUpdate() = 0; |
245 | 247 |
246 private: | 248 private: |
247 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStore); | 249 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStore); |
248 }; | 250 }; |
249 | 251 |
250 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_ | 252 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_ |
OLD | NEW |