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

Side by Side Diff: chrome/browser/net/nss_context_chromeos.cc

Issue 2842833003: Update SupportsUserData uses with unique_ptr. (Closed)
Patch Set: rebase Created 3 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/net/nss_context.h" 5 #include "chrome/browser/net/nss_context.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/supports_user_data.h" 12 #include "base/supports_user_data.h"
12 #include "chrome/browser/profiles/profile_io_data.h" 13 #include "chrome/browser/profiles/profile_io_data.h"
13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
14 #include "crypto/nss_util_internal.h" 15 #include "crypto/nss_util_internal.h"
15 #include "net/cert/nss_cert_database_chromeos.h" 16 #include "net/cert/nss_cert_database_chromeos.h"
16 17
17 namespace { 18 namespace {
18 19
19 void* kDatabaseManagerKey = &kDatabaseManagerKey; 20 void* kDatabaseManagerKey = &kDatabaseManagerKey;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 net::NSSCertDatabaseChromeOS* GetNSSCertDatabaseChromeOS( 82 net::NSSCertDatabaseChromeOS* GetNSSCertDatabaseChromeOS(
82 content::ResourceContext* context, 83 content::ResourceContext* context,
83 const NSSCertDatabaseChromeOSManager::GetNSSCertDatabaseCallback& 84 const NSSCertDatabaseChromeOSManager::GetNSSCertDatabaseCallback&
84 callback) { 85 callback) {
85 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 86 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
86 NSSCertDatabaseChromeOSManager* manager = 87 NSSCertDatabaseChromeOSManager* manager =
87 static_cast<NSSCertDatabaseChromeOSManager*>( 88 static_cast<NSSCertDatabaseChromeOSManager*>(
88 context->GetUserData(kDatabaseManagerKey)); 89 context->GetUserData(kDatabaseManagerKey));
89 if (!manager) { 90 if (!manager) {
90 manager = new NSSCertDatabaseChromeOSManager(GetUsername(context)); 91 manager = new NSSCertDatabaseChromeOSManager(GetUsername(context));
91 context->SetUserData(kDatabaseManagerKey, manager); 92 context->SetUserData(kDatabaseManagerKey, base::WrapUnique(manager));
92 } 93 }
93 return manager->GetNSSCertDatabase(callback); 94 return manager->GetNSSCertDatabase(callback);
94 } 95 }
95 96
96 void CallWithNSSCertDatabase( 97 void CallWithNSSCertDatabase(
97 const base::Callback<void(net::NSSCertDatabase*)>& callback, 98 const base::Callback<void(net::NSSCertDatabase*)>& callback,
98 net::NSSCertDatabaseChromeOS* db) { 99 net::NSSCertDatabaseChromeOS* db) {
99 callback.Run(db); 100 callback.Run(db);
100 } 101 }
101 102
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 140
140 void EnableNSSSystemKeySlotForResourceContext( 141 void EnableNSSSystemKeySlotForResourceContext(
141 content::ResourceContext* context) { 142 content::ResourceContext* context) {
142 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 143 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
143 base::Callback<void(crypto::ScopedPK11Slot)> callback = 144 base::Callback<void(crypto::ScopedPK11Slot)> callback =
144 base::Bind(&SetSystemSlotOfDBForResourceContext, context); 145 base::Bind(&SetSystemSlotOfDBForResourceContext, context);
145 crypto::ScopedPK11Slot system_slot = crypto::GetSystemNSSKeySlot(callback); 146 crypto::ScopedPK11Slot system_slot = crypto::GetSystemNSSKeySlot(callback);
146 if (system_slot) 147 if (system_slot)
147 callback.Run(std::move(system_slot)); 148 callback.Run(std::move(system_slot));
148 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698