| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 // Type for subscriptions to SafeBrowsing service state. | 159 // Type for subscriptions to SafeBrowsing service state. |
| 160 typedef base::CallbackList<void(void)>::Subscription StateSubscription; | 160 typedef base::CallbackList<void(void)>::Subscription StateSubscription; |
| 161 | 161 |
| 162 // Adds a listener for when SafeBrowsing preferences might have changed. | 162 // Adds a listener for when SafeBrowsing preferences might have changed. |
| 163 // To get the current state, the callback should call enabled_by_prefs(). | 163 // To get the current state, the callback should call enabled_by_prefs(). |
| 164 // Should only be called on the UI thread. | 164 // Should only be called on the UI thread. |
| 165 scoped_ptr<StateSubscription> RegisterStateCallback( | 165 scoped_ptr<StateSubscription> RegisterStateCallback( |
| 166 const base::Callback<void(void)>& callback); | 166 const base::Callback<void(void)>& callback); |
| 167 | 167 |
| 168 // Sends serialized download recovery report to backend. |
| 169 virtual void SendDownloadRecoveryReport(const std::string& report); |
| 170 |
| 168 protected: | 171 protected: |
| 169 // Creates the safe browsing service. Need to initialize before using. | 172 // Creates the safe browsing service. Need to initialize before using. |
| 170 SafeBrowsingService(); | 173 SafeBrowsingService(); |
| 171 | 174 |
| 172 ~SafeBrowsingService() override; | 175 ~SafeBrowsingService() override; |
| 173 | 176 |
| 174 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); | 177 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); |
| 175 | 178 |
| 176 virtual SafeBrowsingUIManager* CreateUIManager(); | 179 virtual SafeBrowsingUIManager* CreateUIManager(); |
| 177 | 180 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // Starts following the safe browsing preference on |pref_service|. | 235 // Starts following the safe browsing preference on |pref_service|. |
| 233 void AddPrefService(PrefService* pref_service); | 236 void AddPrefService(PrefService* pref_service); |
| 234 | 237 |
| 235 // Stop following the safe browsing preference on |pref_service|. | 238 // Stop following the safe browsing preference on |pref_service|. |
| 236 void RemovePrefService(PrefService* pref_service); | 239 void RemovePrefService(PrefService* pref_service); |
| 237 | 240 |
| 238 // Checks if any profile is currently using the safe browsing service, and | 241 // Checks if any profile is currently using the safe browsing service, and |
| 239 // starts or stops the service accordingly. | 242 // starts or stops the service accordingly. |
| 240 void RefreshState(); | 243 void RefreshState(); |
| 241 | 244 |
| 245 void OnSendDownloadRecoveryReport(const std::string& report); |
| 246 |
| 242 // The factory used to instanciate a SafeBrowsingService object. | 247 // The factory used to instanciate a SafeBrowsingService object. |
| 243 // Useful for tests, so they can provide their own implementation of | 248 // Useful for tests, so they can provide their own implementation of |
| 244 // SafeBrowsingService. | 249 // SafeBrowsingService. |
| 245 static SafeBrowsingServiceFactory* factory_; | 250 static SafeBrowsingServiceFactory* factory_; |
| 246 | 251 |
| 247 // The SafeBrowsingURLRequestContextGetter used to access | 252 // The SafeBrowsingURLRequestContextGetter used to access |
| 248 // |url_request_context_|. Accessed on UI thread. | 253 // |url_request_context_|. Accessed on UI thread. |
| 249 scoped_refptr<SafeBrowsingURLRequestContextGetter> | 254 scoped_refptr<SafeBrowsingURLRequestContextGetter> |
| 250 url_request_context_getter_; | 255 url_request_context_getter_; |
| 251 | 256 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 SafeBrowsingServiceFactory() { } | 321 SafeBrowsingServiceFactory() { } |
| 317 virtual ~SafeBrowsingServiceFactory() { } | 322 virtual ~SafeBrowsingServiceFactory() { } |
| 318 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 323 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 319 private: | 324 private: |
| 320 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 325 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 321 }; | 326 }; |
| 322 | 327 |
| 323 } // namespace safe_browsing | 328 } // namespace safe_browsing |
| 324 | 329 |
| 325 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 330 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |