| OLD | NEW |
| 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/ptr_util.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 base::Bind(&SetSystemSlot, base::Passed(&system_slot)); | 111 base::Bind(&SetSystemSlot, base::Passed(&system_slot)); |
| 112 | 112 |
| 113 net::NSSCertDatabaseChromeOS* db = | 113 net::NSSCertDatabaseChromeOS* db = |
| 114 GetNSSCertDatabaseChromeOS(context, callback); | 114 GetNSSCertDatabaseChromeOS(context, callback); |
| 115 if (db) | 115 if (db) |
| 116 callback.Run(db); | 116 callback.Run(db); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace | 119 } // namespace |
| 120 | 120 |
| 121 crypto::ScopedPK11Slot GetPublicNSSKeySlotForResourceContext( | |
| 122 content::ResourceContext* context) { | |
| 123 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | |
| 124 return crypto::GetPublicSlotForChromeOSUser(GetUsername(context)); | |
| 125 } | |
| 126 | |
| 127 crypto::ScopedPK11Slot GetPrivateNSSKeySlotForResourceContext( | |
| 128 content::ResourceContext* context, | |
| 129 const base::Callback<void(crypto::ScopedPK11Slot)>& callback) { | |
| 130 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | |
| 131 return crypto::GetPrivateSlotForChromeOSUser(GetUsername(context), callback); | |
| 132 } | |
| 133 | |
| 134 net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext( | 121 net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext( |
| 135 content::ResourceContext* context, | 122 content::ResourceContext* context, |
| 136 const base::Callback<void(net::NSSCertDatabase*)>& callback) { | 123 const base::Callback<void(net::NSSCertDatabase*)>& callback) { |
| 137 return GetNSSCertDatabaseChromeOS( | 124 return GetNSSCertDatabaseChromeOS( |
| 138 context, base::Bind(&CallWithNSSCertDatabase, callback)); | 125 context, base::Bind(&CallWithNSSCertDatabase, callback)); |
| 139 } | 126 } |
| 140 | 127 |
| 141 void EnableNSSSystemKeySlotForResourceContext( | 128 void EnableNSSSystemKeySlotForResourceContext( |
| 142 content::ResourceContext* context) { | 129 content::ResourceContext* context) { |
| 143 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 130 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 144 base::Callback<void(crypto::ScopedPK11Slot)> callback = | 131 base::Callback<void(crypto::ScopedPK11Slot)> callback = |
| 145 base::Bind(&SetSystemSlotOfDBForResourceContext, context); | 132 base::Bind(&SetSystemSlotOfDBForResourceContext, context); |
| 146 crypto::ScopedPK11Slot system_slot = crypto::GetSystemNSSKeySlot(callback); | 133 crypto::ScopedPK11Slot system_slot = crypto::GetSystemNSSKeySlot(callback); |
| 147 if (system_slot) | 134 if (system_slot) |
| 148 callback.Run(std::move(system_slot)); | 135 callback.Run(std::move(system_slot)); |
| 149 } | 136 } |
| OLD | NEW |