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

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

Issue 1117173004: Split cert reporter class into report building/serializing and sending (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move //c/b/ssl classes into global namespace Created 5 years, 7 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
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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE); 127 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE);
128 fetcher->SetRequestContext(request_context_getter_.get()); 128 fetcher->SetRequestContext(request_context_getter_.get());
129 fetcher->SetUploadData("application/octet-stream", report); 129 fetcher->SetUploadData("application/octet-stream", report);
130 // Don't try too hard to send reports on failures. 130 // Don't try too hard to send reports on failures.
131 fetcher->SetAutomaticallyRetryOn5xx(false); 131 fetcher->SetAutomaticallyRetryOn5xx(false);
132 fetcher->Start(); 132 fetcher->Start();
133 safebrowsing_reports_.insert(fetcher); 133 safebrowsing_reports_.insert(fetcher);
134 } 134 }
135 135
136 void SafeBrowsingPingManager::ReportInvalidCertificateChain( 136 void SafeBrowsingPingManager::ReportInvalidCertificateChain(
137 const std::string& hostname, 137 const std::string& serialized_report) {
138 const net::SSLInfo& ssl_info) {
139 DCHECK(certificate_error_reporter_); 138 DCHECK(certificate_error_reporter_);
140 certificate_error_reporter_->SendReport( 139 certificate_error_reporter_->SendReport(
141 CertificateErrorReporter::REPORT_TYPE_EXTENDED_REPORTING, hostname, 140 CertificateErrorReporter::REPORT_TYPE_EXTENDED_REPORTING,
142 ssl_info); 141 serialized_report);
143 } 142 }
144 143
145 void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting( 144 void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting(
146 scoped_ptr<CertificateErrorReporter> certificate_error_reporter) { 145 scoped_ptr<CertificateErrorReporter> certificate_error_reporter) {
147 certificate_error_reporter_ = certificate_error_reporter.Pass(); 146 certificate_error_reporter_ = certificate_error_reporter.Pass();
148 } 147 }
149 148
150 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( 149 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl(
151 const GURL& malicious_url, const GURL& page_url, 150 const GURL& malicious_url, const GURL& page_url,
152 const GURL& referrer_url, bool is_subresource, 151 const GURL& referrer_url, bool is_subresource,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 url_prefix_.c_str(), 195 url_prefix_.c_str(),
197 client_name_.c_str(), 196 client_name_.c_str(),
198 version_.c_str()); 197 version_.c_str());
199 std::string api_key = google_apis::GetAPIKey(); 198 std::string api_key = google_apis::GetAPIKey();
200 if (!api_key.empty()) { 199 if (!api_key.empty()) {
201 base::StringAppendF(&url, "&key=%s", 200 base::StringAppendF(&url, "&key=%s",
202 net::EscapeQueryParamValue(api_key, true).c_str()); 201 net::EscapeQueryParamValue(api_key, true).c_str());
203 } 202 }
204 return GURL(url); 203 return GURL(url);
205 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698