| 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/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/nss_util.h" | |
| 14 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 15 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 16 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 17 #include "base/time.h" | 16 #include "base/time.h" |
| 18 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 19 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "crypto/nss_util.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/chromeos/cros/cros_library.h" | 21 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 22 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 22 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
| 23 #include "chrome/browser/chromeos/cros/input_method_library.h" | 23 #include "chrome/browser/chromeos/cros/input_method_library.h" |
| 24 #include "chrome/browser/chromeos/login/login_display.h" | 24 #include "chrome/browser/chromeos/login/login_display.h" |
| 25 #include "chrome/browser/chromeos/login/ownership_service.h" | 25 #include "chrome/browser/chromeos/login/ownership_service.h" |
| 26 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 26 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| 27 #include "chrome/browser/chromeos/wm_ipc.h" | 27 #include "chrome/browser/chromeos/wm_ipc.h" |
| 28 #include "chrome/browser/defaults.h" | 28 #include "chrome/browser/defaults.h" |
| 29 #include "chrome/browser/prefs/pref_service.h" | 29 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 Details<const User>(&logged_in_user_)); | 560 Details<const User>(&logged_in_user_)); |
| 561 | 561 |
| 562 chromeos::CrosLibrary::Get()->GetInputMethodLibrary()-> | 562 chromeos::CrosLibrary::Get()->GetInputMethodLibrary()-> |
| 563 SetDeferImeStartup(false); | 563 SetDeferImeStartup(false); |
| 564 // Shut down the IME so that it will reload the user's settings. | 564 // Shut down the IME so that it will reload the user's settings. |
| 565 chromeos::CrosLibrary::Get()->GetInputMethodLibrary()-> | 565 chromeos::CrosLibrary::Get()->GetInputMethodLibrary()-> |
| 566 StopInputMethodDaemon(); | 566 StopInputMethodDaemon(); |
| 567 // Let the window manager know that we're logged in now. | 567 // Let the window manager know that we're logged in now. |
| 568 WmIpc::instance()->SetLoggedInProperty(true); | 568 WmIpc::instance()->SetLoggedInProperty(true); |
| 569 // Ensure we've opened the real user's key/certificate database. | 569 // Ensure we've opened the real user's key/certificate database. |
| 570 base::OpenPersistentNSSDB(); | 570 crypto::OpenPersistentNSSDB(); |
| 571 | 571 |
| 572 // Only load the Opencryptoki library into NSS if we have this switch. | 572 // Only load the Opencryptoki library into NSS if we have this switch. |
| 573 // TODO(gspencer): Remove this switch once cryptohomed work is finished: | 573 // TODO(gspencer): Remove this switch once cryptohomed work is finished: |
| 574 // http://crosbug.com/12295 and http://crosbug.com/12304 | 574 // http://crosbug.com/12295 and http://crosbug.com/12304 |
| 575 if (CommandLine::ForCurrentProcess()->HasSwitch( | 575 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 576 switches::kLoadOpencryptoki)) { | 576 switches::kLoadOpencryptoki)) { |
| 577 base::EnableTPMForNSS(); | 577 crypto::EnableTPMForNSS(); |
| 578 } | 578 } |
| 579 | 579 |
| 580 // Schedules current user ownership check on file thread. | 580 // Schedules current user ownership check on file thread. |
| 581 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 581 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 582 NewRunnableFunction(&CheckOwnership)); | 582 NewRunnableFunction(&CheckOwnership)); |
| 583 } | 583 } |
| 584 | 584 |
| 585 void UserManager::Observe(NotificationType type, | 585 void UserManager::Observe(NotificationType type, |
| 586 const NotificationSource& source, | 586 const NotificationSource& source, |
| 587 const NotificationDetails& details) { | 587 const NotificationDetails& details) { |
| 588 if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { | 588 if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { |
| 589 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 589 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 590 NewRunnableFunction(&CheckOwnership)); | 590 NewRunnableFunction(&CheckOwnership)); |
| 591 } | 591 } |
| 592 } | 592 } |
| 593 | 593 |
| 594 bool UserManager::current_user_is_owner() const { | 594 bool UserManager::current_user_is_owner() const { |
| 595 base::AutoLock lk(current_user_is_owner_lock_); | 595 base::AutoLock lk(current_user_is_owner_lock_); |
| 596 return current_user_is_owner_; | 596 return current_user_is_owner_; |
| 597 } | 597 } |
| 598 | 598 |
| 599 void UserManager::set_current_user_is_owner(bool current_user_is_owner) { | 599 void UserManager::set_current_user_is_owner(bool current_user_is_owner) { |
| 600 base::AutoLock lk(current_user_is_owner_lock_); | 600 base::AutoLock lk(current_user_is_owner_lock_); |
| 601 current_user_is_owner_ = current_user_is_owner; | 601 current_user_is_owner_ = current_user_is_owner; |
| 602 } | 602 } |
| 603 | 603 |
| 604 } // namespace chromeos | 604 } // namespace chromeos |
| OLD | NEW |