OLD | NEW |
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/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 if (setting == kAccountsPrefDeviceLocalAccountAutoLoginId || | 254 if (setting == kAccountsPrefDeviceLocalAccountAutoLoginId || |
255 setting == kAccountsPrefDeviceLocalAccountAutoLoginDelay) { | 255 setting == kAccountsPrefDeviceLocalAccountAutoLoginDelay) { |
256 ConfigurePublicSessionAutoLogin(); | 256 ConfigurePublicSessionAutoLogin(); |
257 } | 257 } |
258 } | 258 } |
259 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED || | 259 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED || |
260 type == chrome::NOTIFICATION_USER_LIST_CHANGED) { | 260 type == chrome::NOTIFICATION_USER_LIST_CHANGED) { |
261 if (host_ != NULL) { | 261 if (host_ != NULL) { |
262 // Signed settings or user list changed. Notify views and update them. | 262 // Signed settings or user list changed. Notify views and update them. |
263 UpdateLoginDisplay(chromeos::UserManager::Get()->GetUsers()); | 263 UpdateLoginDisplay(chromeos::UserManager::Get()->GetUsers()); |
| 264 ConfigurePublicSessionAutoLogin(); |
264 return; | 265 return; |
265 } | 266 } |
266 } | 267 } |
267 if (type == chrome::NOTIFICATION_AUTH_SUPPLIED) { | 268 if (type == chrome::NOTIFICATION_AUTH_SUPPLIED) { |
268 // Possibly the user has authenticated against a proxy server and we might | 269 // Possibly the user has authenticated against a proxy server and we might |
269 // need the credentials for enrollment and other system requests from the | 270 // need the credentials for enrollment and other system requests from the |
270 // main |g_browser_process| request context (see bug | 271 // main |g_browser_process| request context (see bug |
271 // http://crosbug.com/24861). So we transfer any credentials to the global | 272 // http://crosbug.com/24861). So we transfer any credentials to the global |
272 // request context here. | 273 // request context here. |
273 // The issue we have here is that the NOTIFICATION_AUTH_SUPPLIED is sent | 274 // The issue we have here is that the NOTIFICATION_AUTH_SUPPLIED is sent |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 scoped_ptr<DictionaryValue> params; | 903 scoped_ptr<DictionaryValue> params; |
903 host_->StartWizard(screen_name, params.Pass()); | 904 host_->StartWizard(screen_name, params.Pass()); |
904 } | 905 } |
905 | 906 |
906 void ExistingUserController::ConfigurePublicSessionAutoLogin() { | 907 void ExistingUserController::ConfigurePublicSessionAutoLogin() { |
907 if (!cros_settings_->GetString( | 908 if (!cros_settings_->GetString( |
908 kAccountsPrefDeviceLocalAccountAutoLoginId, | 909 kAccountsPrefDeviceLocalAccountAutoLoginId, |
909 &public_session_auto_login_username_)) { | 910 &public_session_auto_login_username_)) { |
910 public_session_auto_login_username_.clear(); | 911 public_session_auto_login_username_.clear(); |
911 } | 912 } |
| 913 |
| 914 const User* user = |
| 915 UserManager::Get()->FindUser(public_session_auto_login_username_); |
| 916 if (!user || user->GetType() != User::USER_TYPE_PUBLIC_ACCOUNT) |
| 917 public_session_auto_login_username_.clear(); |
| 918 |
912 if (!cros_settings_->GetInteger( | 919 if (!cros_settings_->GetInteger( |
913 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 920 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
914 &public_session_auto_login_delay_)) { | 921 &public_session_auto_login_delay_)) { |
915 public_session_auto_login_delay_ = 0; | 922 public_session_auto_login_delay_ = 0; |
916 } | 923 } |
917 | 924 |
918 if (!public_session_auto_login_username_.empty()) | 925 if (!public_session_auto_login_username_.empty()) |
919 StartPublicSessionAutoLoginTimer(); | 926 StartPublicSessionAutoLoginTimer(); |
920 else | 927 else |
921 StopPublicSessionAutoLoginTimer(); | 928 StopPublicSessionAutoLoginTimer(); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 // changed. | 1107 // changed. |
1101 UserManager::Get()->SaveUserOAuthStatus( | 1108 UserManager::Get()->SaveUserOAuthStatus( |
1102 username, | 1109 username, |
1103 User::OAUTH2_TOKEN_STATUS_INVALID); | 1110 User::OAUTH2_TOKEN_STATUS_INVALID); |
1104 | 1111 |
1105 login_display_->SetUIEnabled(true); | 1112 login_display_->SetUIEnabled(true); |
1106 login_display_->ShowGaiaPasswordChanged(username); | 1113 login_display_->ShowGaiaPasswordChanged(username); |
1107 } | 1114 } |
1108 | 1115 |
1109 } // namespace chromeos | 1116 } // namespace chromeos |
OLD | NEW |