| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // Type for subscriptions to SafeBrowsing service state. | 163 // Type for subscriptions to SafeBrowsing service state. |
| 164 typedef base::CallbackList<void(void)>::Subscription StateSubscription; | 164 typedef base::CallbackList<void(void)>::Subscription StateSubscription; |
| 165 | 165 |
| 166 // Adds a listener for when SafeBrowsing preferences might have changed. | 166 // Adds a listener for when SafeBrowsing preferences might have changed. |
| 167 // To get the current state, the callback should call enabled_by_prefs(). | 167 // To get the current state, the callback should call enabled_by_prefs(). |
| 168 // Should only be called on the UI thread. | 168 // Should only be called on the UI thread. |
| 169 scoped_ptr<StateSubscription> RegisterStateCallback( | 169 scoped_ptr<StateSubscription> RegisterStateCallback( |
| 170 const base::Callback<void(void)>& callback); | 170 const base::Callback<void(void)>& callback); |
| 171 | 171 |
| 172 // Sends serialized download recovery report to backend. |
| 173 void SendDownloadRecoveryReport(const std::string& report); |
| 174 |
| 172 protected: | 175 protected: |
| 173 // Creates the safe browsing service. Need to initialize before using. | 176 // Creates the safe browsing service. Need to initialize before using. |
| 174 SafeBrowsingService(); | 177 SafeBrowsingService(); |
| 175 | 178 |
| 176 ~SafeBrowsingService() override; | 179 ~SafeBrowsingService() override; |
| 177 | 180 |
| 178 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); | 181 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); |
| 179 | 182 |
| 180 virtual SafeBrowsingUIManager* CreateUIManager(); | 183 virtual SafeBrowsingUIManager* CreateUIManager(); |
| 181 | 184 |
| (...skipping 55 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 |
| 250 void OnSendDownloadRecoveryReport(const std::string& report); |
| 251 |
| 247 // The factory used to instanciate a SafeBrowsingService object. | 252 // The factory used to instanciate a SafeBrowsingService object. |
| 248 // Useful for tests, so they can provide their own implementation of | 253 // Useful for tests, so they can provide their own implementation of |
| 249 // SafeBrowsingService. | 254 // SafeBrowsingService. |
| 250 static SafeBrowsingServiceFactory* factory_; | 255 static SafeBrowsingServiceFactory* factory_; |
| 251 | 256 |
| 252 // The SafeBrowsingURLRequestContextGetter used to access | 257 // The SafeBrowsingURLRequestContextGetter used to access |
| 253 // |url_request_context_|. Accessed on UI thread. | 258 // |url_request_context_|. Accessed on UI thread. |
| 254 scoped_refptr<SafeBrowsingURLRequestContextGetter> | 259 scoped_refptr<SafeBrowsingURLRequestContextGetter> |
| 255 url_request_context_getter_; | 260 url_request_context_getter_; |
| 256 | 261 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 class SafeBrowsingServiceFactory { | 325 class SafeBrowsingServiceFactory { |
| 321 public: | 326 public: |
| 322 SafeBrowsingServiceFactory() { } | 327 SafeBrowsingServiceFactory() { } |
| 323 virtual ~SafeBrowsingServiceFactory() { } | 328 virtual ~SafeBrowsingServiceFactory() { } |
| 324 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 329 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 325 private: | 330 private: |
| 326 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 331 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 327 }; | 332 }; |
| 328 | 333 |
| 329 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 334 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |