Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1115)

Side by Side Diff: chrome/browser/safe_browsing/local_database_manager.cc

Issue 1402783005: Remove safe_browsing=2 functionality, replace with =3 mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix up histograms Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 enable_extension_blacklist_(false), 266 enable_extension_blacklist_(false),
267 enable_ip_blacklist_(false), 267 enable_ip_blacklist_(false),
268 enable_unwanted_software_blacklist_(true), 268 enable_unwanted_software_blacklist_(true),
269 update_in_progress_(false), 269 update_in_progress_(false),
270 database_update_in_progress_(false), 270 database_update_in_progress_(false),
271 closing_database_(false), 271 closing_database_(false),
272 check_timeout_(base::TimeDelta::FromMilliseconds(kCheckTimeoutMs)) { 272 check_timeout_(base::TimeDelta::FromMilliseconds(kCheckTimeoutMs)) {
273 DCHECK_CURRENTLY_ON(BrowserThread::UI); 273 DCHECK_CURRENTLY_ON(BrowserThread::UI);
274 DCHECK(sb_service_.get() != NULL); 274 DCHECK(sb_service_.get() != NULL);
275 275
276 // Android only supports a subset of FULL_SAFE_BROWSING.
277 // TODO(shess): This shouldn't be OS-driven <http://crbug.com/394379>
278 #if !defined(OS_ANDROID)
279 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); 276 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
280 enable_download_protection_ = 277 enable_download_protection_ =
281 !cmdline->HasSwitch(switches::kSbDisableDownloadProtection); 278 !cmdline->HasSwitch(switches::kSbDisableDownloadProtection);
282 279
283 // We only download the csd-whitelist if client-side phishing detection is 280 // We only download the csd-whitelist if client-side phishing detection is
284 // enabled. 281 // enabled.
285 enable_csd_whitelist_ = 282 enable_csd_whitelist_ =
286 !cmdline->HasSwitch(switches::kDisableClientSidePhishingDetection); 283 !cmdline->HasSwitch(switches::kDisableClientSidePhishingDetection);
287 284
288 // TODO(noelutz): remove this boolean variable since it should always be true 285 // TODO(noelutz): remove this boolean variable since it should always be true
289 // if SafeBrowsing is enabled. Unfortunately, we have no test data for this 286 // if SafeBrowsing is enabled. Unfortunately, we have no test data for this
290 // list right now. This means that we need to be able to disable this list 287 // list right now. This means that we need to be able to disable this list
291 // for the SafeBrowsing test to pass. 288 // for the SafeBrowsing test to pass.
292 enable_download_whitelist_ = enable_csd_whitelist_; 289 enable_download_whitelist_ = enable_csd_whitelist_;
293 290
294 // TODO(kalman): there really shouldn't be a flag for this. 291 // TODO(kalman): there really shouldn't be a flag for this.
295 enable_extension_blacklist_ = 292 enable_extension_blacklist_ =
296 !cmdline->HasSwitch(switches::kSbDisableExtensionBlacklist); 293 !cmdline->HasSwitch(switches::kSbDisableExtensionBlacklist);
297 294
298 // The client-side IP blacklist feature is tightly integrated with client-side 295 // The client-side IP blacklist feature is tightly integrated with client-side
299 // phishing protection for now. 296 // phishing protection for now.
300 enable_ip_blacklist_ = enable_csd_whitelist_; 297 enable_ip_blacklist_ = enable_csd_whitelist_;
301 #endif
302 } 298 }
303 299
304 LocalSafeBrowsingDatabaseManager::~LocalSafeBrowsingDatabaseManager() { 300 LocalSafeBrowsingDatabaseManager::~LocalSafeBrowsingDatabaseManager() {
305 // The DCHECK is disabled due to crbug.com/438754. 301 // The DCHECK is disabled due to crbug.com/438754.
306 // DCHECK_CURRENTLY_ON(BrowserThread::UI); 302 // DCHECK_CURRENTLY_ON(BrowserThread::UI);
307 303
308 // We should have already been shut down. If we're still enabled, then the 304 // We should have already been shut down. If we're still enabled, then the
309 // database isn't going to be closed properly, which could lead to corruption. 305 // database isn't going to be closed properly, which could lead to corruption.
310 DCHECK(!enabled_); 306 DCHECK(!enabled_);
311 } 307 }
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 check->weak_ptr_factory_->GetWeakPtr(), check)); 1172 check->weak_ptr_factory_->GetWeakPtr(), check));
1177 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1173 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1178 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, 1174 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback,
1179 check->weak_ptr_factory_->GetWeakPtr(), check), 1175 check->weak_ptr_factory_->GetWeakPtr(), check),
1180 check_timeout_); 1176 check_timeout_);
1181 } 1177 }
1182 1178
1183 bool LocalSafeBrowsingDatabaseManager::download_protection_enabled() const { 1179 bool LocalSafeBrowsingDatabaseManager::download_protection_enabled() const {
1184 return enable_download_protection_; 1180 return enable_download_protection_;
1185 } 1181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698