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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 scoped_ptr<DictionaryValue> params; | 909 scoped_ptr<DictionaryValue> params; |
909 host_->StartWizard(screen_name, params.Pass()); | 910 host_->StartWizard(screen_name, params.Pass()); |
910 } | 911 } |
911 | 912 |
912 void ExistingUserController::ConfigurePublicSessionAutoLogin() { | 913 void ExistingUserController::ConfigurePublicSessionAutoLogin() { |
913 if (!cros_settings_->GetString( | 914 if (!cros_settings_->GetString( |
914 kAccountsPrefDeviceLocalAccountAutoLoginId, | 915 kAccountsPrefDeviceLocalAccountAutoLoginId, |
915 &public_session_auto_login_username_)) { | 916 &public_session_auto_login_username_)) { |
916 public_session_auto_login_username_.clear(); | 917 public_session_auto_login_username_.clear(); |
917 } | 918 } |
| 919 |
| 920 const User* user = |
| 921 UserManager::Get()->FindUser(public_session_auto_login_username_); |
| 922 if (!user || user->GetType() != User::USER_TYPE_PUBLIC_ACCOUNT) |
| 923 public_session_auto_login_username_.clear(); |
| 924 |
918 if (!cros_settings_->GetInteger( | 925 if (!cros_settings_->GetInteger( |
919 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 926 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
920 &public_session_auto_login_delay_)) { | 927 &public_session_auto_login_delay_)) { |
921 public_session_auto_login_delay_ = 0; | 928 public_session_auto_login_delay_ = 0; |
922 } | 929 } |
923 | 930 |
924 if (!public_session_auto_login_username_.empty()) | 931 if (!public_session_auto_login_username_.empty()) |
925 StartPublicSessionAutoLoginTimer(); | 932 StartPublicSessionAutoLoginTimer(); |
926 else | 933 else |
927 StopPublicSessionAutoLoginTimer(); | 934 StopPublicSessionAutoLoginTimer(); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 // changed. | 1113 // changed. |
1107 UserManager::Get()->SaveUserOAuthStatus( | 1114 UserManager::Get()->SaveUserOAuthStatus( |
1108 username, | 1115 username, |
1109 User::OAUTH2_TOKEN_STATUS_INVALID); | 1116 User::OAUTH2_TOKEN_STATUS_INVALID); |
1110 | 1117 |
1111 login_display_->SetUIEnabled(true); | 1118 login_display_->SetUIEnabled(true); |
1112 login_display_->ShowGaiaPasswordChanged(username); | 1119 login_display_->ShowGaiaPasswordChanged(username); |
1113 } | 1120 } |
1114 | 1121 |
1115 } // namespace chromeos | 1122 } // namespace chromeos |
OLD | NEW |