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

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

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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) 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/ping_manager.h" 5 #include "chrome/browser/safe_browsing/ping_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 SBThreatType threat_type, 74 SBThreatType threat_type,
75 const std::string& post_data) { 75 const std::string& post_data) {
76 GURL report_url = SafeBrowsingHitUrl(malicious_url, page_url, 76 GURL report_url = SafeBrowsingHitUrl(malicious_url, page_url,
77 referrer_url, is_subresource, 77 referrer_url, is_subresource,
78 threat_type); 78 threat_type);
79 net::URLFetcher* report = net::URLFetcher::Create( 79 net::URLFetcher* report = net::URLFetcher::Create(
80 report_url, 80 report_url,
81 post_data.empty() ? net::URLFetcher::GET : net::URLFetcher::POST, 81 post_data.empty() ? net::URLFetcher::GET : net::URLFetcher::POST,
82 this); 82 this);
83 report->SetLoadFlags(net::LOAD_DISABLE_CACHE); 83 report->SetLoadFlags(net::LOAD_DISABLE_CACHE);
84 report->SetRequestContext(request_context_getter_); 84 report->SetRequestContext(request_context_getter_.get());
85 if (!post_data.empty()) 85 if (!post_data.empty())
86 report->SetUploadData("text/plain", post_data); 86 report->SetUploadData("text/plain", post_data);
87 safebrowsing_reports_.insert(report); 87 safebrowsing_reports_.insert(report);
88 report->Start(); 88 report->Start();
89 } 89 }
90 90
91 // Sends malware details for users who opt-in. 91 // Sends malware details for users who opt-in.
92 void SafeBrowsingPingManager::ReportMalwareDetails( 92 void SafeBrowsingPingManager::ReportMalwareDetails(
93 const std::string& report) { 93 const std::string& report) {
94 GURL report_url = MalwareDetailsUrl(); 94 GURL report_url = MalwareDetailsUrl();
95 net::URLFetcher* fetcher = net::URLFetcher::Create( 95 net::URLFetcher* fetcher = net::URLFetcher::Create(
96 report_url, net::URLFetcher::POST, this); 96 report_url, net::URLFetcher::POST, this);
97 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE); 97 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE);
98 fetcher->SetRequestContext(request_context_getter_); 98 fetcher->SetRequestContext(request_context_getter_.get());
99 fetcher->SetUploadData("application/octet-stream", report); 99 fetcher->SetUploadData("application/octet-stream", report);
100 // Don't try too hard to send reports on failures. 100 // Don't try too hard to send reports on failures.
101 fetcher->SetAutomaticallyRetryOn5xx(false); 101 fetcher->SetAutomaticallyRetryOn5xx(false);
102 fetcher->Start(); 102 fetcher->Start();
103 safebrowsing_reports_.insert(fetcher); 103 safebrowsing_reports_.insert(fetcher);
104 } 104 }
105 105
106 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( 106 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl(
107 const GURL& malicious_url, const GURL& page_url, 107 const GURL& malicious_url, const GURL& page_url,
108 const GURL& referrer_url, bool is_subresource, 108 const GURL& referrer_url, bool is_subresource,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 url_prefix_.c_str(), 148 url_prefix_.c_str(),
149 client_name_.c_str(), 149 client_name_.c_str(),
150 version_.c_str()); 150 version_.c_str());
151 std::string api_key = google_apis::GetAPIKey(); 151 std::string api_key = google_apis::GetAPIKey();
152 if (!api_key.empty()) { 152 if (!api_key.empty()) {
153 base::StringAppendF(&url, "&key=%s", 153 base::StringAppendF(&url, "&key=%s",
154 net::EscapeQueryParamValue(api_key, true).c_str()); 154 net::EscapeQueryParamValue(api_key, true).c_str());
155 } 155 }
156 return GURL(url); 156 return GURL(url);
157 } 157 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/malware_details_unittest.cc ('k') | chrome/browser/safe_browsing/protocol_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698