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/database_manager.h

Issue 2648193002: SafeBrowsing: Move enabled_ to base class DB Manager (Closed)
Patch Set: Only subclasses set enabled_ Created 3 years, 11 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 (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 // The Safe Browsing service is responsible for downloading anti-phishing and 5 // The Safe Browsing service is responsible for downloading anti-phishing and
6 // anti-malware tables and checking urls against them. 6 // anti-malware tables and checking urls against them.
7 7
8 #ifndef COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_
9 #define COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ 9 #define COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // If false, calls to CheckBrowseUrl may dcheck-fail. 189 // If false, calls to CheckBrowseUrl may dcheck-fail.
190 virtual bool IsSupported() const = 0; 190 virtual bool IsSupported() const = 0;
191 191
192 // 192 //
193 // Methods to indicate when to start or suspend the SafeBrowsing operations. 193 // Methods to indicate when to start or suspend the SafeBrowsing operations.
194 // These functions are always called on the IO thread. 194 // These functions are always called on the IO thread.
195 // 195 //
196 196
197 // Called to initialize objects that are used on the io_thread, such as the 197 // Called to initialize objects that are used on the io_thread, such as the
198 // v4 protocol manager. This may be called multiple times during the life of 198 // v4 protocol manager. This may be called multiple times during the life of
199 // the DatabaseManager. Must be called on IO thread. 199 // the DatabaseManager. Must be called on IO thread. All subclasses should
200 // override this method and set enabled_ to true.
Nathan Parker 2017/01/24 22:51:03 ... and call the base class method at the top of i
kcarattini 2017/01/25 00:19:00 Done.
200 virtual void StartOnIOThread( 201 virtual void StartOnIOThread(
201 net::URLRequestContextGetter* request_context_getter, 202 net::URLRequestContextGetter* request_context_getter,
202 const V4ProtocolConfig& config); 203 const V4ProtocolConfig& config);
203 204
204 // Called to stop or shutdown operations on the io_thread. 205 // Called to stop or shutdown operations on the io_thread. All subclasses
206 // should override this method and set enabled_ to false.
205 virtual void StopOnIOThread(bool shutdown); 207 virtual void StopOnIOThread(bool shutdown);
206 208
207 protected: 209 protected:
208 // Bundled client info for an API abuse hash prefix check. 210 // Bundled client info for an API abuse hash prefix check.
209 class SafeBrowsingApiCheck { 211 class SafeBrowsingApiCheck {
210 public: 212 public:
211 SafeBrowsingApiCheck(const GURL& url, Client* client); 213 SafeBrowsingApiCheck(const GURL& url, Client* client);
212 ~SafeBrowsingApiCheck(); 214 ~SafeBrowsingApiCheck();
213 215
214 const GURL& url() const { return url_; } 216 const GURL& url() const { return url_; }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // CheckApiBlacklistUrl. 257 // CheckApiBlacklistUrl.
256 void OnThreatMetadataResponse(std::unique_ptr<SafeBrowsingApiCheck> check, 258 void OnThreatMetadataResponse(std::unique_ptr<SafeBrowsingApiCheck> check,
257 const ThreatMetadata& md); 259 const ThreatMetadata& md);
258 260
259 typedef std::set<SafeBrowsingApiCheck*> ApiCheckSet; 261 typedef std::set<SafeBrowsingApiCheck*> ApiCheckSet;
260 262
261 // In-progress checks. This set owns the SafeBrowsingApiCheck pointers and is 263 // In-progress checks. This set owns the SafeBrowsingApiCheck pointers and is
262 // responsible for deleting them when removing from the set. 264 // responsible for deleting them when removing from the set.
263 ApiCheckSet api_checks_; 265 ApiCheckSet api_checks_;
264 266
267 // Whether the service is running. 'enabled_' is used by the
268 // SafeBrowsingDatabaseManager on the IO thread during normal operations.
269 bool enabled_;
270
265 // Created and destroyed via StartOnIOThread/StopOnIOThread. 271 // Created and destroyed via StartOnIOThread/StopOnIOThread.
266 std::unique_ptr<V4GetHashProtocolManager> v4_get_hash_protocol_manager_; 272 std::unique_ptr<V4GetHashProtocolManager> v4_get_hash_protocol_manager_;
267 273
268 private: 274 private:
269 // Returns an iterator to the pending API check with the given |client|. 275 // Returns an iterator to the pending API check with the given |client|.
270 ApiCheckSet::iterator FindClientApiCheck(Client* client); 276 ApiCheckSet::iterator FindClientApiCheck(Client* client);
271 }; // class SafeBrowsingDatabaseManager 277 }; // class SafeBrowsingDatabaseManager
272 278
273 } // namespace safe_browsing 279 } // namespace safe_browsing
274 280
275 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_ 281 #endif // COMPONENTS_SAFE_BROWSING_DB_DATABASE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/local_database_manager.cc ('k') | components/safe_browsing_db/database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698