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

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

Issue 2503243003: Wire up CertificateReportingService to handle report uploads (Closed)
Patch Set: Rebase 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 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 ClientSideDetectionService* safe_browsing_detection_service() const { 115 ClientSideDetectionService* safe_browsing_detection_service() const {
116 return services_delegate_->GetCsdService(); 116 return services_delegate_->GetCsdService();
117 } 117 }
118 118
119 // The DownloadProtectionService is not valid after the SafeBrowsingService 119 // The DownloadProtectionService is not valid after the SafeBrowsingService
120 // is destroyed. 120 // is destroyed.
121 DownloadProtectionService* download_protection_service() const { 121 DownloadProtectionService* download_protection_service() const {
122 return services_delegate_->GetDownloadService(); 122 return services_delegate_->GetDownloadService();
123 } 123 }
124 124
125 net::URLRequestContextGetter* url_request_context(); 125 scoped_refptr<net::URLRequestContextGetter> url_request_context();
126 126
127 const scoped_refptr<SafeBrowsingUIManager>& ui_manager() const; 127 const scoped_refptr<SafeBrowsingUIManager>& ui_manager() const;
128 128
129 // This returns either the v3 or the v4 database manager, depending on 129 // This returns either the v3 or the v4 database manager, depending on
130 // the experiment settings. 130 // the experiment settings.
131 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager() const; 131 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager() const;
132 132
133 scoped_refptr<SafeBrowsingNavigationObserverManager> 133 scoped_refptr<SafeBrowsingNavigationObserverManager>
134 navigation_observer_manager(); 134 navigation_observer_manager();
135 135
(...skipping 20 matching lines...) Expand all
156 156
157 // Adds |download_manager| to the set monitored by safe browsing. 157 // Adds |download_manager| to the set monitored by safe browsing.
158 void AddDownloadManager(content::DownloadManager* download_manager); 158 void AddDownloadManager(content::DownloadManager* download_manager);
159 159
160 // Observes resource requests made by the renderer and reports suspicious 160 // Observes resource requests made by the renderer and reports suspicious
161 // activity. 161 // activity.
162 void OnResourceRequest(const net::URLRequest* request); 162 void OnResourceRequest(const net::URLRequest* request);
163 163
164 // Type for subscriptions to SafeBrowsing service state. 164 // Type for subscriptions to SafeBrowsing service state.
165 typedef base::CallbackList<void(void)>::Subscription StateSubscription; 165 typedef base::CallbackList<void(void)>::Subscription StateSubscription;
166 typedef base::CallbackList<void(void)>::Subscription ShutdownSubscription;
166 167
167 // Adds a listener for when SafeBrowsing preferences might have changed. 168 // Adds a listener for when SafeBrowsing preferences might have changed.
168 // To get the current state, the callback should call enabled_by_prefs(). 169 // To get the current state, the callback should call enabled_by_prefs().
169 // Should only be called on the UI thread. 170 // Should only be called on the UI thread.
170 std::unique_ptr<StateSubscription> RegisterStateCallback( 171 std::unique_ptr<StateSubscription> RegisterStateCallback(
171 const base::Callback<void(void)>& callback); 172 const base::Callback<void(void)>& callback);
172 173
174 // Adds a listener for when SafeBrowsingService starts shutting down.
175 // The callbacks run on the UI thread, and give the subscribers an opportunity
176 // to clean up any references they hold to SafeBrowsingService.
177 std::unique_ptr<ShutdownSubscription> RegisterShutdownCallback(
178 const base::Callback<void(void)>& callback);
179
173 // Sends serialized download report to backend. 180 // Sends serialized download report to backend.
174 virtual void SendSerializedDownloadReport(const std::string& report); 181 virtual void SendSerializedDownloadReport(const std::string& report);
175 182
176 protected: 183 protected:
177 // Creates the safe browsing service. Need to initialize before using. 184 // Creates the safe browsing service. Need to initialize before using.
178 SafeBrowsingService(); 185 SafeBrowsingService();
179 186
180 ~SafeBrowsingService() override; 187 ~SafeBrowsingService() override;
181 188
182 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); 189 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Accessed on UI thread. 287 // Accessed on UI thread.
281 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_; 288 std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_;
282 289
283 // Used to track creation and destruction of profiles on the UI thread. 290 // Used to track creation and destruction of profiles on the UI thread.
284 content::NotificationRegistrar prefs_registrar_; 291 content::NotificationRegistrar prefs_registrar_;
285 292
286 // Callbacks when SafeBrowsing state might have changed. 293 // Callbacks when SafeBrowsing state might have changed.
287 // Should only be accessed on the UI thread. 294 // Should only be accessed on the UI thread.
288 base::CallbackList<void(void)> state_callback_list_; 295 base::CallbackList<void(void)> state_callback_list_;
289 296
297 // Callbacks when SafeBrowsing service starts shutting down.
298 // Should only be accessed on the UI thread.
299 base::CallbackList<void(void)> shutdown_callback_list_;
300
290 // The UI manager handles showing interstitials. Accessed on both UI and IO 301 // The UI manager handles showing interstitials. Accessed on both UI and IO
291 // thread. 302 // thread.
292 scoped_refptr<SafeBrowsingUIManager> ui_manager_; 303 scoped_refptr<SafeBrowsingUIManager> ui_manager_;
293 304
294 // The database manager handles the database and download logic. Accessed on 305 // The database manager handles the database and download logic. Accessed on
295 // both UI and IO thread. 306 // both UI and IO thread.
296 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; 307 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_;
297 308
298 // The navigation observer manager handles download attribution. 309 // The navigation observer manager handles download attribution.
299 scoped_refptr<SafeBrowsingNavigationObserverManager> 310 scoped_refptr<SafeBrowsingNavigationObserverManager>
300 navigation_observer_manager_; 311 navigation_observer_manager_;
301 312
302 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); 313 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService);
303 }; 314 };
304 315
305 // Factory for creating SafeBrowsingService. Useful for tests. 316 // Factory for creating SafeBrowsingService. Useful for tests.
306 class SafeBrowsingServiceFactory { 317 class SafeBrowsingServiceFactory {
307 public: 318 public:
308 SafeBrowsingServiceFactory() { } 319 SafeBrowsingServiceFactory() { }
309 virtual ~SafeBrowsingServiceFactory() { } 320 virtual ~SafeBrowsingServiceFactory() { }
310 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; 321 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0;
311 private: 322 private:
312 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); 323 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory);
313 }; 324 };
314 325
315 } // namespace safe_browsing 326 } // namespace safe_browsing
316 327
317 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 328 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/ping_manager.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698