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

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

Issue 53763003: Initialize per-ChromeOS-user NSS slots and provide the functions to access them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linux build fix Created 7 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/net/nss_context.h"
6
7 #include "chrome/browser/profiles/profile_io_data.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "crypto/nss_util_internal.h"
10
11 namespace {
12 #if defined(OS_CHROMEOS)
Ryan Sleevi 2013/12/04 20:59:55 Rather than these #ifdef's, lets do a proper file
mattm 2013/12/04 22:09:28 derp, good call. Done.
13 std::string GetUsername(content::ResourceContext* context) {
14 return ProfileIOData::FromResourceContext(context)->username_hash();
15 }
16 #endif // defined(OS_CHROMEOS)
17 } // namespace
18
19 crypto::ScopedPK11Slot GetPublicNSSKeySlotForResourceContext(
20 content::ResourceContext* context) {
21 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
22 #if defined(OS_CHROMEOS)
23 return crypto::GetPublicSlotForChromeOSUser(GetUsername(context));
24 #else
25 return crypto::ScopedPK11Slot(crypto::GetPublicNSSKeySlot());
26 #endif
27 }
28
29 crypto::ScopedPK11Slot GetPrivateNSSKeySlotForResourceContext(
30 content::ResourceContext* context,
31 const base::Callback<void(crypto::ScopedPK11Slot)>& callback) {
32 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
33 #if defined(OS_CHROMEOS)
34 return crypto::GetPrivateSlotForChromeOSUser(GetUsername(context), callback);
35 #else
36 return crypto::ScopedPK11Slot(crypto::GetPrivateNSSKeySlot());
37 #endif
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698