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

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

Issue 3028040: Report malware redirectors as well. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/protocol_manager.h" 5 #include "chrome/browser/safe_browsing/protocol_manager.h"
6 6
7 #ifndef NDEBUG 7 #ifndef NDEBUG
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #endif 9 #endif
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 if (chunk_request_urls_.empty()) { 582 if (chunk_request_urls_.empty()) {
583 UMA_HISTOGRAM_LONG_TIMES("SB2.Update", Time::Now() - last_update_); 583 UMA_HISTOGRAM_LONG_TIMES("SB2.Update", Time::Now() - last_update_);
584 UpdateFinished(true); 584 UpdateFinished(true);
585 } else { 585 } else {
586 IssueChunkRequest(); 586 IssueChunkRequest();
587 } 587 }
588 } 588 }
589 589
590 void SafeBrowsingProtocolManager::ReportMalware(const GURL& malware_url, 590 void SafeBrowsingProtocolManager::ReportMalware(const GURL& malware_url,
591 const GURL& page_url, 591 const GURL& page_url,
592 const GURL& referrer_url) { 592 const GURL& referrer_url,
593 GURL report_url = MalwareReportUrl(malware_url, page_url, referrer_url); 593 bool is_subresource) {
594 GURL report_url = MalwareReportUrl(malware_url, page_url, referrer_url,
595 is_subresource);
594 URLFetcher* report = new URLFetcher(report_url, URLFetcher::GET, this); 596 URLFetcher* report = new URLFetcher(report_url, URLFetcher::GET, this);
595 report->set_load_flags(net::LOAD_DISABLE_CACHE); 597 report->set_load_flags(net::LOAD_DISABLE_CACHE);
596 report->set_request_context(request_context_getter_); 598 report->set_request_context(request_context_getter_);
597 report->Start(); 599 report->Start();
598 malware_reports_.insert(report); 600 malware_reports_.insert(report);
599 } 601 }
600 602
601 // static 603 // static
602 std::string SafeBrowsingProtocolManager::FormatList( 604 std::string SafeBrowsingProtocolManager::FormatList(
603 const SBListChunkRanges& list, bool use_mac) { 605 const SBListChunkRanges& list, bool use_mac) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 return GURL(url); 675 return GURL(url);
674 } 676 }
675 677
676 GURL SafeBrowsingProtocolManager::MacKeyUrl() const { 678 GURL SafeBrowsingProtocolManager::MacKeyUrl() const {
677 return GURL(ComposeUrl(mackey_url_prefix_, "newkey", client_name_, version_, 679 return GURL(ComposeUrl(mackey_url_prefix_, "newkey", client_name_, version_,
678 additional_query_)); 680 additional_query_));
679 } 681 }
680 682
681 GURL SafeBrowsingProtocolManager::MalwareReportUrl( 683 GURL SafeBrowsingProtocolManager::MalwareReportUrl(
682 const GURL& malware_url, const GURL& page_url, 684 const GURL& malware_url, const GURL& page_url,
683 const GURL& referrer_url) const { 685 const GURL& referrer_url, bool is_subresource) const {
684 std::string url = ComposeUrl(info_url_prefix_, "report", client_name_, 686 std::string url = ComposeUrl(info_url_prefix_, "report", client_name_,
685 version_, additional_query_); 687 version_, additional_query_);
686 return GURL(StringPrintf("%s&evts=malblhit&evtd=%s&evtr=%s&evhr=%s", 688 return GURL(StringPrintf("%s&evts=malblhit&evtd=%s&evtr=%s&evhr=%s&evtb=%d",
687 url.c_str(), EscapeQueryParamValue(malware_url.spec(), true).c_str(), 689 url.c_str(), EscapeQueryParamValue(malware_url.spec(), true).c_str(),
688 EscapeQueryParamValue(page_url.spec(), true).c_str(), 690 EscapeQueryParamValue(page_url.spec(), true).c_str(),
689 EscapeQueryParamValue(referrer_url.spec(), true).c_str())); 691 EscapeQueryParamValue(referrer_url.spec(), true).c_str(),
692 is_subresource));
690 } 693 }
691 694
692 GURL SafeBrowsingProtocolManager::NextChunkUrl(const std::string& url) const { 695 GURL SafeBrowsingProtocolManager::NextChunkUrl(const std::string& url) const {
693 std::string next_url; 696 std::string next_url;
694 if (!StartsWithASCII(url, "http://", false) && 697 if (!StartsWithASCII(url, "http://", false) &&
695 !StartsWithASCII(url, "https://", false)) { 698 !StartsWithASCII(url, "https://", false)) {
696 next_url = "http://" + url; 699 next_url = "http://" + url;
697 } else { 700 } else {
698 next_url = url; 701 next_url = url;
699 } 702 }
700 if (!additional_query_.empty()) 703 if (!additional_query_.empty())
701 next_url += additional_query_; 704 next_url += additional_query_;
702 return GURL(next_url); 705 return GURL(next_url);
703 } 706 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.h ('k') | chrome/browser/safe_browsing/protocol_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698