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

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

Issue 720163003: Safe Browsing: Add Omnibox Interaction Incident Reporter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatting Created 6 years 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
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 class URLRequestContext; 51 class URLRequestContext;
52 class URLRequestContextGetter; 52 class URLRequestContextGetter;
53 } 53 }
54 54
55 namespace safe_browsing { 55 namespace safe_browsing {
56 class ClientSideDetectionService; 56 class ClientSideDetectionService;
57 class DownloadProtectionService; 57 class DownloadProtectionService;
58 58
59 #if defined(FULL_SAFE_BROWSING) 59 #if defined(FULL_SAFE_BROWSING)
60 class IncidentReportingService; 60 class IncidentReportingService;
61 class OmniboxWatcher;
61 class OffDomainInclusionDetector; 62 class OffDomainInclusionDetector;
62 #endif 63 #endif
63 } 64 }
64 65
65 // Construction needs to happen on the main thread. 66 // Construction needs to happen on the main thread.
66 // The SafeBrowsingService owns both the UI and Database managers which do 67 // The SafeBrowsingService owns both the UI and Database managers which do
67 // the heavylifting of safebrowsing service. Both of these managers stay 68 // the heavylifting of safebrowsing service. Both of these managers stay
68 // alive until SafeBrowsingService is destroyed, however, they are disabled 69 // alive until SafeBrowsingService is destroyed, however, they are disabled
69 // permanently when Shutdown method is called. 70 // permanently when Shutdown method is called.
70 class SafeBrowsingService 71 class SafeBrowsingService
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void Observe(int type, 200 void Observe(int type,
200 const content::NotificationSource& source, 201 const content::NotificationSource& source,
201 const content::NotificationDetails& details) override; 202 const content::NotificationDetails& details) override;
202 203
203 // Starts following the safe browsing preference on |pref_service|. 204 // Starts following the safe browsing preference on |pref_service|.
204 void AddPrefService(PrefService* pref_service); 205 void AddPrefService(PrefService* pref_service);
205 206
206 // Stop following the safe browsing preference on |pref_service|. 207 // Stop following the safe browsing preference on |pref_service|.
207 void RemovePrefService(PrefService* pref_service); 208 void RemovePrefService(PrefService* pref_service);
208 209
210 // Creates a OmniboxWatcher for the newly-instantiated |profile|.
211 void AddOmniboxWatcher(Profile* profile);
212
213 // Deletes the OmniboxWatcher associated with |profile|.
214 void RemoveOmniboxWatcher(Profile* profile);
215
209 // Checks if any profile is currently using the safe browsing service, and 216 // Checks if any profile is currently using the safe browsing service, and
210 // starts or stops the service accordingly. 217 // starts or stops the service accordingly.
211 void RefreshState(); 218 void RefreshState();
212 219
213 // The factory used to instanciate a SafeBrowsingService object. 220 // The factory used to instanciate a SafeBrowsingService object.
214 // Useful for tests, so they can provide their own implementation of 221 // Useful for tests, so they can provide their own implementation of
215 // SafeBrowsingService. 222 // SafeBrowsingService.
216 static SafeBrowsingServiceFactory* factory_; 223 static SafeBrowsingServiceFactory* factory_;
217 224
218 // The SafeBrowsingURLRequestContextGetter used to access 225 // The SafeBrowsingURLRequestContextGetter used to access
(...skipping 13 matching lines...) Expand all
232 // Whether the service is running. 'enabled_' is used by SafeBrowsingService 239 // Whether the service is running. 'enabled_' is used by SafeBrowsingService
233 // on the IO thread during normal operations. 240 // on the IO thread during normal operations.
234 bool enabled_; 241 bool enabled_;
235 242
236 // Tracks existing PrefServices, and the safe browsing preference on each. 243 // Tracks existing PrefServices, and the safe browsing preference on each.
237 // This is used to determine if any profile is currently using the safe 244 // This is used to determine if any profile is currently using the safe
238 // browsing service, and to start it up or shut it down accordingly. 245 // browsing service, and to start it up or shut it down accordingly.
239 // Accessed on UI thread. 246 // Accessed on UI thread.
240 std::map<PrefService*, PrefChangeRegistrar*> prefs_map_; 247 std::map<PrefService*, PrefChangeRegistrar*> prefs_map_;
241 248
249 // Tracks existing OmniboxWatchers. This is used to keep one per profile.
250 std::map<Profile*, safe_browsing::OmniboxWatcher*> omnibox_watcher_map_;
grt (UTC plus 2) 2014/12/05 18:40:56 how about putting a scoped_ptr<OmniboxWatcher> mem
Mark P 2014/12/09 19:23:30 Done. It is okay that one listens for NOTIFICATIO
Mark P 2014/12/09 19:24:48 Done. I love how I can offhandedly mention any is
grt (UTC plus 2) 2014/12/09 20:15:52 I think it's okay. PROFILE_ADDED happens when the
noms (inactive) 2014/12/09 20:35:52 Hmmm, so I think that this can happen for sure in
grt (UTC plus 2) 2014/12/10 15:13:16 Thanks for the info. I think this is okay, then.
251
242 // Used to track creation and destruction of profiles on the UI thread. 252 // Used to track creation and destruction of profiles on the UI thread.
243 content::NotificationRegistrar prefs_registrar_; 253 content::NotificationRegistrar prefs_registrar_;
244 254
245 // The ClientSideDetectionService is managed by the SafeBrowsingService, 255 // The ClientSideDetectionService is managed by the SafeBrowsingService,
246 // since its running state and lifecycle depends on SafeBrowsingService's. 256 // since its running state and lifecycle depends on SafeBrowsingService's.
247 // Accessed on UI thread. 257 // Accessed on UI thread.
248 scoped_ptr<safe_browsing::ClientSideDetectionService> csd_service_; 258 scoped_ptr<safe_browsing::ClientSideDetectionService> csd_service_;
249 259
250 // The DownloadProtectionService is managed by the SafeBrowsingService, 260 // The DownloadProtectionService is managed by the SafeBrowsingService,
251 // since its running state and lifecycle depends on SafeBrowsingService's. 261 // since its running state and lifecycle depends on SafeBrowsingService's.
(...skipping 24 matching lines...) Expand all
276 class SafeBrowsingServiceFactory { 286 class SafeBrowsingServiceFactory {
277 public: 287 public:
278 SafeBrowsingServiceFactory() { } 288 SafeBrowsingServiceFactory() { }
279 virtual ~SafeBrowsingServiceFactory() { } 289 virtual ~SafeBrowsingServiceFactory() { }
280 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; 290 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0;
281 private: 291 private:
282 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); 292 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory);
283 }; 293 };
284 294
285 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 295 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698