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 | 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 LocalSafeBrowsingDatabaseManager::LocalSafeBrowsingDatabaseManager( | 253 LocalSafeBrowsingDatabaseManager::LocalSafeBrowsingDatabaseManager( |
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 LocalSafeBrowsingDatabaseManager::~LocalSafeBrowsingDatabaseManager() { | 299 LocalSafeBrowsingDatabaseManager::~LocalSafeBrowsingDatabaseManager() { |
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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 check->weak_ptr_factory_->GetWeakPtr(), check)); | 1114 check->weak_ptr_factory_->GetWeakPtr(), check)); |
1119 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1115 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
1120 base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, | 1116 base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, |
1121 check->weak_ptr_factory_->GetWeakPtr(), check), | 1117 check->weak_ptr_factory_->GetWeakPtr(), check), |
1122 check_timeout_); | 1118 check_timeout_); |
1123 } | 1119 } |
1124 | 1120 |
1125 bool LocalSafeBrowsingDatabaseManager::download_protection_enabled() const { | 1121 bool LocalSafeBrowsingDatabaseManager::download_protection_enabled() const { |
1126 return enable_download_protection_; | 1122 return enable_download_protection_; |
1127 } | 1123 } |
OLD | NEW |