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

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

Issue 8600006: Track download request time and always send back the hash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Err. Created 9 years, 1 month 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 | « chrome/browser/safe_browsing/download_protection_service.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 // Only report SafeBrowsing related stats when UMA is enabled. User must also 234 // Only report SafeBrowsing related stats when UMA is enabled. User must also
235 // ensure that safe browsing is enabled from the calling profile. 235 // ensure that safe browsing is enabled from the calling profile.
236 bool SafeBrowsingService::CanReportStats() const { 236 bool SafeBrowsingService::CanReportStats() const {
237 const MetricsService* metrics = g_browser_process->metrics_service(); 237 const MetricsService* metrics = g_browser_process->metrics_service();
238 return metrics && metrics->reporting_active(); 238 return metrics && metrics->reporting_active();
239 } 239 }
240 240
241 // Binhash verification is only enabled for UMA users for now. 241 // Binhash verification is only enabled for UMA users for now.
242 bool SafeBrowsingService::DownloadBinHashNeeded() const { 242 bool SafeBrowsingService::DownloadBinHashNeeded() const {
243 return enable_download_protection_ && CanReportStats(); 243 return (enable_download_protection_ && CanReportStats()) ||
244 (download_protection_service() &&
245 download_protection_service()->enabled());
244 } 246 }
245 247
246 bool SafeBrowsingService::CheckDownloadUrl(const std::vector<GURL>& url_chain, 248 bool SafeBrowsingService::CheckDownloadUrl(const std::vector<GURL>& url_chain,
247 Client* client) { 249 Client* client) {
248 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
249 if (!enabled_ || !enable_download_protection_) 251 if (!enabled_ || !enable_download_protection_)
250 return true; 252 return true;
251 253
252 // We need to check the database for url prefix, and later may fetch the url 254 // We need to check the database for url prefix, and later may fetch the url
253 // from the safebrowsing backends. These need to be asynchronous. 255 // from the safebrowsing backends. These need to be asynchronous.
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 Stop(); 1348 Stop();
1347 1349
1348 if (csd_service_.get()) 1350 if (csd_service_.get())
1349 csd_service_->SetEnabledAndRefreshState(enable); 1351 csd_service_->SetEnabledAndRefreshState(enable);
1350 if (download_service_.get()) { 1352 if (download_service_.get()) {
1351 download_service_->SetEnabled( 1353 download_service_->SetEnabled(
1352 enable && !CommandLine::ForCurrentProcess()->HasSwitch( 1354 enable && !CommandLine::ForCurrentProcess()->HasSwitch(
1353 switches::kDisableImprovedDownloadProtection)); 1355 switches::kDisableImprovedDownloadProtection));
1354 } 1356 }
1355 } 1357 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/download_protection_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698