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

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

Issue 516663002: Introducing the OffDomainInclusionDetector to analyze resource requests for suspicious activity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests and cleanup Created 6 years, 1 month 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 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 10
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/observer_list.h" 18 #include "base/observer_list.h"
19 #include "base/sequenced_task_runner_helpers.h" 19 #include "base/sequenced_task_runner_helpers.h"
20 #include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callb ack.h" 20 #include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callb ack.h"
21 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 21 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
25 #include "content/public/common/resource_type.h"
mattm 2014/11/14 04:16:00 unused?
gab 2014/11/14 19:48:36 Done.
25 26
26 class PrefChangeRegistrar; 27 class PrefChangeRegistrar;
27 class PrefService; 28 class PrefService;
28 class Profile; 29 class Profile;
29 struct SafeBrowsingProtocolConfig; 30 struct SafeBrowsingProtocolConfig;
30 class SafeBrowsingDatabaseManager; 31 class SafeBrowsingDatabaseManager;
31 class SafeBrowsingPingManager; 32 class SafeBrowsingPingManager;
32 class SafeBrowsingProtocolManager; 33 class SafeBrowsingProtocolManager;
33 class SafeBrowsingServiceFactory; 34 class SafeBrowsingServiceFactory;
34 class SafeBrowsingUIManager; 35 class SafeBrowsingUIManager;
35 class SafeBrowsingURLRequestContextGetter; 36 class SafeBrowsingURLRequestContextGetter;
36 class TrackedPreferenceValidationDelegate; 37 class TrackedPreferenceValidationDelegate;
37 38
38 namespace base { 39 namespace base {
39 class Thread; 40 class Thread;
40 } 41 }
41 42
42 namespace net { 43 namespace net {
44 class URLRequest;
43 class URLRequestContext; 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 class IncidentReportingService; 52 class IncidentReportingService;
53 class OffDomainInclusionDetector;
51 } 54 }
52 55
53 // Construction needs to happen on the main thread. 56 // Construction needs to happen on the main thread.
54 // The SafeBrowsingService owns both the UI and Database managers which do 57 // The SafeBrowsingService owns both the UI and Database managers which do
55 // the heavylifting of safebrowsing service. Both of these managers stay 58 // the heavylifting of safebrowsing service. Both of these managers stay
56 // alive until SafeBrowsingService is destroyed, however, they are disabled 59 // alive until SafeBrowsingService is destroyed, however, they are disabled
57 // permanently when Shutdown method is called. 60 // permanently when Shutdown method is called.
58 class SafeBrowsingService 61 class SafeBrowsingService
59 : public base::RefCountedThreadSafe< 62 : public base::RefCountedThreadSafe<
60 SafeBrowsingService, 63 SafeBrowsingService,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // service is not applicable for the given profile. 127 // service is not applicable for the given profile.
125 scoped_ptr<TrackedPreferenceValidationDelegate> 128 scoped_ptr<TrackedPreferenceValidationDelegate>
126 CreatePreferenceValidationDelegate(Profile* profile) const; 129 CreatePreferenceValidationDelegate(Profile* profile) const;
127 130
128 // Registers |callback| to be run after some delay following process launch. 131 // Registers |callback| to be run after some delay following process launch.
129 // |callback| will be dropped if the service is not applicable for the 132 // |callback| will be dropped if the service is not applicable for the
130 // process. 133 // process.
131 void RegisterDelayedAnalysisCallback( 134 void RegisterDelayedAnalysisCallback(
132 const safe_browsing::DelayedAnalysisCallback& callback); 135 const safe_browsing::DelayedAnalysisCallback& callback);
133 136
137 // Oserves resource requests made by the renderer and reports suspsicious
mattm 2014/11/14 04:16:00 Observes suspicious
gab 2014/11/14 19:48:36 Done.
138 // activity.
139 void OnResourceRequest(const net::URLRequest* request);
140
134 protected: 141 protected:
135 // Creates the safe browsing service. Need to initialize before using. 142 // Creates the safe browsing service. Need to initialize before using.
136 SafeBrowsingService(); 143 SafeBrowsingService();
137 144
138 ~SafeBrowsingService() override; 145 ~SafeBrowsingService() override;
139 146
140 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); 147 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager();
141 148
142 virtual SafeBrowsingUIManager* CreateUIManager(); 149 virtual SafeBrowsingUIManager* CreateUIManager();
143 150
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 scoped_ptr<safe_browsing::IncidentReportingService> incident_service_; 247 scoped_ptr<safe_browsing::IncidentReportingService> incident_service_;
241 248
242 // The UI manager handles showing interstitials. Accessed on both UI and IO 249 // The UI manager handles showing interstitials. Accessed on both UI and IO
243 // thread. 250 // thread.
244 scoped_refptr<SafeBrowsingUIManager> ui_manager_; 251 scoped_refptr<SafeBrowsingUIManager> ui_manager_;
245 252
246 // The database manager handles the database and download logic. Accessed on 253 // The database manager handles the database and download logic. Accessed on
247 // both UI and IO thread. 254 // both UI and IO thread.
248 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; 255 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_;
249 256
257 scoped_ptr<safe_browsing::OffDomainInclusionDetector>
258 off_domain_inclusion_detector_;
259
250 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); 260 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService);
251 }; 261 };
252 262
253 // Factory for creating SafeBrowsingService. Useful for tests. 263 // Factory for creating SafeBrowsingService. Useful for tests.
254 class SafeBrowsingServiceFactory { 264 class SafeBrowsingServiceFactory {
255 public: 265 public:
256 SafeBrowsingServiceFactory() { } 266 SafeBrowsingServiceFactory() { }
257 virtual ~SafeBrowsingServiceFactory() { } 267 virtual ~SafeBrowsingServiceFactory() { }
258 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; 268 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0;
259 private: 269 private:
260 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); 270 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory);
261 }; 271 };
262 272
263 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 273 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698