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

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

Issue 1212973002: Add net::CertificateReportSender for handling cert report sending (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing NET_EXPORT Created 5 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
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/certificate_error_reporter.h" 11 #include "chrome/browser/net/certificate_error_reporter.h"
12 #include "chrome/common/env_vars.h" 12 #include "chrome/common/env_vars.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "google_apis/google_api_keys.h" 14 #include "google_apis/google_api_keys.h"
15 #include "net/base/escape.h" 15 #include "net/base/escape.h"
16 #include "net/base/load_flags.h" 16 #include "net/base/load_flags.h"
17 #include "net/ssl/ssl_info.h" 17 #include "net/ssl/ssl_info.h"
18 #include "net/url_request/certificate_report_sender.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"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
23 using chrome_browser_net::CertificateErrorReporter; 24 using chrome_browser_net::CertificateErrorReporter;
24 using content::BrowserThread; 25 using content::BrowserThread;
25 26
26 namespace { 27 namespace {
27 // URLs to upload invalid certificate chain reports. The HTTP URL is 28 // URLs to upload invalid certificate chain reports. The HTTP URL is
(...skipping 23 matching lines...) Expand all
51 request_context_getter_(request_context_getter), 52 request_context_getter_(request_context_getter),
52 url_prefix_(config.url_prefix) { 53 url_prefix_(config.url_prefix) {
53 DCHECK(!url_prefix_.empty()); 54 DCHECK(!url_prefix_.empty());
54 55
55 if (request_context_getter) { 56 if (request_context_getter) {
56 // Set the upload URL and whether or not to send cookies with 57 // Set the upload URL and whether or not to send cookies with
57 // certificate reports sent to Safe Browsing servers. 58 // certificate reports sent to Safe Browsing servers.
58 bool use_insecure_certificate_upload_url = 59 bool use_insecure_certificate_upload_url =
59 CertificateErrorReporter::IsHttpUploadUrlSupported(); 60 CertificateErrorReporter::IsHttpUploadUrlSupported();
60 61
61 CertificateErrorReporter::CookiesPreference cookies_preference; 62 net::CertificateReportSender::CookiesPreference cookies_preference;
62 GURL certificate_upload_url; 63 GURL certificate_upload_url;
63 if (use_insecure_certificate_upload_url) { 64 if (use_insecure_certificate_upload_url) {
64 cookies_preference = CertificateErrorReporter::DO_NOT_SEND_COOKIES; 65 cookies_preference = net::CertificateReportSender::DO_NOT_SEND_COOKIES;
65 certificate_upload_url = GURL(kExtendedReportingUploadUrlInsecure); 66 certificate_upload_url = GURL(kExtendedReportingUploadUrlInsecure);
66 } else { 67 } else {
67 cookies_preference = CertificateErrorReporter::SEND_COOKIES; 68 cookies_preference = net::CertificateReportSender::SEND_COOKIES;
68 certificate_upload_url = GURL(kExtendedReportingUploadUrlSecure); 69 certificate_upload_url = GURL(kExtendedReportingUploadUrlSecure);
69 } 70 }
70 71
71 certificate_error_reporter_.reset(new CertificateErrorReporter( 72 certificate_error_reporter_.reset(new CertificateErrorReporter(
72 request_context_getter->GetURLRequestContext(), certificate_upload_url, 73 request_context_getter->GetURLRequestContext(), certificate_upload_url,
73 cookies_preference)); 74 cookies_preference));
74 } 75 }
75 76
76 version_ = SafeBrowsingProtocolManagerHelper::Version(); 77 version_ = SafeBrowsingProtocolManagerHelper::Version();
77 } 78 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 url_prefix_.c_str(), 196 url_prefix_.c_str(),
196 client_name_.c_str(), 197 client_name_.c_str(),
197 version_.c_str()); 198 version_.c_str());
198 std::string api_key = google_apis::GetAPIKey(); 199 std::string api_key = google_apis::GetAPIKey();
199 if (!api_key.empty()) { 200 if (!api_key.empty()) {
200 base::StringAppendF(&url, "&key=%s", 201 base::StringAppendF(&url, "&key=%s",
201 net::EscapeQueryParamValue(api_key, true).c_str()); 202 net::EscapeQueryParamValue(api_key, true).c_str());
202 } 203 }
203 return GURL(url); 204 return GURL(url);
204 } 205 }
OLDNEW
« no previous file with comments | « chrome/browser/net/certificate_error_reporter_unittest.cc ('k') | chrome/browser/ssl/certificate_reporting_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698