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

Unified Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 1730001: Enable Chrome OS to load the user's nssdb later. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/nss_util_internal.h ('k') | net/base/keygen_handler_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/login_utils.cc
===================================================================
--- chrome/browser/chromeos/login/login_utils.cc (revision 45593)
+++ chrome/browser/chromeos/login/login_utils.cc (working copy)
@@ -6,6 +6,8 @@
#include "base/command_line.h"
#include "base/file_path.h"
+#include "base/lock.h"
+#include "base/nss_util.h"
#include "base/path_service.h"
#include "base/scoped_ptr.h"
#include "base/singleton.h"
@@ -22,6 +24,10 @@
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_type.h"
#include "googleurl/src/gurl.h"
#include "net/base/cookie_store.h"
#include "net/url_request/url_request_context.h"
@@ -29,9 +35,15 @@
namespace chromeos {
-class LoginUtilsImpl : public LoginUtils {
+class LoginUtilsImpl : public LoginUtils,
+ public NotificationObserver {
public:
- LoginUtilsImpl() {}
+ LoginUtilsImpl() {
+ registrar_.Add(
+ this,
+ NotificationType::LOGIN_USER_CHANGED,
+ NotificationService::AllSources());
+ }
// Invoked after the user has successfully logged in. This launches a browser
// and does other bookkeeping after logging in.
@@ -42,16 +54,25 @@
// Authenticator and must delete it when done.
virtual Authenticator* CreateAuthenticator(LoginStatusConsumer* consumer);
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
private:
+ NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl);
};
class LoginUtilsWrapper {
public:
- LoginUtilsWrapper() : ptr_(new LoginUtilsImpl) {
- }
+ LoginUtilsWrapper() {}
LoginUtils* get() {
+ AutoLock create(create_lock_);
+ if (!ptr_.get())
+ reset(new LoginUtilsImpl);
return ptr_.get();
}
@@ -60,6 +81,7 @@
}
private:
+ Lock create_lock_;
scoped_ptr<LoginUtils> ptr_;
DISALLOW_COPY_AND_ASSIGN(LoginUtilsWrapper);
@@ -105,6 +127,13 @@
return new PamGoogleAuthenticator(consumer);
}
+void LoginUtilsImpl::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::LOGIN_USER_CHANGED)
+ base::OpenPersistentNSSDB();
+}
+
LoginUtils* LoginUtils::Get() {
return Singleton<LoginUtilsWrapper>::get()->get();
}
« no previous file with comments | « base/nss_util_internal.h ('k') | net/base/keygen_handler_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698