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

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

Issue 1076273002: Add interstitial info to certificate reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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"
11 #include "chrome/browser/net/cert_logger.pb.h"
11 #include "chrome/browser/net/certificate_error_reporter.h" 12 #include "chrome/browser/net/certificate_error_reporter.h"
12 #include "chrome/common/env_vars.h" 13 #include "chrome/common/env_vars.h"
13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
14 #include "google_apis/google_api_keys.h" 15 #include "google_apis/google_api_keys.h"
15 #include "net/base/escape.h" 16 #include "net/base/escape.h"
16 #include "net/base/load_flags.h" 17 #include "net/base/load_flags.h"
17 #include "net/ssl/ssl_info.h" 18 #include "net/ssl/ssl_info.h"
18 #include "net/url_request/url_fetcher.h" 19 #include "net/url_request/url_fetcher.h"
19 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
20 #include "net/url_request/url_request_status.h" 21 #include "net/url_request/url_request_status.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE); 107 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE);
107 fetcher->SetRequestContext(request_context_getter_.get()); 108 fetcher->SetRequestContext(request_context_getter_.get());
108 fetcher->SetUploadData("application/octet-stream", report); 109 fetcher->SetUploadData("application/octet-stream", report);
109 // Don't try too hard to send reports on failures. 110 // Don't try too hard to send reports on failures.
110 fetcher->SetAutomaticallyRetryOn5xx(false); 111 fetcher->SetAutomaticallyRetryOn5xx(false);
111 fetcher->Start(); 112 fetcher->Start();
112 safebrowsing_reports_.insert(fetcher); 113 safebrowsing_reports_.insert(fetcher);
113 } 114 }
114 115
115 void SafeBrowsingPingManager::ReportInvalidCertificateChain( 116 void SafeBrowsingPingManager::ReportInvalidCertificateChain(
116 const std::string& hostname, 117 const chrome_browser_net::CertLoggerRequest& report) {
117 const net::SSLInfo& ssl_info) {
118 DCHECK(certificate_error_reporter_); 118 DCHECK(certificate_error_reporter_);
119 certificate_error_reporter_->SendReport( 119 certificate_error_reporter_->SendReport(
120 CertificateErrorReporter::REPORT_TYPE_EXTENDED_REPORTING, hostname, 120 CertificateErrorReporter::REPORT_TYPE_EXTENDED_REPORTING, report);
121 ssl_info);
122 } 121 }
123 122
124 void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting( 123 void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting(
125 scoped_ptr<CertificateErrorReporter> certificate_error_reporter) { 124 scoped_ptr<CertificateErrorReporter> certificate_error_reporter) {
126 certificate_error_reporter_ = certificate_error_reporter.Pass(); 125 certificate_error_reporter_ = certificate_error_reporter.Pass();
127 } 126 }
128 127
129 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( 128 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl(
130 const GURL& malicious_url, const GURL& page_url, 129 const GURL& malicious_url, const GURL& page_url,
131 const GURL& referrer_url, bool is_subresource, 130 const GURL& referrer_url, bool is_subresource,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 url_prefix_.c_str(), 174 url_prefix_.c_str(),
176 client_name_.c_str(), 175 client_name_.c_str(),
177 version_.c_str()); 176 version_.c_str());
178 std::string api_key = google_apis::GetAPIKey(); 177 std::string api_key = google_apis::GetAPIKey();
179 if (!api_key.empty()) { 178 if (!api_key.empty()) {
180 base::StringAppendF(&url, "&key=%s", 179 base::StringAppendF(&url, "&key=%s",
181 net::EscapeQueryParamValue(api_key, true).c_str()); 180 net::EscapeQueryParamValue(api_key, true).c_str());
182 } 181 }
183 return GURL(url); 182 return GURL(url);
184 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698