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_FILE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 int32 add_chunk_id, SBPrefix prefix) OVERRIDE; | 130 int32 add_chunk_id, SBPrefix prefix) OVERRIDE; |
131 virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id, | 131 virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id, |
132 const SBFullHash& full_hash) OVERRIDE; | 132 const SBFullHash& full_hash) OVERRIDE; |
133 virtual bool FinishChunk() OVERRIDE; | 133 virtual bool FinishChunk() OVERRIDE; |
134 | 134 |
135 virtual bool BeginUpdate() OVERRIDE; | 135 virtual bool BeginUpdate() OVERRIDE; |
136 // Store updates with pending add full hashes in file store and | 136 // Store updates with pending add full hashes in file store and |
137 // return |add_prefixes_result| and |add_full_hashes_result|. | 137 // return |add_prefixes_result| and |add_full_hashes_result|. |
138 virtual bool FinishUpdate( | 138 virtual bool FinishUpdate( |
139 const std::vector<SBAddFullHash>& pending_adds, | 139 const std::vector<SBAddFullHash>& pending_adds, |
140 const std::set<SBPrefix>& prefix_misses, | |
141 SBAddPrefixes* add_prefixes_result, | 140 SBAddPrefixes* add_prefixes_result, |
142 std::vector<SBAddFullHash>* add_full_hashes_result) OVERRIDE; | 141 std::vector<SBAddFullHash>* add_full_hashes_result) OVERRIDE; |
143 virtual bool CancelUpdate() OVERRIDE; | 142 virtual bool CancelUpdate() OVERRIDE; |
144 | 143 |
145 virtual void SetAddChunk(int32 chunk_id) OVERRIDE; | 144 virtual void SetAddChunk(int32 chunk_id) OVERRIDE; |
146 virtual bool CheckAddChunk(int32 chunk_id) OVERRIDE; | 145 virtual bool CheckAddChunk(int32 chunk_id) OVERRIDE; |
147 virtual void GetAddChunks(std::vector<int32>* out) OVERRIDE; | 146 virtual void GetAddChunks(std::vector<int32>* out) OVERRIDE; |
148 virtual void SetSubChunk(int32 chunk_id) OVERRIDE; | 147 virtual void SetSubChunk(int32 chunk_id) OVERRIDE; |
149 virtual bool CheckSubChunk(int32 chunk_id) OVERRIDE; | 148 virtual bool CheckSubChunk(int32 chunk_id) OVERRIDE; |
150 virtual void GetSubChunks(std::vector<int32>* out) OVERRIDE; | 149 virtual void GetSubChunks(std::vector<int32>* out) OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
162 const base::FilePath& filename) { | 161 const base::FilePath& filename) { |
163 return base::FilePath(filename.value() + FILE_PATH_LITERAL("_new")); | 162 return base::FilePath(filename.value() + FILE_PATH_LITERAL("_new")); |
164 } | 163 } |
165 | 164 |
166 // Delete any on-disk files, including the permanent storage. | 165 // Delete any on-disk files, including the permanent storage. |
167 static bool DeleteStore(const base::FilePath& basename); | 166 static bool DeleteStore(const base::FilePath& basename); |
168 | 167 |
169 private: | 168 private: |
170 // Update store file with pending full hashes. | 169 // Update store file with pending full hashes. |
171 virtual bool DoUpdate(const std::vector<SBAddFullHash>& pending_adds, | 170 virtual bool DoUpdate(const std::vector<SBAddFullHash>& pending_adds, |
172 const std::set<SBPrefix>& prefix_misses, | |
173 SBAddPrefixes* add_prefixes_result, | 171 SBAddPrefixes* add_prefixes_result, |
174 std::vector<SBAddFullHash>* add_full_hashes_result); | 172 std::vector<SBAddFullHash>* add_full_hashes_result); |
175 | 173 |
176 // Enumerate different format-change events for histogramming | 174 // Enumerate different format-change events for histogramming |
177 // purposes. DO NOT CHANGE THE ORDERING OF THESE VALUES. | 175 // purposes. DO NOT CHANGE THE ORDERING OF THESE VALUES. |
178 // TODO(shess): Remove this once the format change is complete. | 176 // TODO(shess): Remove this once the format change is complete. |
179 enum FormatEventType { | 177 enum FormatEventType { |
180 // Corruption detected, broken down by file format. | 178 // Corruption detected, broken down by file format. |
181 FORMAT_EVENT_FILE_CORRUPT, | 179 FORMAT_EVENT_FILE_CORRUPT, |
182 FORMAT_EVENT_SQLITE_CORRUPT, // Obsolete | 180 FORMAT_EVENT_SQLITE_CORRUPT, // Obsolete |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 287 |
290 // Tracks whether corruption has already been seen in the current | 288 // Tracks whether corruption has already been seen in the current |
291 // update, so that only one instance is recorded in the stats. | 289 // update, so that only one instance is recorded in the stats. |
292 // TODO(shess): Remove with format-migration support. | 290 // TODO(shess): Remove with format-migration support. |
293 bool corruption_seen_; | 291 bool corruption_seen_; |
294 | 292 |
295 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStoreFile); | 293 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStoreFile); |
296 }; | 294 }; |
297 | 295 |
298 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_ | 296 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_ |
OLD | NEW |