| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 class DownloadProtectionService; | 48 class DownloadProtectionService; |
| 49 struct ResourceRequestInfo; | 49 struct ResourceRequestInfo; |
| 50 struct SafeBrowsingProtocolConfig; | 50 struct SafeBrowsingProtocolConfig; |
| 51 class SafeBrowsingDatabaseManager; | 51 class SafeBrowsingDatabaseManager; |
| 52 class SafeBrowsingPingManager; | 52 class SafeBrowsingPingManager; |
| 53 class SafeBrowsingProtocolManager; | 53 class SafeBrowsingProtocolManager; |
| 54 class SafeBrowsingProtocolManagerDelegate; | 54 class SafeBrowsingProtocolManagerDelegate; |
| 55 class SafeBrowsingServiceFactory; | 55 class SafeBrowsingServiceFactory; |
| 56 class SafeBrowsingUIManager; | 56 class SafeBrowsingUIManager; |
| 57 class SafeBrowsingURLRequestContextGetter; | 57 class SafeBrowsingURLRequestContextGetter; |
| 58 class V4LocalDatabaseManager; |
| 58 struct V4ProtocolConfig; | 59 struct V4ProtocolConfig; |
| 59 | 60 |
| 60 #if defined(FULL_SAFE_BROWSING) | 61 #if defined(FULL_SAFE_BROWSING) |
| 61 class IncidentReportingService; | 62 class IncidentReportingService; |
| 62 class OffDomainInclusionDetector; | 63 class OffDomainInclusionDetector; |
| 63 #endif | 64 #endif |
| 64 | 65 |
| 65 // Construction needs to happen on the main thread. | 66 // Construction needs to happen on the main thread. |
| 66 // The SafeBrowsingService owns both the UI and Database managers which do | 67 // The SafeBrowsingService owns both the UI and Database managers which do |
| 67 // the heavylifting of safebrowsing service. Both of these managers stay | 68 // the heavylifting of safebrowsing service. Both of these managers stay |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 virtual void SendSerializedDownloadReport(const std::string& report); | 170 virtual void SendSerializedDownloadReport(const std::string& report); |
| 170 | 171 |
| 171 protected: | 172 protected: |
| 172 // Creates the safe browsing service. Need to initialize before using. | 173 // Creates the safe browsing service. Need to initialize before using. |
| 173 SafeBrowsingService(); | 174 SafeBrowsingService(); |
| 174 | 175 |
| 175 ~SafeBrowsingService() override; | 176 ~SafeBrowsingService() override; |
| 176 | 177 |
| 177 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); | 178 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); |
| 178 | 179 |
| 180 virtual V4LocalDatabaseManager* CreateV4LocalDatabaseManager(); |
| 181 |
| 179 virtual SafeBrowsingUIManager* CreateUIManager(); | 182 virtual SafeBrowsingUIManager* CreateUIManager(); |
| 180 | 183 |
| 181 // Registers all the delayed analysis with the incident reporting service. | 184 // Registers all the delayed analysis with the incident reporting service. |
| 182 // This is where you register your process-wide, profile-independent analysis. | 185 // This is where you register your process-wide, profile-independent analysis. |
| 183 virtual void RegisterAllDelayedAnalysis(); | 186 virtual void RegisterAllDelayedAnalysis(); |
| 184 | 187 |
| 185 // Return a ptr to DatabaseManager's delegate, or NULL if it doesn't have one. | 188 // Return a ptr to DatabaseManager's delegate, or NULL if it doesn't have one. |
| 186 virtual SafeBrowsingProtocolManagerDelegate* GetProtocolManagerDelegate(); | 189 virtual SafeBrowsingProtocolManagerDelegate* GetProtocolManagerDelegate(); |
| 187 | 190 |
| 188 std::unique_ptr<ServicesDelegate> services_delegate_; | 191 std::unique_ptr<ServicesDelegate> services_delegate_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 233 |
| 231 // Checks if any profile is currently using the safe browsing service, and | 234 // Checks if any profile is currently using the safe browsing service, and |
| 232 // starts or stops the service accordingly. | 235 // starts or stops the service accordingly. |
| 233 void RefreshState(); | 236 void RefreshState(); |
| 234 | 237 |
| 235 void OnSendSerializedDownloadReport(const std::string& report); | 238 void OnSendSerializedDownloadReport(const std::string& report); |
| 236 | 239 |
| 237 // Process the observed resource requests on the UI thread. | 240 // Process the observed resource requests on the UI thread. |
| 238 void ProcessResourceRequest(const ResourceRequestInfo& request); | 241 void ProcessResourceRequest(const ResourceRequestInfo& request); |
| 239 | 242 |
| 243 // Is the Pver4 database manager enabled? Controlled by Finch. |
| 244 bool IsV4LocalDatabaseManagerEnabled(); |
| 245 |
| 240 // The factory used to instanciate a SafeBrowsingService object. | 246 // The factory used to instanciate a SafeBrowsingService object. |
| 241 // Useful for tests, so they can provide their own implementation of | 247 // Useful for tests, so they can provide their own implementation of |
| 242 // SafeBrowsingService. | 248 // SafeBrowsingService. |
| 243 static SafeBrowsingServiceFactory* factory_; | 249 static SafeBrowsingServiceFactory* factory_; |
| 244 | 250 |
| 245 // The SafeBrowsingURLRequestContextGetter used to access | 251 // The SafeBrowsingURLRequestContextGetter used to access |
| 246 // |url_request_context_|. Accessed on UI thread. | 252 // |url_request_context_|. Accessed on UI thread. |
| 247 scoped_refptr<SafeBrowsingURLRequestContextGetter> | 253 scoped_refptr<SafeBrowsingURLRequestContextGetter> |
| 248 url_request_context_getter_; | 254 url_request_context_getter_; |
| 249 | 255 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 275 base::CallbackList<void(void)> state_callback_list_; | 281 base::CallbackList<void(void)> state_callback_list_; |
| 276 | 282 |
| 277 // The UI manager handles showing interstitials. Accessed on both UI and IO | 283 // The UI manager handles showing interstitials. Accessed on both UI and IO |
| 278 // thread. | 284 // thread. |
| 279 scoped_refptr<SafeBrowsingUIManager> ui_manager_; | 285 scoped_refptr<SafeBrowsingUIManager> ui_manager_; |
| 280 | 286 |
| 281 // The database manager handles the database and download logic. Accessed on | 287 // The database manager handles the database and download logic. Accessed on |
| 282 // both UI and IO thread. | 288 // both UI and IO thread. |
| 283 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; | 289 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; |
| 284 | 290 |
| 291 // The Pver4 local database manager handles the database and download logic |
| 292 // Accessed on both UI and IO thread. |
| 293 scoped_refptr<V4LocalDatabaseManager> v4_local_database_manager_; |
| 294 |
| 285 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); | 295 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); |
| 286 }; | 296 }; |
| 287 | 297 |
| 288 // Factory for creating SafeBrowsingService. Useful for tests. | 298 // Factory for creating SafeBrowsingService. Useful for tests. |
| 289 class SafeBrowsingServiceFactory { | 299 class SafeBrowsingServiceFactory { |
| 290 public: | 300 public: |
| 291 SafeBrowsingServiceFactory() { } | 301 SafeBrowsingServiceFactory() { } |
| 292 virtual ~SafeBrowsingServiceFactory() { } | 302 virtual ~SafeBrowsingServiceFactory() { } |
| 293 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; | 303 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; |
| 294 private: | 304 private: |
| 295 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); | 305 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); |
| 296 }; | 306 }; |
| 297 | 307 |
| 298 } // namespace safe_browsing | 308 } // namespace safe_browsing |
| 299 | 309 |
| 300 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ | 310 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ |
| OLD | NEW |