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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.h

Issue 9310020: Add SafeBrowsingURLRequestContext which stores cookies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
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 CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
10 #pragma once 10 #pragma once
(...skipping 17 matching lines...) Expand all
28 #include "content/public/browser/notification_observer.h" 28 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h" 29 #include "content/public/browser/notification_registrar.h"
30 #include "googleurl/src/gurl.h" 30 #include "googleurl/src/gurl.h"
31 31
32 class MalwareDetails; 32 class MalwareDetails;
33 class PrefChangeRegistrar; 33 class PrefChangeRegistrar;
34 class PrefService; 34 class PrefService;
35 class SafeBrowsingDatabase; 35 class SafeBrowsingDatabase;
36 class SafeBrowsingProtocolManager; 36 class SafeBrowsingProtocolManager;
37 class SafeBrowsingServiceFactory; 37 class SafeBrowsingServiceFactory;
38 class SafeBrowsingURLRequestContextGetter;
38 39
39 namespace base { 40 namespace base {
40 class Thread; 41 class Thread;
41 } 42 }
42 43
43 namespace net { 44 namespace net {
45 class URLRequestContext;
44 class URLRequestContextGetter; 46 class URLRequestContextGetter;
45 } 47 }
46 48
47 namespace safe_browsing { 49 namespace safe_browsing {
48 class ClientSideDetectionService; 50 class ClientSideDetectionService;
49 class DownloadProtectionService; 51 class DownloadProtectionService;
50 } 52 }
51 53
52 // Construction needs to happen on the main thread. 54 // Construction needs to happen on the main thread.
53 class SafeBrowsingService 55 class SafeBrowsingService
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 struct QueuedCheck { 336 struct QueuedCheck {
335 Client* client; 337 Client* client;
336 GURL url; 338 GURL url;
337 base::TimeTicks start; // When check was queued. 339 base::TimeTicks start; // When check was queued.
338 }; 340 };
339 341
340 friend struct content::BrowserThread::DeleteOnThread< 342 friend struct content::BrowserThread::DeleteOnThread<
341 content::BrowserThread::UI>; 343 content::BrowserThread::UI>;
342 friend class base::DeleteHelper<SafeBrowsingService>; 344 friend class base::DeleteHelper<SafeBrowsingService>;
343 friend class SafeBrowsingServiceTest; 345 friend class SafeBrowsingServiceTest;
346 friend class SafeBrowsingURLRequestContextGetter;
344 347
345 // Called to initialize objects that are used on the io_thread. 348 void InitURLRequestContextOnIOThread(
346 void OnIOInitialize(const std::string& client_key, 349 net::URLRequestContextGetter* system_url_request_context_getter);
347 const std::string& wrapped_key,
348 net::URLRequestContextGetter* request_context_getter);
349 350
350 // Called to shutdown operations on the io_thread. 351 void DestroyURLRequestContextOnIOThread();
351 void OnIOShutdown(); 352
353 // Called to initialize objects that are used on the io_thread. This may be
354 // called multiple times during the life of the SafeBrowsingService.
355 void StartOnIOThread(const std::string& client_key,
356 const std::string& wrapped_key);
willchan no longer on Chromium 2012/02/04 22:30:20 indentation off
mattm 2012/02/07 01:28:01 Done.
357
358 // Called to shutdown operations on the io_thread. This may be called multiple
359 // times during the life of the SafeBrowsingService.
360 void StopOnIOThread();
352 361
353 // Returns whether |database_| exists and is accessible. 362 // Returns whether |database_| exists and is accessible.
354 bool DatabaseAvailable() const; 363 bool DatabaseAvailable() const;
355 364
356 // Called on the IO thread. If the database does not exist, queues up a call 365 // Called on the IO thread. If the database does not exist, queues up a call
357 // on the db thread to create it. Returns whether the database is available. 366 // on the db thread to create it. Returns whether the database is available.
358 // 367 //
359 // Note that this is only needed outside the db thread, since functions on the 368 // Note that this is only needed outside the db thread, since functions on the
360 // db thread can call GetDatabase() directly. 369 // db thread can call GetDatabase() directly.
361 bool MakeDatabaseAvailable(); 370 bool MakeDatabaseAvailable();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // Used for issuing only one GetHash request for a given prefix. 505 // Used for issuing only one GetHash request for a given prefix.
497 GetHashRequests gethash_requests_; 506 GetHashRequests gethash_requests_;
498 507
499 // The persistent database. We don't use a scoped_ptr because it 508 // The persistent database. We don't use a scoped_ptr because it
500 // needs to be destructed on a different thread than this object. 509 // needs to be destructed on a different thread than this object.
501 SafeBrowsingDatabase* database_; 510 SafeBrowsingDatabase* database_;
502 511
503 // Lock used to prevent possible data races due to compiler optimizations. 512 // Lock used to prevent possible data races due to compiler optimizations.
504 mutable base::Lock database_lock_; 513 mutable base::Lock database_lock_;
505 514
515 // The SafeBrowsingURLRequestContextGetter used to access
516 // |url_request_context_|.
517 scoped_refptr<net::URLRequestContextGetter>
518 url_request_context_getter_;
519
520 // The SafeBrowsingURLRequestContext.
521 scoped_refptr<net::URLRequestContext> url_request_context_;
522
506 // Handles interaction with SafeBrowsing servers. 523 // Handles interaction with SafeBrowsing servers.
507 SafeBrowsingProtocolManager* protocol_manager_; 524 SafeBrowsingProtocolManager* protocol_manager_;
508 525
509 // Only access this whitelist from the UI thread. 526 // Only access this whitelist from the UI thread.
510 std::vector<WhiteListedEntry> white_listed_entries_; 527 std::vector<WhiteListedEntry> white_listed_entries_;
511 528
512 // Whether the service is running. 'enabled_' is used by SafeBrowsingService 529 // Whether the service is running. 'enabled_' is used by SafeBrowsingService
513 // on the IO thread during normal operations. 530 // on the IO thread during normal operations.
514 bool enabled_; 531 bool enabled_;
515 532
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 class SafeBrowsingServiceFactory { 596 class SafeBrowsingServiceFactory {
580 public: 597 public:
581 SafeBrowsingServiceFactory() { } 598 SafeBrowsingServiceFactory() { }
582 virtual ~SafeBrowsingServiceFactory() { } 599 virtual ~SafeBrowsingServiceFactory() { }
583 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; 600 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0;
584 private: 601 private:
585 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); 602 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory);
586 }; 603 };
587 604
588 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 605 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698