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_PROTOCOL_PARSER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_PARSER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_PARSER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_PARSER_H_ |
7 | 7 |
8 // Parsers and formatters for SafeBrowsing v3.0 protocol: | 8 // Parsers and formatters for SafeBrowsing v3.0 protocol: |
9 // https://developers.google.com/safe-browsing/developers_guide_v3 | 9 // https://developers.google.com/safe-browsing/developers_guide_v3 |
10 // | 10 // |
(...skipping 27 matching lines...) Expand all Loading... |
38 size_t* next_update_sec, | 38 size_t* next_update_sec, |
39 bool* reset, | 39 bool* reset, |
40 std::vector<SBChunkDelete>* chunk_deletes, | 40 std::vector<SBChunkDelete>* chunk_deletes, |
41 std::vector<ChunkUrl>* chunk_urls); | 41 std::vector<ChunkUrl>* chunk_urls); |
42 | 42 |
43 // Parse body of a redirect response. |*chunks| receives the parsed chunk data. | 43 // Parse body of a redirect response. |*chunks| receives the parsed chunk data. |
44 // Returns |false| if the data could not be parsed correctly, in which case all | 44 // Returns |false| if the data could not be parsed correctly, in which case all |
45 // results should be discarded. | 45 // results should be discarded. |
46 bool ParseChunk(const char* chunk_data, | 46 bool ParseChunk(const char* chunk_data, |
47 size_t chunk_len, | 47 size_t chunk_len, |
48 std::vector<scoped_ptr<SBChunkData>>* chunks); | 48 std::vector<std::unique_ptr<SBChunkData>>* chunks); |
49 | 49 |
50 // Parse body of "HTTP Response for Full-Length Hashes", returning the list of | 50 // Parse body of "HTTP Response for Full-Length Hashes", returning the list of |
51 // full hashes. Returns |false| if the data could not be parsed correctly, in | 51 // full hashes. Returns |false| if the data could not be parsed correctly, in |
52 // which case all results should be discarded. | 52 // which case all results should be discarded. |
53 bool ParseGetHash(const char* chunk_data, | 53 bool ParseGetHash(const char* chunk_data, |
54 size_t chunk_len, | 54 size_t chunk_len, |
55 base::TimeDelta* cache_lifetime, | 55 base::TimeDelta* cache_lifetime, |
56 std::vector<SBFullHashResult>* full_hashes); | 56 std::vector<SBFullHashResult>* full_hashes); |
57 | 57 |
58 // Convert prefix hashes into a "HTTP Request for Full-Length Hashes" body. | 58 // Convert prefix hashes into a "HTTP Request for Full-Length Hashes" body. |
59 std::string FormatGetHash(const std::vector<SBPrefix>& prefixes); | 59 std::string FormatGetHash(const std::vector<SBPrefix>& prefixes); |
60 | 60 |
61 // Format the LIST part of "HTTP Request for Data" body. | 61 // Format the LIST part of "HTTP Request for Data" body. |
62 std::string FormatList(const SBListChunkRanges& list); | 62 std::string FormatList(const SBListChunkRanges& list); |
63 | 63 |
64 } // namespace safe_browsing | 64 } // namespace safe_browsing |
65 | 65 |
66 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_PARSER_H_ | 66 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_PARSER_H_ |
OLD | NEW |