forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use user specific NSSDatabase in CertLoader.
CertLoader is still global object, but it now loads only primary user's certificates. Loading only primary user's certificates is ok, since shill only uses primary user's network profile (and currently only network stack is interested in certificates from CertLoader). Added some tests for CertLoader and NetworkConnectionHandler. BUG=315343 Review URL: https://codereview.chromium.org/135193007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247414 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
tbarzic@chromium.org
committed
Jan 28, 2014
1 parent
fb7b39f
commit 69295ba
Showing
28 changed files
with
735 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/net/nss_context.h" | ||
|
||
#include "base/message_loop/message_loop_proxy.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "content/public/browser/browser_thread.h" | ||
#include "content/public/browser/resource_context.h" | ||
|
||
using content::BrowserThread; | ||
|
||
namespace { | ||
|
||
// Relays callback to the right message loop. | ||
void DidGetCertDBOnIOThread( | ||
scoped_refptr<base::MessageLoopProxy> response_message_loop, | ||
const base::Callback<void(net::NSSCertDatabase*)>& callback, | ||
net::NSSCertDatabase* cert_db) { | ||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | ||
|
||
response_message_loop->PostTask(FROM_HERE, base::Bind(callback, cert_db)); | ||
} | ||
|
||
// Gets NSSCertDatabase for the resource context. | ||
void GetCertDBOnIOThread( | ||
content::ResourceContext* context, | ||
scoped_refptr<base::MessageLoopProxy> response_message_loop, | ||
const base::Callback<void(net::NSSCertDatabase*)>& callback) { | ||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | ||
|
||
// Note that the callback will be used only if the cert database hasn't yet | ||
// been initialized. | ||
net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( | ||
context, | ||
base::Bind(&DidGetCertDBOnIOThread, response_message_loop, callback)); | ||
|
||
if (cert_db) | ||
DidGetCertDBOnIOThread(response_message_loop, callback, cert_db); | ||
} | ||
|
||
} // namespace | ||
|
||
void GetNSSCertDatabaseForProfile( | ||
Profile* profile, | ||
const base::Callback<void(net::NSSCertDatabase*)>& callback) { | ||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | ||
|
||
BrowserThread::PostTask(BrowserThread::IO, | ||
FROM_HERE, | ||
base::Bind(&GetCertDBOnIOThread, | ||
profile->GetResourceContext(), | ||
base::MessageLoopProxy::current(), | ||
callback)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.