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

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

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

Powered by Google App Engine
This is Rietveld 408576698