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

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

Issue 2026213002: Refactor CertificateReportSender (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "components/certificate_reporting/error_reporter.h" 13 #include "components/certificate_reporting/error_reporter.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "google_apis/google_api_keys.h" 15 #include "google_apis/google_api_keys.h"
16 #include "net/base/escape.h" 16 #include "net/base/escape.h"
17 #include "net/base/load_flags.h" 17 #include "net/base/load_flags.h"
18 #include "net/ssl/ssl_info.h" 18 #include "net/ssl/ssl_info.h"
19 #include "net/url_request/certificate_report_sender.h" 19 #include "net/url_request/report_sender.h"
20 #include "net/url_request/url_fetcher.h" 20 #include "net/url_request/url_fetcher.h"
21 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
22 #include "net/url_request/url_request_status.h" 22 #include "net/url_request/url_request_status.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 using content::BrowserThread; 25 using content::BrowserThread;
26 26
27 namespace { 27 namespace {
28 // URLs to upload invalid certificate chain reports. The HTTP URL is 28 // URLs to upload invalid certificate chain reports. The HTTP URL is
29 // preferred since a client seeing an invalid cert might not be able to 29 // preferred since a client seeing an invalid cert might not be able to
(...skipping 24 matching lines...) Expand all
54 request_context_getter_(request_context_getter), 54 request_context_getter_(request_context_getter),
55 url_prefix_(config.url_prefix) { 55 url_prefix_(config.url_prefix) {
56 DCHECK(!url_prefix_.empty()); 56 DCHECK(!url_prefix_.empty());
57 57
58 if (request_context_getter) { 58 if (request_context_getter) {
59 // Set the upload URL and whether or not to send cookies with 59 // Set the upload URL and whether or not to send cookies with
60 // certificate reports sent to Safe Browsing servers. 60 // certificate reports sent to Safe Browsing servers.
61 bool use_insecure_certificate_upload_url = 61 bool use_insecure_certificate_upload_url =
62 certificate_reporting::ErrorReporter::IsHttpUploadUrlSupported(); 62 certificate_reporting::ErrorReporter::IsHttpUploadUrlSupported();
63 63
64 net::CertificateReportSender::CookiesPreference cookies_preference; 64 net::ReportSender::CookiesPreference cookies_preference;
65 GURL certificate_upload_url; 65 GURL certificate_upload_url;
66 if (use_insecure_certificate_upload_url) { 66 if (use_insecure_certificate_upload_url) {
67 cookies_preference = net::CertificateReportSender::DO_NOT_SEND_COOKIES; 67 cookies_preference = net::ReportSender::DO_NOT_SEND_COOKIES;
68 certificate_upload_url = GURL(kExtendedReportingUploadUrlInsecure); 68 certificate_upload_url = GURL(kExtendedReportingUploadUrlInsecure);
69 } else { 69 } else {
70 cookies_preference = net::CertificateReportSender::SEND_COOKIES; 70 cookies_preference = net::ReportSender::SEND_COOKIES;
71 certificate_upload_url = GURL(kExtendedReportingUploadUrlSecure); 71 certificate_upload_url = GURL(kExtendedReportingUploadUrlSecure);
72 } 72 }
73 73
74 certificate_error_reporter_.reset(new certificate_reporting::ErrorReporter( 74 certificate_error_reporter_.reset(new certificate_reporting::ErrorReporter(
75 request_context_getter->GetURLRequestContext(), certificate_upload_url, 75 request_context_getter->GetURLRequestContext(), certificate_upload_url,
76 cookies_preference)); 76 cookies_preference));
77 } 77 }
78 78
79 version_ = SafeBrowsingProtocolManagerHelper::Version(); 79 version_ = SafeBrowsingProtocolManagerHelper::Version();
80 } 80 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 version_.c_str()); 231 version_.c_str());
232 std::string api_key = google_apis::GetAPIKey(); 232 std::string api_key = google_apis::GetAPIKey();
233 if (!api_key.empty()) { 233 if (!api_key.empty()) {
234 base::StringAppendF(&url, "&key=%s", 234 base::StringAppendF(&url, "&key=%s",
235 net::EscapeQueryParamValue(api_key, true).c_str()); 235 net::EscapeQueryParamValue(api_key, true).c_str());
236 } 236 }
237 return GURL(url); 237 return GURL(url);
238 } 238 }
239 239
240 } // namespace safe_browsing 240 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.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