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

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

Issue 1727033003: v4_update_protocol_manager: Basic implementation with TODOs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback. Created 4 years, 9 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
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_GET_HASH_PROTOCOL_MANAGER_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_
7 7
8 // A class that implements Chrome's interface with the SafeBrowsing V4 protocol. 8 // A class that implements Chrome's interface with the SafeBrowsing V4 protocol.
9 // 9 //
10 // The V4GetHashProtocolManager handles formatting and making requests of, and 10 // The V4GetHashProtocolManager handles formatting and making requests of, and
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const std::vector<PlatformType>& platforms, 71 const std::vector<PlatformType>& platforms,
72 ThreatType threat_type, 72 ThreatType threat_type,
73 FullHashCallback callback); 73 FullHashCallback callback);
74 74
75 // Retrieve the full hash and API metadata for a set of prefixes, and invoke 75 // Retrieve the full hash and API metadata for a set of prefixes, and invoke
76 // the callback argument when the results are retrieved. The callback may be 76 // the callback argument when the results are retrieved. The callback may be
77 // invoked synchronously. 77 // invoked synchronously.
78 virtual void GetFullHashesWithApis(const std::vector<SBPrefix>& prefixes, 78 virtual void GetFullHashesWithApis(const std::vector<SBPrefix>& prefixes,
79 FullHashCallback callback); 79 FullHashCallback callback);
80 80
81 // Enumerate failures for histogramming purposes. DO NOT CHANGE THE
82 // ORDERING OF THESE VALUES.
83 enum ResultType {
84 // 200 response code means that the server recognized the hash
85 // prefix.
86 GET_HASH_STATUS_200 = 0,
87
88 // Subset of successful responses where the response body wasn't parsable.
89 GET_HASH_PARSE_ERROR = 1,
90
91 // Gethash request failed (network error).
92 GET_HASH_NETWORK_ERROR = 2,
93
94 // Gethash request returned HTTP result code other than 200.
95 GET_HASH_HTTP_ERROR = 3,
96
97 // Gethash attempted during error backoff, no request sent.
98 GET_HASH_BACKOFF_ERROR = 4,
99
100 // Gethash attempted before min wait duration elapsed, no request sent.
101 GET_HASH_MIN_WAIT_DURATION_ERROR = 5,
102
103 // Memory space for histograms is determined by the max. ALWAYS
104 // ADD NEW VALUES BEFORE THIS ONE.
105 GET_HASH_RESULT_MAX = 6
106 };
107
108 // Record a GetHash result.
109 static void RecordGetHashResult(ResultType result_type);
110
111 protected: 81 protected:
112 // Constructs a V4GetHashProtocolManager that issues 82 // Constructs a V4GetHashProtocolManager that issues
113 // network requests using |request_context_getter|. 83 // network requests using |request_context_getter|.
114 V4GetHashProtocolManager( 84 V4GetHashProtocolManager(
115 net::URLRequestContextGetter* request_context_getter, 85 net::URLRequestContextGetter* request_context_getter,
116 const V4ProtocolConfig& config); 86 const V4ProtocolConfig& config);
117 87
118 private: 88 private:
119 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, 89 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest,
120 TestGetHashRequest); 90 TestGetHashRequest);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 net::URLRequestContextGetter* request_context_getter, 178 net::URLRequestContextGetter* request_context_getter,
209 const V4ProtocolConfig& config) = 0; 179 const V4ProtocolConfig& config) = 0;
210 180
211 private: 181 private:
212 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory); 182 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory);
213 }; 183 };
214 184
215 } // namespace safe_browsing 185 } // namespace safe_browsing
216 186
217 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ 187 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/BUILD.gn ('k') | components/safe_browsing_db/v4_get_hash_protocol_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698