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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 344 } |
341 | 345 |
342 void SafeBrowsingService::RegisterDelayedAnalysisCallback( | 346 void SafeBrowsingService::RegisterDelayedAnalysisCallback( |
343 const safe_browsing::DelayedAnalysisCallback& callback) { | 347 const safe_browsing::DelayedAnalysisCallback& callback) { |
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 |
| 354 void SafeBrowsingService::OnResourceRequest(const net::URLRequest* request) { |
| 355 #if defined(FULL_SAFE_BROWSING) |
| 356 if (off_domain_inclusion_detector_) |
| 357 off_domain_inclusion_detector_->OnResourceRequest(request); |
| 358 #endif |
| 359 } |
| 360 |
350 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { | 361 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { |
351 return new SafeBrowsingUIManager(this); | 362 return new SafeBrowsingUIManager(this); |
352 } | 363 } |
353 | 364 |
354 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { | 365 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { |
355 #if defined(FULL_SAFE_BROWSING) | 366 #if defined(FULL_SAFE_BROWSING) |
356 return new SafeBrowsingDatabaseManager(this); | 367 return new SafeBrowsingDatabaseManager(this); |
357 #else | 368 #else |
358 return NULL; | 369 return NULL; |
359 #endif | 370 #endif |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 else | 572 else |
562 Stop(false); | 573 Stop(false); |
563 | 574 |
564 #if defined(FULL_SAFE_BROWSING) | 575 #if defined(FULL_SAFE_BROWSING) |
565 if (csd_service_) | 576 if (csd_service_) |
566 csd_service_->SetEnabledAndRefreshState(enable); | 577 csd_service_->SetEnabledAndRefreshState(enable); |
567 if (download_service_) | 578 if (download_service_) |
568 download_service_->SetEnabled(enable); | 579 download_service_->SetEnabled(enable); |
569 #endif | 580 #endif |
570 } | 581 } |
OLD | NEW |