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

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

Issue 392373002: [safe browsing] Mobile requests different malware and phishing lists. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change hard-coded default lists for Android tests. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/protocol_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 enable_download_whitelist_(false), 206 enable_download_whitelist_(false),
207 enable_extension_blacklist_(false), 207 enable_extension_blacklist_(false),
208 enable_side_effect_free_whitelist_(false), 208 enable_side_effect_free_whitelist_(false),
209 enable_ip_blacklist_(false), 209 enable_ip_blacklist_(false),
210 update_in_progress_(false), 210 update_in_progress_(false),
211 database_update_in_progress_(false), 211 database_update_in_progress_(false),
212 closing_database_(false), 212 closing_database_(false),
213 check_timeout_(base::TimeDelta::FromMilliseconds(kCheckTimeoutMs)) { 213 check_timeout_(base::TimeDelta::FromMilliseconds(kCheckTimeoutMs)) {
214 DCHECK(sb_service_.get() != NULL); 214 DCHECK(sb_service_.get() != NULL);
215 215
216 // Android only supports a subset of FULL_SAFE_BROWSING.
217 // TODO(shess): This shouldn't be OS-driven <http://crbug.com/394379>
218 #if !defined(OS_ANDROID)
216 CommandLine* cmdline = CommandLine::ForCurrentProcess(); 219 CommandLine* cmdline = CommandLine::ForCurrentProcess();
217 enable_download_protection_ = 220 enable_download_protection_ =
218 !cmdline->HasSwitch(switches::kSbDisableDownloadProtection); 221 !cmdline->HasSwitch(switches::kSbDisableDownloadProtection);
219 222
220 // We only download the csd-whitelist if client-side phishing detection is 223 // We only download the csd-whitelist if client-side phishing detection is
221 // enabled. 224 // enabled.
222 enable_csd_whitelist_ = 225 enable_csd_whitelist_ =
223 !cmdline->HasSwitch(switches::kDisableClientSidePhishingDetection); 226 !cmdline->HasSwitch(switches::kDisableClientSidePhishingDetection);
224 227
225 // TODO(noelutz): remove this boolean variable since it should always be true 228 // TODO(noelutz): remove this boolean variable since it should always be true
(...skipping 20 matching lines...) Expand all
246 SIDE_EFFECT_FREE_WHITELIST_STATUS_MAX 249 SIDE_EFFECT_FREE_WHITELIST_STATUS_MAX
247 }; 250 };
248 251
249 SideEffectFreeWhitelistStatus side_effect_free_whitelist_status = 252 SideEffectFreeWhitelistStatus side_effect_free_whitelist_status =
250 enable_side_effect_free_whitelist_ ? SIDE_EFFECT_FREE_WHITELIST_ENABLED : 253 enable_side_effect_free_whitelist_ ? SIDE_EFFECT_FREE_WHITELIST_ENABLED :
251 SIDE_EFFECT_FREE_WHITELIST_DISABLED; 254 SIDE_EFFECT_FREE_WHITELIST_DISABLED;
252 255
253 UMA_HISTOGRAM_ENUMERATION("SB2.SideEffectFreeWhitelistStatus", 256 UMA_HISTOGRAM_ENUMERATION("SB2.SideEffectFreeWhitelistStatus",
254 side_effect_free_whitelist_status, 257 side_effect_free_whitelist_status,
255 SIDE_EFFECT_FREE_WHITELIST_STATUS_MAX); 258 SIDE_EFFECT_FREE_WHITELIST_STATUS_MAX);
259 #endif
256 } 260 }
257 261
258 SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { 262 SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() {
259 // We should have already been shut down. If we're still enabled, then the 263 // We should have already been shut down. If we're still enabled, then the
260 // database isn't going to be closed properly, which could lead to corruption. 264 // database isn't going to be closed properly, which could lead to corruption.
261 DCHECK(!enabled_); 265 DCHECK(!enabled_);
262 } 266 }
263 267
264 bool SafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const { 268 bool SafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const {
265 return url.SchemeIs(url::kFtpScheme) || 269 return url.SchemeIs(url::kFtpScheme) ||
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); 1060 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this));
1057 checks_.insert(check); 1061 checks_.insert(check);
1058 1062
1059 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); 1063 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task);
1060 1064
1061 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, 1065 base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
1062 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, 1066 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback,
1063 check->timeout_factory_->GetWeakPtr(), check), 1067 check->timeout_factory_->GetWeakPtr(), check),
1064 check_timeout_); 1068 check_timeout_);
1065 } 1069 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/protocol_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698