| 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 "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
| 9 #include "chrome/browser/profiles/profile_io_data.h" | 9 #include "chrome/browser/profiles/profile_io_data.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 typedef std::vector<base::Callback<void(net::NSSCertDatabase*)> > | 47 typedef std::vector<base::Callback<void(net::NSSCertDatabase*)> > |
| 48 ReadyCallbackList; | 48 ReadyCallbackList; |
| 49 | 49 |
| 50 void DidGetPrivateSlot(crypto::ScopedPK11Slot private_slot) { | 50 void DidGetPrivateSlot(crypto::ScopedPK11Slot private_slot) { |
| 51 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 51 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 52 nss_cert_database_.reset(new net::NSSCertDatabaseChromeOS( | 52 nss_cert_database_.reset(new net::NSSCertDatabaseChromeOS( |
| 53 crypto::GetPublicSlotForChromeOSUser(username_hash_), | 53 crypto::GetPublicSlotForChromeOSUser(username_hash_), |
| 54 private_slot.Pass())); | 54 private_slot.Pass(), |
| 55 crypto::ScopedPK11Slot(crypto::GetSystemNSSKeySlot()))); |
| 55 | 56 |
| 56 ReadyCallbackList callback_list; | 57 ReadyCallbackList callback_list; |
| 57 callback_list.swap(ready_callback_list_); | 58 callback_list.swap(ready_callback_list_); |
| 58 for (ReadyCallbackList::iterator i = callback_list.begin(); | 59 for (ReadyCallbackList::iterator i = callback_list.begin(); |
| 59 i != callback_list.end(); | 60 i != callback_list.end(); |
| 60 ++i) { | 61 ++i) { |
| 61 (*i).Run(nss_cert_database_.get()); | 62 (*i).Run(nss_cert_database_.get()); |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 96 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 96 NSSCertDatabaseChromeOSManager* manager = | 97 NSSCertDatabaseChromeOSManager* manager = |
| 97 static_cast<NSSCertDatabaseChromeOSManager*>( | 98 static_cast<NSSCertDatabaseChromeOSManager*>( |
| 98 context->GetUserData(kDatabaseManagerKey)); | 99 context->GetUserData(kDatabaseManagerKey)); |
| 99 if (!manager) { | 100 if (!manager) { |
| 100 manager = new NSSCertDatabaseChromeOSManager(GetUsername(context)); | 101 manager = new NSSCertDatabaseChromeOSManager(GetUsername(context)); |
| 101 context->SetUserData(kDatabaseManagerKey, manager); | 102 context->SetUserData(kDatabaseManagerKey, manager); |
| 102 } | 103 } |
| 103 return manager->GetNSSCertDatabase(callback); | 104 return manager->GetNSSCertDatabase(callback); |
| 104 } | 105 } |
| OLD | NEW |