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

Side by Side Diff: chrome/browser/chromeos/login/user_manager.cc

Issue 9466005: Make sure the device recovers from policy loss in the consumer case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/login/user_manager.h" 5 #include "chrome/browser/chromeos/login/user_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 SetDeferImeStartup(false); 777 SetDeferImeStartup(false);
778 // Shut down the IME so that it will reload the user's settings. 778 // Shut down the IME so that it will reload the user's settings.
779 chromeos::input_method::InputMethodManager::GetInstance()-> 779 chromeos::input_method::InputMethodManager::GetInstance()->
780 StopInputMethodDaemon(); 780 StopInputMethodDaemon();
781 781
782 #if defined(TOOLKIT_USES_GTK) 782 #if defined(TOOLKIT_USES_GTK)
783 // Let the window manager know that we're logged in now. 783 // Let the window manager know that we're logged in now.
784 WmIpc::instance()->SetLoggedInProperty(true); 784 WmIpc::instance()->SetLoggedInProperty(true);
785 #endif 785 #endif
786 786
787 LoadKeyStore();
788
789 // Schedules current user ownership check on file thread.
790 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
791 base::Bind(&UserManager::CheckOwnership,
792 base::Unretained(this)));
793 }
794
795 void UserManager::LoadKeyStore() {
796 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
797 if (key_store_loaded_)
798 return;
799
787 // Ensure we've opened the real user's key/certificate database. 800 // Ensure we've opened the real user's key/certificate database.
788 crypto::OpenPersistentNSSDB(); 801 crypto::OpenPersistentNSSDB();
789 802
790 // Only load the Opencryptoki library into NSS if we have this switch. 803 // Only load the Opencryptoki library into NSS if we have this switch.
791 // TODO(gspencer): Remove this switch once cryptohomed work is finished: 804 // TODO(gspencer): Remove this switch once cryptohomed work is finished:
792 // http://crosbug.com/12295 and http://crosbug.com/12304 805 // http://crosbug.com/12295 and http://crosbug.com/12304
793 if (CommandLine::ForCurrentProcess()->HasSwitch( 806 if (CommandLine::ForCurrentProcess()->HasSwitch(
794 switches::kLoadOpencryptoki)) { 807 switches::kLoadOpencryptoki)) {
795 crypto::EnableTPMTokenForNSS(new RealTPMTokenInfoDelegate()); 808 crypto::EnableTPMTokenForNSS(new RealTPMTokenInfoDelegate());
796 CertLibrary* cert_library; 809 CertLibrary* cert_library;
797 cert_library = chromeos::CrosLibrary::Get()->GetCertLibrary(); 810 cert_library = chromeos::CrosLibrary::Get()->GetCertLibrary();
798 // Note: this calls crypto::EnsureTPMTokenReady() 811 // Note: this calls crypto::EnsureTPMTokenReady()
799 cert_library->RequestCertificates(); 812 cert_library->RequestCertificates();
800 } 813 }
801 814 key_store_loaded_ = true;
802 // Schedules current user ownership check on file thread.
803 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
804 base::Bind(&UserManager::CheckOwnership,
805 base::Unretained(this)));
806 } 815 }
807 816
808 void UserManager::SetInitialUserImage(const std::string& username) { 817 void UserManager::SetInitialUserImage(const std::string& username) {
809 // Choose a random default image. 818 // Choose a random default image.
810 int image_id = base::RandInt(0, kDefaultImagesCount - 1); 819 int image_id = base::RandInt(0, kDefaultImagesCount - 1);
811 SaveUserDefaultImageIndex(username, image_id); 820 SaveUserDefaultImageIndex(username, image_id);
812 } 821 }
813 822
814 void UserManager::SetUserImage(const std::string& username, 823 void UserManager::SetUserImage(const std::string& username,
815 int image_index, 824 int image_index,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1048
1040 User* UserManager::CreateUser(const std::string& email) const { 1049 User* UserManager::CreateUser(const std::string& email) const {
1041 User* user = new User(email, email == kGuestUser); 1050 User* user = new User(email, email == kGuestUser);
1042 user->set_oauth_token_status(LoadUserOAuthStatus(email)); 1051 user->set_oauth_token_status(LoadUserOAuthStatus(email));
1043 // Used to determine whether user's display name is unique. 1052 // Used to determine whether user's display name is unique.
1044 ++display_name_count_[user->GetDisplayName()]; 1053 ++display_name_count_[user->GetDisplayName()];
1045 return user; 1054 return user;
1046 } 1055 }
1047 1056
1048 } // namespace chromeos 1057 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698