| 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/database_manager.h" | 5 #include "chrome/browser/safe_browsing/database_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 SafeBrowsingDatabaseManager::SafeBrowsingDatabaseManager( | 253 SafeBrowsingDatabaseManager::SafeBrowsingDatabaseManager( |
| 254 const scoped_refptr<SafeBrowsingService>& service) | 254 const scoped_refptr<SafeBrowsingService>& service) |
| 255 : sb_service_(service), | 255 : sb_service_(service), |
| 256 database_(NULL), | 256 database_(NULL), |
| 257 enabled_(false), | 257 enabled_(false), |
| 258 enable_download_protection_(false), | 258 enable_download_protection_(false), |
| 259 enable_csd_whitelist_(false), | 259 enable_csd_whitelist_(false), |
| 260 enable_download_whitelist_(false), | 260 enable_download_whitelist_(false), |
| 261 enable_extension_blacklist_(false), | 261 enable_extension_blacklist_(false), |
| 262 enable_ip_blacklist_(false), | 262 enable_ip_blacklist_(false), |
| 263 enable_unwanted_software_blacklist_(false), | 263 enable_unwanted_software_blacklist_(true), |
| 264 update_in_progress_(false), | 264 update_in_progress_(false), |
| 265 database_update_in_progress_(false), | 265 database_update_in_progress_(false), |
| 266 closing_database_(false), | 266 closing_database_(false), |
| 267 check_timeout_(base::TimeDelta::FromMilliseconds(kCheckTimeoutMs)) { | 267 check_timeout_(base::TimeDelta::FromMilliseconds(kCheckTimeoutMs)) { |
| 268 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 268 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 269 DCHECK(sb_service_.get() != NULL); | 269 DCHECK(sb_service_.get() != NULL); |
| 270 | 270 |
| 271 // Android only supports a subset of FULL_SAFE_BROWSING. | 271 // Android only supports a subset of FULL_SAFE_BROWSING. |
| 272 // TODO(shess): This shouldn't be OS-driven <http://crbug.com/394379> | 272 // TODO(shess): This shouldn't be OS-driven <http://crbug.com/394379> |
| 273 #if !defined(OS_ANDROID) | 273 #if !defined(OS_ANDROID) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 286 // for the SafeBrowsing test to pass. | 286 // for the SafeBrowsing test to pass. |
| 287 enable_download_whitelist_ = enable_csd_whitelist_; | 287 enable_download_whitelist_ = enable_csd_whitelist_; |
| 288 | 288 |
| 289 // TODO(kalman): there really shouldn't be a flag for this. | 289 // TODO(kalman): there really shouldn't be a flag for this. |
| 290 enable_extension_blacklist_ = | 290 enable_extension_blacklist_ = |
| 291 !cmdline->HasSwitch(switches::kSbDisableExtensionBlacklist); | 291 !cmdline->HasSwitch(switches::kSbDisableExtensionBlacklist); |
| 292 | 292 |
| 293 // The client-side IP blacklist feature is tightly integrated with client-side | 293 // The client-side IP blacklist feature is tightly integrated with client-side |
| 294 // phishing protection for now. | 294 // phishing protection for now. |
| 295 enable_ip_blacklist_ = enable_csd_whitelist_; | 295 enable_ip_blacklist_ = enable_csd_whitelist_; |
| 296 | |
| 297 // The UwS blacklist feature is controlled by a flag for M40. | |
| 298 enable_unwanted_software_blacklist_ = | |
| 299 safe_browsing_util::GetUnwantedTrialGroup() > safe_browsing_util::UWS_OFF; | |
| 300 #endif | 296 #endif |
| 301 } | 297 } |
| 302 | 298 |
| 303 SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { | 299 SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { |
| 304 // The DCHECK is disabled due to crbug.com/438754. | 300 // The DCHECK is disabled due to crbug.com/438754. |
| 305 // DCHECK_CURRENTLY_ON(BrowserThread::UI); | 301 // DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 306 | 302 |
| 307 // We should have already been shut down. If we're still enabled, then the | 303 // We should have already been shut down. If we're still enabled, then the |
| 308 // database isn't going to be closed properly, which could lead to corruption. | 304 // database isn't going to be closed properly, which could lead to corruption. |
| 309 DCHECK(!enabled_); | 305 DCHECK(!enabled_); |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 | 1101 |
| 1106 base::PostTaskAndReplyWithResult( | 1102 base::PostTaskAndReplyWithResult( |
| 1107 safe_browsing_task_runner_.get(), FROM_HERE, task, | 1103 safe_browsing_task_runner_.get(), FROM_HERE, task, |
| 1108 base::Bind(&SafeBrowsingDatabaseManager::OnAsyncCheckDone, | 1104 base::Bind(&SafeBrowsingDatabaseManager::OnAsyncCheckDone, |
| 1109 check->weak_ptr_factory_->GetWeakPtr(), check)); | 1105 check->weak_ptr_factory_->GetWeakPtr(), check)); |
| 1110 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1106 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 1111 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, | 1107 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, |
| 1112 check->weak_ptr_factory_->GetWeakPtr(), check), | 1108 check->weak_ptr_factory_->GetWeakPtr(), check), |
| 1113 check_timeout_); | 1109 check_timeout_); |
| 1114 } | 1110 } |
| OLD | NEW |