| 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(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Starts following the safe browsing preference on |pref_service|. | 237 // Starts following the safe browsing preference on |pref_service|. |
| 238 void AddPrefService(PrefService* pref_service); | 238 void AddPrefService(PrefService* pref_service); |
| 239 | 239 |
| 240 // Stop following the safe browsing preference on |pref_service|. | 240 // Stop following the safe browsing preference on |pref_service|. |
| 241 void RemovePrefService(PrefService* pref_service); | 241 void RemovePrefService(PrefService* pref_service); |
| 242 | 242 |
| 243 // Checks if any profile is currently using the safe browsing service, and | 243 // Checks if any profile is currently using the safe browsing service, and |
| 244 // starts or stops the service accordingly. | 244 // starts or stops the service accordingly. |
| 245 void RefreshState(); | 245 void RefreshState(); |
| 246 | 246 |
| 247 void OnSendDownloadRecoveryReport(const std::string& report); | 247 void OnSendSerializedDownloadReport(const std::string& report); |
| 248 | 248 |
| 249 // The factory used to instanciate a SafeBrowsingService object. | 249 // The factory used to instanciate a SafeBrowsingService object. |
| 250 // Useful for tests, so they can provide their own implementation of | 250 // Useful for tests, so they can provide their own implementation of |
| 251 // SafeBrowsingService. | 251 // SafeBrowsingService. |
| 252 static SafeBrowsingServiceFactory* factory_; | 252 static SafeBrowsingServiceFactory* factory_; |
| 253 | 253 |
| 254 // The SafeBrowsingURLRequestContextGetter used to access | 254 // The SafeBrowsingURLRequestContextGetter used to access |
| 255 // |url_request_context_|. Accessed on UI thread. | 255 // |url_request_context_|. Accessed on UI thread. |
| 256 scoped_refptr<SafeBrowsingURLRequestContextGetter> | 256 scoped_refptr<SafeBrowsingURLRequestContextGetter> |
| 257 url_request_context_getter_; | 257 url_request_context_getter_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 SafeBrowsingServiceFactory() { } | 318 SafeBrowsingServiceFactory() { } |
| 319 virtual ~SafeBrowsingServiceFactory() { } | 319 virtual ~SafeBrowsingServiceFactory() { } |
| 320 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 320 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 321 private: | 321 private: |
| 322 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 322 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 323 }; | 323 }; |
| 324 | 324 |
| 325 } // namespace safe_browsing | 325 } // namespace safe_browsing |
| 326 | 326 |
| 327 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 327 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |