| 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/local_database_manager.h" | 5 #include "chrome/browser/safe_browsing/local_database_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| 23 #include "chrome/browser/prerender/prerender_field_trial.h" | 23 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| 25 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 25 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 26 #include "chrome/browser/safe_browsing/download_protection_service.h" | 26 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 27 #include "chrome/browser/safe_browsing/protocol_manager.h" | 27 #include "chrome/browser/safe_browsing/protocol_manager.h" |
| 28 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 28 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
| 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 30 #include "chrome/browser/safe_browsing/ui_manager.h" | 30 #include "chrome/browser/safe_browsing/ui_manager.h" |
| 31 #include "chrome/common/chrome_constants.h" | |
| 32 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 35 #include "components/prefs/pref_service.h" | 34 #include "components/prefs/pref_service.h" |
| 35 #include "components/safe_browsing/common/safebrowsing_switches.h" |
| 36 #include "components/safe_browsing_db/safe_browsing_prefs.h" | 36 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
| 37 #include "components/safe_browsing_db/util.h" | 37 #include "components/safe_browsing_db/util.h" |
| 38 #include "components/safe_browsing_db/v4_protocol_manager_util.h" | 38 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
| 41 #include "net/url_request/url_request_context_getter.h" | 41 #include "net/url_request/url_request_context_getter.h" |
| 42 #include "url/url_constants.h" | 42 #include "url/url_constants.h" |
| 43 | 43 |
| 44 using content::BrowserThread; | 44 using content::BrowserThread; |
| 45 | 45 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 enable_unwanted_software_blacklist_(true), | 280 enable_unwanted_software_blacklist_(true), |
| 281 enable_module_whitelist_(true), | 281 enable_module_whitelist_(true), |
| 282 update_in_progress_(false), | 282 update_in_progress_(false), |
| 283 database_update_in_progress_(false), | 283 database_update_in_progress_(false), |
| 284 closing_database_(false), | 284 closing_database_(false), |
| 285 check_timeout_(base::TimeDelta::FromMilliseconds(kCheckTimeoutMs)) { | 285 check_timeout_(base::TimeDelta::FromMilliseconds(kCheckTimeoutMs)) { |
| 286 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 286 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 287 DCHECK(sb_service_.get() != NULL); | 287 DCHECK(sb_service_.get() != NULL); |
| 288 | 288 |
| 289 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 289 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 290 enable_download_protection_ = | 290 enable_download_protection_ = !cmdline->HasSwitch( |
| 291 !cmdline->HasSwitch(switches::kSbDisableDownloadProtection); | 291 safe_browsing::switches::kSbDisableDownloadProtection); |
| 292 | 292 |
| 293 // We only download the csd-whitelist if client-side phishing detection is | 293 // We only download the csd-whitelist if client-side phishing detection is |
| 294 // enabled. | 294 // enabled. |
| 295 enable_csd_whitelist_ = | 295 enable_csd_whitelist_ = |
| 296 !cmdline->HasSwitch(switches::kDisableClientSidePhishingDetection); | 296 !cmdline->HasSwitch(::switches::kDisableClientSidePhishingDetection); |
| 297 | 297 |
| 298 // We download the download-whitelist if download protection is enabled. | 298 // We download the download-whitelist if download protection is enabled. |
| 299 enable_download_whitelist_ = enable_download_protection_; | 299 enable_download_whitelist_ = enable_download_protection_; |
| 300 | 300 |
| 301 // TODO(kalman): there really shouldn't be a flag for this. | 301 // TODO(kalman): there really shouldn't be a flag for this. |
| 302 enable_extension_blacklist_ = | 302 enable_extension_blacklist_ = !cmdline->HasSwitch( |
| 303 !cmdline->HasSwitch(switches::kSbDisableExtensionBlacklist); | 303 safe_browsing::switches::kSbDisableExtensionBlacklist); |
| 304 | 304 |
| 305 // The client-side IP blacklist feature is tightly integrated with client-side | 305 // The client-side IP blacklist feature is tightly integrated with client-side |
| 306 // phishing protection for now. | 306 // phishing protection for now. |
| 307 enable_ip_blacklist_ = enable_csd_whitelist_; | 307 enable_ip_blacklist_ = enable_csd_whitelist_; |
| 308 } | 308 } |
| 309 | 309 |
| 310 LocalSafeBrowsingDatabaseManager::~LocalSafeBrowsingDatabaseManager() { | 310 LocalSafeBrowsingDatabaseManager::~LocalSafeBrowsingDatabaseManager() { |
| 311 // The DCHECK is disabled due to crbug.com/438754. | 311 // The DCHECK is disabled due to crbug.com/438754. |
| 312 // DCHECK_CURRENTLY_ON(BrowserThread::UI); | 312 // DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 313 | 313 |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, | 1242 base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, |
| 1243 check_ptr->weak_ptr_factory_->GetWeakPtr(), check_ptr), | 1243 check_ptr->weak_ptr_factory_->GetWeakPtr(), check_ptr), |
| 1244 check_timeout_); | 1244 check_timeout_); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 bool LocalSafeBrowsingDatabaseManager::IsDownloadProtectionEnabled() const { | 1247 bool LocalSafeBrowsingDatabaseManager::IsDownloadProtectionEnabled() const { |
| 1248 return enable_download_protection_; | 1248 return enable_download_protection_; |
| 1249 } | 1249 } |
| 1250 | 1250 |
| 1251 } // namespace safe_browsing | 1251 } // namespace safe_browsing |
| OLD | NEW |