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

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

Issue 8638002: Don't send file URLs for download protection server pings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | chrome/browser/safe_browsing/download_protection_service_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) 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/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 351 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
352 // TODO(noelutz): implement some cache to make sure we don't issue the same 352 // TODO(noelutz): implement some cache to make sure we don't issue the same
353 // request over and over again if a user downloads the same binary multiple 353 // request over and over again if a user downloads the same binary multiple
354 // times. 354 // times.
355 if (info_.download_url_chain.empty()) { 355 if (info_.download_url_chain.empty()) {
356 RecordImprovedProtectionStats(REASON_EMPTY_URL_CHAIN); 356 RecordImprovedProtectionStats(REASON_EMPTY_URL_CHAIN);
357 PostFinishTask(SAFE); 357 PostFinishTask(SAFE);
358 return; 358 return;
359 } 359 }
360 const GURL& final_url = info_.download_url_chain.back(); 360 const GURL& final_url = info_.download_url_chain.back();
361 if (!final_url.is_valid() || final_url.is_empty()) { 361 if (!final_url.is_valid() || final_url.is_empty() ||
362 !final_url.IsStandard() || final_url.SchemeIsFile()) {
362 RecordImprovedProtectionStats(REASON_INVALID_URL); 363 RecordImprovedProtectionStats(REASON_INVALID_URL);
363 PostFinishTask(SAFE); 364 PostFinishTask(SAFE);
364 return; 365 return;
365 } 366 }
366 RecordFileExtensionType(info_.target_file); 367 RecordFileExtensionType(info_.target_file);
367 368
368 if (final_url.SchemeIs("https") || !IsBinaryFile(info_.target_file)) { 369 if (final_url.SchemeIs("https") || !IsBinaryFile(info_.target_file)) {
369 RecordImprovedProtectionStats(final_url.SchemeIs("https") ? 370 RecordImprovedProtectionStats(final_url.SchemeIs("https") ?
370 REASON_HTTPS_URL : REASON_NOT_BINARY_FILE); 371 REASON_HTTPS_URL : REASON_NOT_BINARY_FILE);
371 BrowserThread::PostTask( 372 BrowserThread::PostTask(
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 694
694 void DownloadProtectionService::RequestFinished( 695 void DownloadProtectionService::RequestFinished(
695 CheckClientDownloadRequest* request) { 696 CheckClientDownloadRequest* request) {
696 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 697 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
697 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = 698 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it =
698 download_requests_.find(request); 699 download_requests_.find(request);
699 DCHECK(it != download_requests_.end()); 700 DCHECK(it != download_requests_.end());
700 download_requests_.erase(*it); 701 download_requests_.erase(*it);
701 } 702 }
702 } // namespace safe_browsing 703 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698