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

Side by Side Diff: content/browser/ssl/ssl_client_auth_handler.cc

Issue 1874893002: Convert //content/browser 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
« no previous file with comments | « content/browser/ssl/ssl_client_auth_handler.h ('k') | content/browser/ssl/ssl_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/ssl/ssl_client_auth_handler.h" 5 #include "content/browser/ssl/ssl_client_auth_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 DISALLOW_COPY_AND_ASSIGN(ClientCertificateDelegateImpl); 55 DISALLOW_COPY_AND_ASSIGN(ClientCertificateDelegateImpl);
56 }; 56 };
57 57
58 void SelectCertificateOnUIThread( 58 void SelectCertificateOnUIThread(
59 int render_process_host_id, 59 int render_process_host_id,
60 int render_frame_host_id, 60 int render_frame_host_id,
61 net::SSLCertRequestInfo* cert_request_info, 61 net::SSLCertRequestInfo* cert_request_info,
62 const base::WeakPtr<SSLClientAuthHandler>& handler) { 62 const base::WeakPtr<SSLClientAuthHandler>& handler) {
63 DCHECK_CURRENTLY_ON(BrowserThread::UI); 63 DCHECK_CURRENTLY_ON(BrowserThread::UI);
64 64
65 scoped_ptr<ClientCertificateDelegate> delegate( 65 std::unique_ptr<ClientCertificateDelegate> delegate(
66 new ClientCertificateDelegateImpl(handler)); 66 new ClientCertificateDelegateImpl(handler));
67 67
68 RenderFrameHost* rfh = 68 RenderFrameHost* rfh =
69 RenderFrameHost::FromID(render_process_host_id, render_frame_host_id); 69 RenderFrameHost::FromID(render_process_host_id, render_frame_host_id);
70 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); 70 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh);
71 if (!web_contents) 71 if (!web_contents)
72 return; 72 return;
73 73
74 GetContentClient()->browser()->SelectClientCertificate( 74 GetContentClient()->browser()->SelectClientCertificate(
75 web_contents, cert_request_info, std::move(delegate)); 75 web_contents, cert_request_info, std::move(delegate));
76 } 76 }
77 77
78 } // namespace 78 } // namespace
79 79
80 // A reference-counted core to allow the ClientCertStore and SSLCertRequestInfo 80 // A reference-counted core to allow the ClientCertStore and SSLCertRequestInfo
81 // to outlive SSLClientAuthHandler if needbe. 81 // to outlive SSLClientAuthHandler if needbe.
82 class SSLClientAuthHandler::Core : public base::RefCountedThreadSafe<Core> { 82 class SSLClientAuthHandler::Core : public base::RefCountedThreadSafe<Core> {
83 public: 83 public:
84 Core(const base::WeakPtr<SSLClientAuthHandler>& handler, 84 Core(const base::WeakPtr<SSLClientAuthHandler>& handler,
85 scoped_ptr<net::ClientCertStore> client_cert_store, 85 std::unique_ptr<net::ClientCertStore> client_cert_store,
86 net::SSLCertRequestInfo* cert_request_info) 86 net::SSLCertRequestInfo* cert_request_info)
87 : handler_(handler), 87 : handler_(handler),
88 client_cert_store_(std::move(client_cert_store)), 88 client_cert_store_(std::move(client_cert_store)),
89 cert_request_info_(cert_request_info) {} 89 cert_request_info_(cert_request_info) {}
90 90
91 bool has_client_cert_store() const { return !!client_cert_store_; } 91 bool has_client_cert_store() const { return !!client_cert_store_; }
92 92
93 void GetClientCerts() { 93 void GetClientCerts() {
94 if (client_cert_store_) { 94 if (client_cert_store_) {
95 // TODO(davidben): This is still a cyclical ownership where 95 // TODO(davidben): This is still a cyclical ownership where
(...skipping 13 matching lines...) Expand all
109 109
110 ~Core() {} 110 ~Core() {}
111 111
112 // Called when |client_cert_store_| is done retrieving the cert list. 112 // Called when |client_cert_store_| is done retrieving the cert list.
113 void DidGetClientCerts() { 113 void DidGetClientCerts() {
114 if (handler_) 114 if (handler_)
115 handler_->DidGetClientCerts(); 115 handler_->DidGetClientCerts();
116 } 116 }
117 117
118 base::WeakPtr<SSLClientAuthHandler> handler_; 118 base::WeakPtr<SSLClientAuthHandler> handler_;
119 scoped_ptr<net::ClientCertStore> client_cert_store_; 119 std::unique_ptr<net::ClientCertStore> client_cert_store_;
120 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; 120 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_;
121 }; 121 };
122 122
123 SSLClientAuthHandler::SSLClientAuthHandler( 123 SSLClientAuthHandler::SSLClientAuthHandler(
124 scoped_ptr<net::ClientCertStore> client_cert_store, 124 std::unique_ptr<net::ClientCertStore> client_cert_store,
125 net::URLRequest* request, 125 net::URLRequest* request,
126 net::SSLCertRequestInfo* cert_request_info, 126 net::SSLCertRequestInfo* cert_request_info,
127 SSLClientAuthHandler::Delegate* delegate) 127 SSLClientAuthHandler::Delegate* delegate)
128 : request_(request), 128 : request_(request),
129 cert_request_info_(cert_request_info), 129 cert_request_info_(cert_request_info),
130 delegate_(delegate), 130 delegate_(delegate),
131 weak_factory_(this) { 131 weak_factory_(this) {
132 DCHECK_CURRENTLY_ON(BrowserThread::IO); 132 DCHECK_CURRENTLY_ON(BrowserThread::IO);
133 133
134 core_ = new Core(weak_factory_.GetWeakPtr(), std::move(client_cert_store), 134 core_ = new Core(weak_factory_.GetWeakPtr(), std::move(client_cert_store),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 BrowserThread::PostTask( 197 BrowserThread::PostTask(
198 BrowserThread::UI, FROM_HERE, 198 BrowserThread::UI, FROM_HERE,
199 base::Bind(&SelectCertificateOnUIThread, render_process_host_id, 199 base::Bind(&SelectCertificateOnUIThread, render_process_host_id,
200 render_frame_host_id, base::RetainedRef(cert_request_info_), 200 render_frame_host_id, base::RetainedRef(cert_request_info_),
201 weak_factory_.GetWeakPtr())); 201 weak_factory_.GetWeakPtr()));
202 } 202 }
203 203
204 } // namespace content 204 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ssl/ssl_client_auth_handler.h ('k') | content/browser/ssl/ssl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698