OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 // TODO(nkostylev): This pointer should probably never be NULL, but it looks | 789 // TODO(nkostylev): This pointer should probably never be NULL, but it looks |
790 // like LoginUtilsImpl::OnProfileCreated() may be getting called before | 790 // like LoginUtilsImpl::OnProfileCreated() may be getting called before |
791 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is | 791 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is |
792 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace | 792 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace |
793 // this 'if' statement with a CHECK(delegate_) once the underlying issue is | 793 // this 'if' statement with a CHECK(delegate_) once the underlying issue is |
794 // resolved. | 794 // resolved. |
795 if (delegate_) | 795 if (delegate_) |
796 delegate_->OnProfilePrepared(profile); | 796 delegate_->OnProfilePrepared(profile); |
797 | 797 |
798 UpdateEasyUnlockKeys(profile); | 798 UpdateEasyUnlockKeys(profile); |
| 799 user_context_.ClearSecrets(); |
799 } | 800 } |
800 | 801 |
801 void UserSessionManager::InitSessionRestoreStrategy() { | 802 void UserSessionManager::InitSessionRestoreStrategy() { |
802 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 803 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
803 bool in_app_mode = chrome::IsRunningInForcedAppMode(); | 804 bool in_app_mode = chrome::IsRunningInForcedAppMode(); |
804 | 805 |
805 // Are we in kiosk app mode? | 806 // Are we in kiosk app mode? |
806 if (in_app_mode) { | 807 if (in_app_mode) { |
807 if (command_line->HasSwitch(::switches::kAppModeOAuth2Token)) { | 808 if (command_line->HasSwitch(::switches::kAppModeOAuth2Token)) { |
808 oauth2_refresh_token_ = command_line->GetSwitchValueASCII( | 809 oauth2_refresh_token_ = command_line->GetSwitchValueASCII( |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 } | 997 } |
997 | 998 |
998 void UserSessionManager::UpdateEasyUnlockKeys(Profile* user_profile) { | 999 void UserSessionManager::UpdateEasyUnlockKeys(Profile* user_profile) { |
999 if (!GetEasyUnlockKeyManager()) | 1000 if (!GetEasyUnlockKeyManager()) |
1000 return; | 1001 return; |
1001 | 1002 |
1002 // Only update Easy unlock keys for regular user. | 1003 // Only update Easy unlock keys for regular user. |
1003 if (user_context_.GetUserType() != user_manager::USER_TYPE_REGULAR) | 1004 if (user_context_.GetUserType() != user_manager::USER_TYPE_REGULAR) |
1004 return; | 1005 return; |
1005 | 1006 |
| 1007 // Bail if |user_context_| does not have secret. |
| 1008 if (user_context_.GetKey()->GetSecret().empty()) { |
| 1009 // Nagging if this is not crash restore case. |
| 1010 DCHECK(user_sessions_restored_); |
| 1011 return; |
| 1012 } |
| 1013 |
1006 // |user_context_| and |user_profile| must belong to the same user. | 1014 // |user_context_| and |user_profile| must belong to the same user. |
1007 DCHECK_EQ(SigninManagerFactory::GetForProfile(user_profile) | 1015 DCHECK_EQ(SigninManagerFactory::GetForProfile(user_profile) |
1008 ->GetAuthenticatedAccountId(), | 1016 ->GetAuthenticatedAccountId(), |
1009 user_context_.GetUserID()); | 1017 user_context_.GetUserID()); |
1010 | 1018 |
1011 const base::ListValue* device_list = NULL; | 1019 const base::ListValue* device_list = NULL; |
1012 if (EasyUnlockService::Get(user_profile)) | 1020 if (EasyUnlockService::Get(user_profile)) |
1013 device_list = EasyUnlockService::Get(user_profile)->GetRemoteDevices(); | 1021 device_list = EasyUnlockService::Get(user_profile)->GetRemoteDevices(); |
1014 | 1022 |
1015 if (device_list) { | 1023 if (device_list) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 return NULL; | 1062 return NULL; |
1055 } | 1063 } |
1056 | 1064 |
1057 if (!easy_unlock_key_manager_) | 1065 if (!easy_unlock_key_manager_) |
1058 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1066 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
1059 | 1067 |
1060 return easy_unlock_key_manager_.get(); | 1068 return easy_unlock_key_manager_.get(); |
1061 } | 1069 } |
1062 | 1070 |
1063 } // namespace chromeos | 1071 } // namespace chromeos |
OLD | NEW |