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