| OLD | NEW |
| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 // Type for subscriptions to SafeBrowsing service state. | 169 // Type for subscriptions to SafeBrowsing service state. |
| 170 typedef base::CallbackList<void(void)>::Subscription StateSubscription; | 170 typedef base::CallbackList<void(void)>::Subscription StateSubscription; |
| 171 | 171 |
| 172 // Adds a listener for when SafeBrowsing preferences might have changed. | 172 // Adds a listener for when SafeBrowsing preferences might have changed. |
| 173 // To get the current state, the callback should call enabled_by_prefs(). | 173 // To get the current state, the callback should call enabled_by_prefs(). |
| 174 // Should only be called on the UI thread. | 174 // Should only be called on the UI thread. |
| 175 scoped_ptr<StateSubscription> RegisterStateCallback( | 175 scoped_ptr<StateSubscription> RegisterStateCallback( |
| 176 const base::Callback<void(void)>& callback); | 176 const base::Callback<void(void)>& callback); |
| 177 | 177 |
| 178 // Sends serialized download recovery report to backend. | 178 // Sends serialized download report to backend. |
| 179 virtual void SendDownloadRecoveryReport(const std::string& report); | 179 virtual void SendSerializedDownloadReport(const std::string& report); |
| 180 | 180 |
| 181 protected: | 181 protected: |
| 182 // Creates the safe browsing service. Need to initialize before using. | 182 // Creates the safe browsing service. Need to initialize before using. |
| 183 SafeBrowsingService(); | 183 SafeBrowsingService(); |
| 184 | 184 |
| 185 ~SafeBrowsingService() override; | 185 ~SafeBrowsingService() override; |
| 186 | 186 |
| 187 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); | 187 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); |
| 188 | 188 |
| 189 virtual SafeBrowsingUIManager* CreateUIManager(); | 189 virtual SafeBrowsingUIManager* CreateUIManager(); |
| 190 | 190 |
| 191 #if defined(FULL_SAFE_BROWSING) | 191 #if defined(FULL_SAFE_BROWSING) |
| 192 virtual DownloadProtectionService* CreateDownloadProtectionService( |
| 193 net::URLRequestContextGetter* request_context_getter); |
| 194 |
| 192 virtual IncidentReportingService* CreateIncidentReportingService(); | 195 virtual IncidentReportingService* CreateIncidentReportingService(); |
| 193 #endif | 196 #endif |
| 194 | 197 |
| 195 // Registers all the delayed analysis with the incident reporting service. | 198 // Registers all the delayed analysis with the incident reporting service. |
| 196 // This is where you register your process-wide, profile-independent analysis. | 199 // This is where you register your process-wide, profile-independent analysis. |
| 197 virtual void RegisterAllDelayedAnalysis(); | 200 virtual void RegisterAllDelayedAnalysis(); |
| 198 | 201 |
| 199 // Return a ptr to DatabaseManager's delegate, or NULL if it doesn't have one. | 202 // Return a ptr to DatabaseManager's delegate, or NULL if it doesn't have one. |
| 200 virtual SafeBrowsingProtocolManagerDelegate* GetProtocolManagerDelegate(); | 203 virtual SafeBrowsingProtocolManagerDelegate* GetProtocolManagerDelegate(); |
| 201 | 204 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Starts following the safe browsing preference on |pref_service|. | 240 // Starts following the safe browsing preference on |pref_service|. |
| 238 void AddPrefService(PrefService* pref_service); | 241 void AddPrefService(PrefService* pref_service); |
| 239 | 242 |
| 240 // Stop following the safe browsing preference on |pref_service|. | 243 // Stop following the safe browsing preference on |pref_service|. |
| 241 void RemovePrefService(PrefService* pref_service); | 244 void RemovePrefService(PrefService* pref_service); |
| 242 | 245 |
| 243 // Checks if any profile is currently using the safe browsing service, and | 246 // Checks if any profile is currently using the safe browsing service, and |
| 244 // starts or stops the service accordingly. | 247 // starts or stops the service accordingly. |
| 245 void RefreshState(); | 248 void RefreshState(); |
| 246 | 249 |
| 247 void OnSendDownloadRecoveryReport(const std::string& report); | 250 void OnSendSerializedDownloadReport(const std::string& report); |
| 248 | 251 |
| 249 // The factory used to instanciate a SafeBrowsingService object. | 252 // The factory used to instanciate a SafeBrowsingService object. |
| 250 // Useful for tests, so they can provide their own implementation of | 253 // Useful for tests, so they can provide their own implementation of |
| 251 // SafeBrowsingService. | 254 // SafeBrowsingService. |
| 252 static SafeBrowsingServiceFactory* factory_; | 255 static SafeBrowsingServiceFactory* factory_; |
| 253 | 256 |
| 254 // The SafeBrowsingURLRequestContextGetter used to access | 257 // The SafeBrowsingURLRequestContextGetter used to access |
| 255 // |url_request_context_|. Accessed on UI thread. | 258 // |url_request_context_|. Accessed on UI thread. |
| 256 scoped_refptr<SafeBrowsingURLRequestContextGetter> | 259 scoped_refptr<SafeBrowsingURLRequestContextGetter> |
| 257 url_request_context_getter_; | 260 url_request_context_getter_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 SafeBrowsingServiceFactory() { } | 321 SafeBrowsingServiceFactory() { } |
| 319 virtual ~SafeBrowsingServiceFactory() { } | 322 virtual ~SafeBrowsingServiceFactory() { } |
| 320 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 323 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 321 private: | 324 private: |
| 322 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 325 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 323 }; | 326 }; |
| 324 | 327 |
| 325 } // namespace safe_browsing | 328 } // namespace safe_browsing |
| 326 | 329 |
| 327 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 330 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |