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

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

Issue 2284863002: Remove a use of stl_util in safe browsing. (Closed)
Patch Set: cleaner Created 4 years, 3 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 | « no previous file | components/safe_browsing_db/v4_get_hash_protocol_manager.cc » ('j') | 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_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
11 // handling responses from, Google's SafeBrowsing servers. The purpose of this 11 // handling responses from, Google's SafeBrowsing servers. The purpose of this
12 // class is to get full hash matches from the SB server for the given set of 12 // class is to get full hash matches from the SB server for the given set of
13 // hash prefixes. 13 // hash prefixes.
14 14
15 #include <memory> 15 #include <memory>
16 #include <string> 16 #include <string>
17 #include <utility>
17 #include <vector> 18 #include <vector>
18 19
19 #include "base/gtest_prod_util.h" 20 #include "base/gtest_prod_util.h"
20 #include "base/macros.h" 21 #include "base/macros.h"
21 #include "base/threading/non_thread_safe.h" 22 #include "base/threading/non_thread_safe.h"
22 #include "base/time/default_clock.h" 23 #include "base/time/default_clock.h"
23 #include "base/time/time.h" 24 #include "base/time/time.h"
24 #include "base/timer/timer.h" 25 #include "base/timer/timer.h"
25 #include "components/safe_browsing_db/safebrowsing.pb.h" 26 #include "components/safe_browsing_db/safebrowsing.pb.h"
26 #include "components/safe_browsing_db/util.h" 27 #include "components/safe_browsing_db/util.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 132
132 // Resets the gethash error counter and multiplier. 133 // Resets the gethash error counter and multiplier.
133 void ResetGetHashErrors(); 134 void ResetGetHashErrors();
134 135
135 // Updates internal state for each GetHash response error, assuming that 136 // Updates internal state for each GetHash response error, assuming that
136 // the current time is |now|. 137 // the current time is |now|.
137 void HandleGetHashError(const base::Time& now); 138 void HandleGetHashError(const base::Time& now);
138 139
139 private: 140 private:
140 // Map of GetHash requests to parameters which created it. 141 // Map of GetHash requests to parameters which created it.
141 typedef base::hash_map<const net::URLFetcher*, FullHashCallback> HashRequests; 142 using HashRequests = base::hash_map<
143 const net::URLFetcher*,
144 std::pair<std::unique_ptr<net::URLFetcher>, FullHashCallback>>;
142 145
143 // The factory that controls the creation of V4GetHashProtocolManager. 146 // The factory that controls the creation of V4GetHashProtocolManager.
144 // This is used by tests. 147 // This is used by tests.
145 static V4GetHashProtocolManagerFactory* factory_; 148 static V4GetHashProtocolManagerFactory* factory_;
146 149
147 // Current active request (in case we need to cancel) for updates or chunks 150 // Current active request (in case we need to cancel) for updates or chunks
148 // from the SafeBrowsing service. We can only have one of these outstanding 151 // from the SafeBrowsing service. We can only have one of these outstanding
149 // at any given time unlike GetHash requests, which are tracked separately. 152 // at any given time unlike GetHash requests, which are tracked separately.
150 std::unique_ptr<net::URLFetcher> request_; 153 std::unique_ptr<net::URLFetcher> request_;
151 154
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 net::URLRequestContextGetter* request_context_getter, 190 net::URLRequestContextGetter* request_context_getter,
188 const V4ProtocolConfig& config) = 0; 191 const V4ProtocolConfig& config) = 0;
189 192
190 private: 193 private:
191 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory); 194 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory);
192 }; 195 };
193 196
194 } // namespace safe_browsing 197 } // namespace safe_browsing
195 198
196 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ 199 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | 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