OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
19 #include "base/time.h" | 19 #include "base/time.h" |
20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "crypto/nss_util.h" | 22 #include "crypto/nss_util.h" |
23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/chromeos/cros/cert_library.h" | |
24 #include "chrome/browser/chromeos/cros/cros_library.h" | 25 #include "chrome/browser/chromeos/cros/cros_library.h" |
25 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 26 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
26 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 27 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
27 #include "chrome/browser/chromeos/login/default_user_images.h" | 28 #include "chrome/browser/chromeos/login/default_user_images.h" |
28 #include "chrome/browser/chromeos/login/login_display.h" | 29 #include "chrome/browser/chromeos/login/login_display.h" |
29 #include "chrome/browser/chromeos/login/ownership_service.h" | 30 #include "chrome/browser/chromeos/login/ownership_service.h" |
30 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 31 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
31 #include "chrome/browser/chromeos/wm_ipc.h" | 32 #include "chrome/browser/chromeos/wm_ipc.h" |
32 #include "chrome/browser/defaults.h" | 33 #include "chrome/browser/defaults.h" |
33 #include "chrome/browser/prefs/pref_service.h" | 34 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
688 return logged_in_user().email() == kGuestUser; | 689 return logged_in_user().email() == kGuestUser; |
689 } | 690 } |
690 | 691 |
691 // Private constructor and destructor. Do nothing. | 692 // Private constructor and destructor. Do nothing. |
692 UserManager::UserManager() | 693 UserManager::UserManager() |
693 : ALLOW_THIS_IN_INITIALIZER_LIST(image_loader_(new UserImageLoader(this))), | 694 : ALLOW_THIS_IN_INITIALIZER_LIST(image_loader_(new UserImageLoader(this))), |
694 offline_login_(false), | 695 offline_login_(false), |
695 current_user_is_owner_(false), | 696 current_user_is_owner_(false), |
696 current_user_is_new_(false), | 697 current_user_is_new_(false), |
697 user_is_logged_in_(false), | 698 user_is_logged_in_(false), |
698 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 699 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
wtc
2011/10/12 17:20:34
The UserManager constructor should initialize
cert
| |
699 registrar_.Add(this, chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, | 700 registrar_.Add(this, chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, |
700 NotificationService::AllSources()); | 701 NotificationService::AllSources()); |
701 } | 702 } |
702 | 703 |
703 UserManager::~UserManager() { | 704 UserManager::~UserManager() { |
704 image_loader_->set_delegate(NULL); | 705 image_loader_->set_delegate(NULL); |
705 } | 706 } |
706 | 707 |
707 FilePath UserManager::GetImagePathForUser(const std::string& username) { | 708 FilePath UserManager::GetImagePathForUser(const std::string& username) { |
708 std::string filename = username + ".png"; | 709 std::string filename = username + ".png"; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
759 WmIpc::instance()->SetLoggedInProperty(true); | 760 WmIpc::instance()->SetLoggedInProperty(true); |
760 // Ensure we've opened the real user's key/certificate database. | 761 // Ensure we've opened the real user's key/certificate database. |
761 crypto::OpenPersistentNSSDB(); | 762 crypto::OpenPersistentNSSDB(); |
762 | 763 |
763 // Only load the Opencryptoki library into NSS if we have this switch. | 764 // Only load the Opencryptoki library into NSS if we have this switch. |
764 // TODO(gspencer): Remove this switch once cryptohomed work is finished: | 765 // TODO(gspencer): Remove this switch once cryptohomed work is finished: |
765 // http://crosbug.com/12295 and http://crosbug.com/12304 | 766 // http://crosbug.com/12295 and http://crosbug.com/12304 |
766 if (CommandLine::ForCurrentProcess()->HasSwitch( | 767 if (CommandLine::ForCurrentProcess()->HasSwitch( |
767 switches::kLoadOpencryptoki)) { | 768 switches::kLoadOpencryptoki)) { |
768 crypto::EnableTPMTokenForNSS(new RealTPMTokenInfoDelegate()); | 769 crypto::EnableTPMTokenForNSS(new RealTPMTokenInfoDelegate()); |
770 cert_library_ = chromeos::CrosLibrary::Get()->GetCertLibrary(); | |
771 cert_library_->RequestCertificates(); | |
wtc
2011/10/12 17:20:34
If this is the only place where cert_library_ is u
gauravsh
2011/10/12 17:37:02
Done.
| |
769 } | 772 } |
770 | 773 |
771 // Schedules current user ownership check on file thread. | 774 // Schedules current user ownership check on file thread. |
772 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 775 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
773 NewRunnableFunction(&CheckOwnership)); | 776 NewRunnableFunction(&CheckOwnership)); |
774 } | 777 } |
775 | 778 |
776 void UserManager::Observe(int type, | 779 void UserManager::Observe(int type, |
777 const NotificationSource& source, | 780 const NotificationSource& source, |
778 const NotificationDetails& details) { | 781 const NotificationDetails& details) { |
(...skipping 27 matching lines...) Expand all Loading... | |
806 observer_list_, | 809 observer_list_, |
807 LocalStateChanged(this)); | 810 LocalStateChanged(this)); |
808 } | 811 } |
809 | 812 |
810 void UserManager::DownloadProfileImage() { | 813 void UserManager::DownloadProfileImage() { |
811 profile_image_downloader_.reset(new ProfileImageDownloader(this)); | 814 profile_image_downloader_.reset(new ProfileImageDownloader(this)); |
812 profile_image_downloader_->Start(); | 815 profile_image_downloader_->Start(); |
813 } | 816 } |
814 | 817 |
815 } // namespace chromeos | 818 } // namespace chromeos |
OLD | NEW |