| 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 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #if defined(SAFE_BROWSING_DB_LOCAL) | 56 #if defined(SAFE_BROWSING_DB_LOCAL) |
| 57 #include "chrome/browser/safe_browsing/local_database_manager.h" | 57 #include "chrome/browser/safe_browsing/local_database_manager.h" |
| 58 #elif defined(SAFE_BROWSING_DB_REMOTE) | 58 #elif defined(SAFE_BROWSING_DB_REMOTE) |
| 59 #include "chrome/browser/safe_browsing/remote_database_manager.h" | 59 #include "chrome/browser/safe_browsing/remote_database_manager.h" |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 #if defined(FULL_SAFE_BROWSING) | 62 #if defined(FULL_SAFE_BROWSING) |
| 63 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analy
zer.h" | 63 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analy
zer.h" |
| 64 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyze
r.h" | 64 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyze
r.h" |
| 65 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser
vice.h" | 65 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser
vice.h" |
| 66 #include "chrome/browser/safe_browsing/incident_reporting/module_load_analyzer.h
" |
| 66 #include "chrome/browser/safe_browsing/incident_reporting/resource_request_detec
tor.h" | 67 #include "chrome/browser/safe_browsing/incident_reporting/resource_request_detec
tor.h" |
| 67 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat
ure_analyzer.h" | 68 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat
ure_analyzer.h" |
| 68 #endif | 69 #endif |
| 69 | 70 |
| 70 using content::BrowserThread; | 71 using content::BrowserThread; |
| 71 | 72 |
| 72 namespace safe_browsing { | 73 namespace safe_browsing { |
| 73 | 74 |
| 74 namespace { | 75 namespace { |
| 75 | 76 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 url_request_context_getter_.get())); | 234 url_request_context_getter_.get())); |
| 234 } | 235 } |
| 235 #endif // defined(SAFE_BROWSING_CSD) | 236 #endif // defined(SAFE_BROWSING_CSD) |
| 236 | 237 |
| 237 download_service_.reset(new DownloadProtectionService( | 238 download_service_.reset(new DownloadProtectionService( |
| 238 this, url_request_context_getter_.get())); | 239 this, url_request_context_getter_.get())); |
| 239 | 240 |
| 240 incident_service_.reset(CreateIncidentReportingService()); | 241 incident_service_.reset(CreateIncidentReportingService()); |
| 241 resource_request_detector_.reset(new ResourceRequestDetector( | 242 resource_request_detector_.reset(new ResourceRequestDetector( |
| 242 incident_service_->GetIncidentReceiver())); | 243 incident_service_->GetIncidentReceiver())); |
| 244 module_load_analyzer_.reset(new ModuleLoadAnalyzer(database_manager_)); |
| 243 #endif // !defined(FULL_SAFE_BROWSING) | 245 #endif // !defined(FULL_SAFE_BROWSING) |
| 244 | 246 |
| 245 // Track the safe browsing preference of existing profiles. | 247 // Track the safe browsing preference of existing profiles. |
| 246 // The SafeBrowsingService will be started if any existing profile has the | 248 // The SafeBrowsingService will be started if any existing profile has the |
| 247 // preference enabled. It will also listen for updates to the preferences. | 249 // preference enabled. It will also listen for updates to the preferences. |
| 248 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 250 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 249 if (profile_manager) { | 251 if (profile_manager) { |
| 250 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); | 252 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); |
| 251 // TODO(felt): I believe this for-loop is dead code. Confirm this and | 253 // TODO(felt): I believe this for-loop is dead code. Confirm this and |
| 252 // remove in a future CL. See https://codereview.chromium.org/1341533002/ | 254 // remove in a future CL. See https://codereview.chromium.org/1341533002/ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 280 | 282 |
| 281 Stop(true); | 283 Stop(true); |
| 282 // The IO thread is going away, so make sure the ClientSideDetectionService | 284 // The IO thread is going away, so make sure the ClientSideDetectionService |
| 283 // dtor executes now since it may call the dtor of URLFetcher which relies | 285 // dtor executes now since it may call the dtor of URLFetcher which relies |
| 284 // on it. | 286 // on it. |
| 285 csd_service_.reset(); | 287 csd_service_.reset(); |
| 286 | 288 |
| 287 #if defined(FULL_SAFE_BROWSING) | 289 #if defined(FULL_SAFE_BROWSING) |
| 288 resource_request_detector_.reset(); | 290 resource_request_detector_.reset(); |
| 289 incident_service_.reset(); | 291 incident_service_.reset(); |
| 292 module_load_analyzer_.reset(); |
| 290 #endif | 293 #endif |
| 291 | 294 |
| 292 download_service_.reset(); | 295 download_service_.reset(); |
| 293 | 296 |
| 294 BrowserThread::PostNonNestableTask( | 297 BrowserThread::PostNonNestableTask( |
| 295 BrowserThread::IO, FROM_HERE, | 298 BrowserThread::IO, FROM_HERE, |
| 296 base::Bind(&SafeBrowsingService::DestroyURLRequestContextOnIOThread, | 299 base::Bind(&SafeBrowsingService::DestroyURLRequestContextOnIOThread, |
| 297 this, url_request_context_getter_)); | 300 this, url_request_context_getter_)); |
| 298 | 301 |
| 299 // Release the URLRequestContextGetter after passing it to the IOThread. It | 302 // Release the URLRequestContextGetter after passing it to the IOThread. It |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 #else | 353 #else |
| 351 return scoped_ptr<TrackedPreferenceValidationDelegate>(); | 354 return scoped_ptr<TrackedPreferenceValidationDelegate>(); |
| 352 #endif | 355 #endif |
| 353 } | 356 } |
| 354 | 357 |
| 355 #if defined(FULL_SAFE_BROWSING) | 358 #if defined(FULL_SAFE_BROWSING) |
| 356 void SafeBrowsingService::RegisterDelayedAnalysisCallback( | 359 void SafeBrowsingService::RegisterDelayedAnalysisCallback( |
| 357 const DelayedAnalysisCallback& callback) { | 360 const DelayedAnalysisCallback& callback) { |
| 358 incident_service_->RegisterDelayedAnalysisCallback(callback); | 361 incident_service_->RegisterDelayedAnalysisCallback(callback); |
| 359 } | 362 } |
| 363 |
| 364 void SafeBrowsingService::RegisterExtendedReportingOnlyDelayedAnalysisCallback( |
| 365 const DelayedAnalysisCallback& callback) { |
| 366 incident_service_->RegisterExtendedReportingOnlyDelayedAnalysisCallback( |
| 367 callback); |
| 368 } |
| 360 #endif | 369 #endif |
| 361 | 370 |
| 362 void SafeBrowsingService::AddDownloadManager( | 371 void SafeBrowsingService::AddDownloadManager( |
| 363 content::DownloadManager* download_manager) { | 372 content::DownloadManager* download_manager) { |
| 364 #if defined(FULL_SAFE_BROWSING) | 373 #if defined(FULL_SAFE_BROWSING) |
| 365 incident_service_->AddDownloadManager(download_manager); | 374 incident_service_->AddDownloadManager(download_manager); |
| 366 #endif | 375 #endif |
| 367 } | 376 } |
| 368 | 377 |
| 369 void SafeBrowsingService::OnResourceRequest(const net::URLRequest* request) { | 378 void SafeBrowsingService::OnResourceRequest(const net::URLRequest* request) { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 665 } |
| 657 | 666 |
| 658 void SafeBrowsingService::OnSendDownloadRecoveryReport( | 667 void SafeBrowsingService::OnSendDownloadRecoveryReport( |
| 659 const std::string& report) { | 668 const std::string& report) { |
| 660 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 669 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 661 if (ping_manager()) | 670 if (ping_manager()) |
| 662 ping_manager()->ReportThreatDetails(report); | 671 ping_manager()->ReportThreatDetails(report); |
| 663 } | 672 } |
| 664 | 673 |
| 665 } // namespace safe_browsing | 674 } // namespace safe_browsing |
| OLD | NEW |