Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: components/safe_browsing_db/v4_store.h

Issue 2225113002: Reland: Move PVer4 related code from util.* to v4_protocol_manager_util.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor: Address nparker@'s comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/safe_browsing_db/v4_protocol_manager_util_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_STORE_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "components/safe_browsing_db/v4_protocol_manager_util.h" 12 #include "components/safe_browsing_db/v4_protocol_manager_util.h"
13 13
14 namespace safe_browsing { 14 namespace safe_browsing {
15 15
16 class V4Store; 16 class V4Store;
17 17
18 typedef base::Callback<void(std::unique_ptr<V4Store>)> 18 typedef base::Callback<void(std::unique_ptr<V4Store>)>
19 UpdatedStoreReadyCallback; 19 UpdatedStoreReadyCallback;
20 20
21 // The size of the hash prefix, in bytes. It should be between 4 to 32 (full 21 // The size of the hash prefix, in bytes. It should be between 4 to 32 (full
22 // hash). 22 // hash).
23 typedef size_t PrefixSize; 23 typedef size_t PrefixSize;
24 24
25 // A hash prefix sent by the SafeBrowsing PVer4 service.
26 typedef std::string HashPrefix;
27
28 // The sorted list of hash prefixes. 25 // The sorted list of hash prefixes.
29 typedef std::string HashPrefixes; 26 typedef std::string HashPrefixes;
30 27
31 // Stores the list of sorted hash prefixes, by size. 28 // Stores the list of sorted hash prefixes, by size.
32 // For instance: {4: ["abcd", "bcde", "cdef", "gggg"], 5: ["fffff"]} 29 // For instance: {4: ["abcd", "bcde", "cdef", "gggg"], 5: ["fffff"]}
33 typedef base::hash_map<PrefixSize, HashPrefixes> HashPrefixMap; 30 typedef base::hash_map<PrefixSize, HashPrefixes> HashPrefixMap;
34 31
35 // Stores the iterator to the last element merged from the HashPrefixMap for a 32 // Stores the iterator to the last element merged from the HashPrefixMap for a
36 // given prefix size. 33 // given prefix size.
37 // For instance: {4:iter(3), 5:iter(1)} means that we have already merged 34 // For instance: {4:iter(3), 5:iter(1)} means that we have already merged
38 // 3 hash prefixes of length 4, and 1 hash prefix of length 5. 35 // 3 hash prefixes of length 4, and 1 hash prefix of length 5.
39 typedef base::hash_map<PrefixSize, HashPrefixes::const_iterator> IteratorMap; 36 typedef base::hash_map<PrefixSize, HashPrefixes::const_iterator> IteratorMap;
40 37
41 // A full SHA256 hash.
42 typedef HashPrefix FullHash;
43
44 // Enumerate different failure events while parsing the file read from disk for 38 // Enumerate different failure events while parsing the file read from disk for
45 // histogramming purposes. DO NOT CHANGE THE ORDERING OF THESE VALUES. 39 // histogramming purposes. DO NOT CHANGE THE ORDERING OF THESE VALUES.
46 enum StoreReadResult { 40 enum StoreReadResult {
47 // No errors. 41 // No errors.
48 READ_SUCCESS = 0, 42 READ_SUCCESS = 0,
49 43
50 // Reserved for errors in parsing this enum. 44 // Reserved for errors in parsing this enum.
51 UNEXPECTED_READ_FAILURE = 1, 45 UNEXPECTED_READ_FAILURE = 1,
52 46
53 // The contents of the file could not be read. 47 // The contents of the file could not be read.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 const base::FilePath store_path_; 323 const base::FilePath store_path_;
330 HashPrefixMap hash_prefix_map_; 324 HashPrefixMap hash_prefix_map_;
331 const scoped_refptr<base::SequencedTaskRunner> task_runner_; 325 const scoped_refptr<base::SequencedTaskRunner> task_runner_;
332 }; 326 };
333 327
334 std::ostream& operator<<(std::ostream& os, const V4Store& store); 328 std::ostream& operator<<(std::ostream& os, const V4Store& store);
335 329
336 } // namespace safe_browsing 330 } // namespace safe_browsing
337 331
338 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 332 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_protocol_manager_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698