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

Side by Side Diff: chrome/browser/ui/crypto_module_delegate_nss.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/crypto_module_delegate_nss.h" 5 #include "chrome/browser/ui/crypto_module_delegate_nss.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/browser/net/nss_context.h" 10 #include "chrome/browser/net/nss_context.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 12
13 using content::BrowserThread; 13 using content::BrowserThread;
14 14
15 namespace { 15 namespace {
16 16
17 void CreateWithSlot(chrome::CryptoModulePasswordReason reason, 17 void CreateWithSlot(
18 const net::HostPortPair& server, 18 chrome::CryptoModulePasswordReason reason,
19 const base::Callback<void( 19 const net::HostPortPair& server,
20 scoped_ptr<ChromeNSSCryptoModuleDelegate>)>& callback, 20 const base::Callback<void(std::unique_ptr<ChromeNSSCryptoModuleDelegate>)>&
21 crypto::ScopedPK11Slot slot) { 21 callback,
22 crypto::ScopedPK11Slot slot) {
22 if (!slot) { 23 if (!slot) {
23 callback.Run(scoped_ptr<ChromeNSSCryptoModuleDelegate>()); 24 callback.Run(std::unique_ptr<ChromeNSSCryptoModuleDelegate>());
24 return; 25 return;
25 } 26 }
26 callback.Run(scoped_ptr<ChromeNSSCryptoModuleDelegate>( 27 callback.Run(std::unique_ptr<ChromeNSSCryptoModuleDelegate>(
27 new ChromeNSSCryptoModuleDelegate(reason, server, std::move(slot)))); 28 new ChromeNSSCryptoModuleDelegate(reason, server, std::move(slot))));
28 } 29 }
29 30
30 } // namespace 31 } // namespace
31 32
32 ChromeNSSCryptoModuleDelegate::ChromeNSSCryptoModuleDelegate( 33 ChromeNSSCryptoModuleDelegate::ChromeNSSCryptoModuleDelegate(
33 chrome::CryptoModulePasswordReason reason, 34 chrome::CryptoModulePasswordReason reason,
34 const net::HostPortPair& server, 35 const net::HostPortPair& server,
35 crypto::ScopedPK11Slot slot) 36 crypto::ScopedPK11Slot slot)
36 : reason_(reason), 37 : reason_(reason),
37 server_(server), 38 server_(server),
38 event_(false, false), 39 event_(false, false),
39 cancelled_(false), 40 cancelled_(false),
40 slot_(std::move(slot)) {} 41 slot_(std::move(slot)) {}
41 42
42 ChromeNSSCryptoModuleDelegate::~ChromeNSSCryptoModuleDelegate() {} 43 ChromeNSSCryptoModuleDelegate::~ChromeNSSCryptoModuleDelegate() {}
43 44
44 // static 45 // static
45 void ChromeNSSCryptoModuleDelegate::CreateForResourceContext( 46 void ChromeNSSCryptoModuleDelegate::CreateForResourceContext(
46 chrome::CryptoModulePasswordReason reason, 47 chrome::CryptoModulePasswordReason reason,
47 const net::HostPortPair& server, 48 const net::HostPortPair& server,
48 content::ResourceContext* context, 49 content::ResourceContext* context,
49 const base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)>& 50 const base::Callback<void(std::unique_ptr<ChromeNSSCryptoModuleDelegate>)>&
50 callback) { 51 callback) {
51 DCHECK_CURRENTLY_ON(BrowserThread::IO); 52 DCHECK_CURRENTLY_ON(BrowserThread::IO);
52 DCHECK(!callback.is_null()); 53 DCHECK(!callback.is_null());
53 54
54 base::Callback<void(crypto::ScopedPK11Slot)> get_slot_callback = 55 base::Callback<void(crypto::ScopedPK11Slot)> get_slot_callback =
55 base::Bind(&CreateWithSlot, reason, server, callback); 56 base::Bind(&CreateWithSlot, reason, server, callback);
56 57
57 crypto::ScopedPK11Slot slot = 58 crypto::ScopedPK11Slot slot =
58 GetPrivateNSSKeySlotForResourceContext(context, get_slot_callback); 59 GetPrivateNSSKeySlotForResourceContext(context, get_slot_callback);
59 if (slot) 60 if (slot)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 crypto::CryptoModuleBlockingPasswordDelegate* 114 crypto::CryptoModuleBlockingPasswordDelegate*
114 CreateCryptoModuleBlockingPasswordDelegate( 115 CreateCryptoModuleBlockingPasswordDelegate(
115 chrome::CryptoModulePasswordReason reason, 116 chrome::CryptoModulePasswordReason reason,
116 const net::HostPortPair& server) { 117 const net::HostPortPair& server) {
117 // Returns a ChromeNSSCryptoModuleDelegate without Pk11Slot. Since it is only 118 // Returns a ChromeNSSCryptoModuleDelegate without Pk11Slot. Since it is only
118 // being used as a CryptoModuleBlockingDialogDelegate, using a slot handle is 119 // being used as a CryptoModuleBlockingDialogDelegate, using a slot handle is
119 // unnecessary. 120 // unnecessary.
120 return new ChromeNSSCryptoModuleDelegate( 121 return new ChromeNSSCryptoModuleDelegate(
121 reason, server, crypto::ScopedPK11Slot()); 122 reason, server, crypto::ScopedPK11Slot());
122 } 123 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/crypto_module_delegate_nss.h ('k') | chrome/browser/ui/exclusive_access/exclusive_access_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698