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

Side by Side Diff: components/certificate_reporting/error_reporter.cc

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/certificate_reporting/error_reporter.h" 5 #include "components/certificate_reporting/error_reporter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8
8 #include <set> 9 #include <set>
9 #include <utility> 10 #include <utility>
10 11
11 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h"
12 #include "components/certificate_reporting/encrypted_cert_logger.pb.h" 14 #include "components/certificate_reporting/encrypted_cert_logger.pb.h"
13 #include "crypto/aead.h" 15 #include "crypto/aead.h"
14 #include "crypto/curve25519.h" 16 #include "crypto/curve25519.h"
15 #include "crypto/hkdf.h" 17 #include "crypto/hkdf.h"
16 #include "crypto/random.h" 18 #include "crypto/random.h"
17 #include "net/url_request/certificate_report_sender.h" 19 #include "net/url_request/certificate_report_sender.h"
18 20
19 namespace certificate_reporting { 21 namespace certificate_reporting {
20 22
21 namespace { 23 namespace {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 100
99 } // namespace 101 } // namespace
100 102
101 ErrorReporter::ErrorReporter( 103 ErrorReporter::ErrorReporter(
102 net::URLRequestContext* request_context, 104 net::URLRequestContext* request_context,
103 const GURL& upload_url, 105 const GURL& upload_url,
104 net::CertificateReportSender::CookiesPreference cookies_preference) 106 net::CertificateReportSender::CookiesPreference cookies_preference)
105 : ErrorReporter(upload_url, 107 : ErrorReporter(upload_url,
106 kServerPublicKey, 108 kServerPublicKey,
107 kServerPublicKeyVersion, 109 kServerPublicKeyVersion,
108 make_scoped_ptr(new net::CertificateReportSender( 110 base::WrapUnique(new net::CertificateReportSender(
109 request_context, 111 request_context,
110 cookies_preference))) {} 112 cookies_preference))) {}
111 113
112 ErrorReporter::ErrorReporter( 114 ErrorReporter::ErrorReporter(
113 const GURL& upload_url, 115 const GURL& upload_url,
114 const uint8_t server_public_key[/* 32 */], 116 const uint8_t server_public_key[/* 32 */],
115 const uint32_t server_public_key_version, 117 const uint32_t server_public_key_version,
116 scoped_ptr<net::CertificateReportSender> certificate_report_sender) 118 std::unique_ptr<net::CertificateReportSender> certificate_report_sender)
117 : certificate_report_sender_(std::move(certificate_report_sender)), 119 : certificate_report_sender_(std::move(certificate_report_sender)),
118 upload_url_(upload_url), 120 upload_url_(upload_url),
119 server_public_key_(server_public_key), 121 server_public_key_(server_public_key),
120 server_public_key_version_(server_public_key_version) { 122 server_public_key_version_(server_public_key_version) {
121 DCHECK(certificate_report_sender_); 123 DCHECK(certificate_report_sender_);
122 DCHECK(!upload_url.is_empty()); 124 DCHECK(!upload_url.is_empty());
123 } 125 }
124 126
125 ErrorReporter::~ErrorReporter() {} 127 ErrorReporter::~ErrorReporter() {}
126 128
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 aead.Init(&key); 165 aead.Init(&key);
164 166
165 // Use an all-zero nonce because the key is random per-message. 167 // Use an all-zero nonce because the key is random per-message.
166 std::string nonce(aead.NonceLength(), 0); 168 std::string nonce(aead.NonceLength(), 0);
167 169
168 return aead.Open(encrypted_report.encrypted_report(), nonce, std::string(), 170 return aead.Open(encrypted_report.encrypted_report(), nonce, std::string(),
169 decrypted_serialized_report); 171 decrypted_serialized_report);
170 } 172 }
171 173
172 } // namespace certificate_reporting 174 } // namespace certificate_reporting
OLDNEW
« no previous file with comments | « components/certificate_reporting/error_reporter.h ('k') | components/certificate_reporting/error_reporter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698