Chromium Code Reviews| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
| 24 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" | 24 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 27 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 27 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 28 #include "chrome/browser/safe_browsing/database_manager.h" | 28 #include "chrome/browser/safe_browsing/database_manager.h" |
| 29 #include "chrome/browser/safe_browsing/download_protection_service.h" | 29 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 30 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analy zer.h" | 30 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_analy zer.h" |
| 31 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyze r.h" | 31 #include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyze r.h" |
| 32 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h" | 32 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h" |
| 33 #include "chrome/browser/safe_browsing/incident_reporting/off_domain_inclusion_d etector.h" | |
| 33 #include "chrome/browser/safe_browsing/malware_details.h" | 34 #include "chrome/browser/safe_browsing/malware_details.h" |
| 34 #include "chrome/browser/safe_browsing/ping_manager.h" | 35 #include "chrome/browser/safe_browsing/ping_manager.h" |
| 35 #include "chrome/browser/safe_browsing/protocol_manager.h" | 36 #include "chrome/browser/safe_browsing/protocol_manager.h" |
| 36 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 37 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
| 37 #include "chrome/browser/safe_browsing/ui_manager.h" | 38 #include "chrome/browser/safe_browsing/ui_manager.h" |
| 38 #include "chrome/common/chrome_constants.h" | 39 #include "chrome/common/chrome_constants.h" |
| 39 #include "chrome/common/chrome_paths.h" | 40 #include "chrome/common/chrome_paths.h" |
| 40 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| (...skipping 190 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 download_service_.reset(new safe_browsing::DownloadProtectionService( | 236 download_service_.reset(new safe_browsing::DownloadProtectionService( |
| 236 this, url_request_context_getter_.get())); | 237 this, url_request_context_getter_.get())); |
| 237 #endif | 238 #endif |
| 238 | 239 |
| 239 if (IsIncidentReportingServiceEnabled()) { | 240 if (IsIncidentReportingServiceEnabled()) { |
| 240 incident_service_.reset(new safe_browsing::IncidentReportingService( | 241 incident_service_.reset(new safe_browsing::IncidentReportingService( |
| 241 this, url_request_context_getter_)); | 242 this, url_request_context_getter_)); |
| 242 } | 243 } |
| 244 | |
| 245 off_domain_inclusion_detector_.reset( | |
| 246 new safe_browsing::OffDomainInclusionDetector); | |
| 243 #endif | 247 #endif |
| 244 | 248 |
| 245 // Track the safe browsing preference of existing profiles. | 249 // Track the safe browsing preference of existing profiles. |
| 246 // The SafeBrowsingService will be started if any existing profile has the | 250 // The SafeBrowsingService will be started if any existing profile has the |
| 247 // preference enabled. It will also listen for updates to the preferences. | 251 // preference enabled. It will also listen for updates to the preferences. |
| 248 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 252 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 249 if (profile_manager) { | 253 if (profile_manager) { |
| 250 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); | 254 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); |
| 251 for (size_t i = 0; i < profiles.size(); ++i) { | 255 for (size_t i = 0; i < profiles.size(); ++i) { |
| 252 if (profiles[i]->IsOffTheRecord()) | 256 if (profiles[i]->IsOffTheRecord()) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 #if defined(FULL_SAFE_BROWSING) | 348 #if defined(FULL_SAFE_BROWSING) |
| 345 if (incident_service_) | 349 if (incident_service_) |
| 346 incident_service_->RegisterDelayedAnalysisCallback(callback); | 350 incident_service_->RegisterDelayedAnalysisCallback(callback); |
| 347 #endif | 351 #endif |
| 348 } | 352 } |
| 349 | 353 |
| 350 void SafeBrowsingService::AddDownloadManager( | 354 void SafeBrowsingService::AddDownloadManager( |
| 351 content::DownloadManager* download_manager) { | 355 content::DownloadManager* download_manager) { |
| 352 #if defined(FULL_SAFE_BROWSING) | 356 #if defined(FULL_SAFE_BROWSING) |
| 353 if (incident_service_) | 357 if (incident_service_) |
| 354 incident_service_->AddDownloadManager(download_manager); | 358 incident_service_->AddDownloadManager(download_manager); |
|
mattm
2014/11/14 23:40:10
bad merge (missing endif)
gab
2014/11/18 17:23:20
Done.
| |
| 359 } | |
| 360 | |
| 361 void SafeBrowsingService::OnResourceRequest(const net::URLRequest* request) { | |
| 362 #if defined(FULL_SAFE_BROWSING) | |
| 363 if (off_domain_inclusion_detector_) | |
| 364 off_domain_inclusion_detector_->OnResourceRequest(request); | |
| 355 #endif | 365 #endif |
| 356 } | 366 } |
| 357 | 367 |
| 358 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { | 368 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { |
| 359 return new SafeBrowsingUIManager(this); | 369 return new SafeBrowsingUIManager(this); |
| 360 } | 370 } |
| 361 | 371 |
| 362 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { | 372 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { |
| 363 #if defined(FULL_SAFE_BROWSING) | 373 #if defined(FULL_SAFE_BROWSING) |
| 364 return new SafeBrowsingDatabaseManager(this); | 374 return new SafeBrowsingDatabaseManager(this); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 else | 579 else |
| 570 Stop(false); | 580 Stop(false); |
| 571 | 581 |
| 572 #if defined(FULL_SAFE_BROWSING) | 582 #if defined(FULL_SAFE_BROWSING) |
| 573 if (csd_service_) | 583 if (csd_service_) |
| 574 csd_service_->SetEnabledAndRefreshState(enable); | 584 csd_service_->SetEnabledAndRefreshState(enable); |
| 575 if (download_service_) | 585 if (download_service_) |
| 576 download_service_->SetEnabled(enable); | 586 download_service_->SetEnabled(enable); |
| 577 #endif | 587 #endif |
| 578 } | 588 } |
| OLD | NEW |