| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 if (!chrome::IsRunningInForcedAppMode()) | 367 if (!chrome::IsRunningInForcedAppMode()) |
| 368 return; | 368 return; |
| 369 | 369 |
| 370 chrome_client_id_ = chrome_client_id; | 370 chrome_client_id_ = chrome_client_id; |
| 371 chrome_client_secret_ = chrome_client_secret; | 371 chrome_client_secret_ = chrome_client_secret; |
| 372 } | 372 } |
| 373 | 373 |
| 374 bool UserSessionManager::RespectLocalePreference( | 374 bool UserSessionManager::RespectLocalePreference( |
| 375 Profile* profile, | 375 Profile* profile, |
| 376 const user_manager::User* user, | 376 const user_manager::User* user, |
| 377 const locale_util::SwitchLanguageCallback& callback) const { | 377 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const { |
| 378 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in | 378 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in |
| 379 // the Google user profile. | 379 // the Google user profile. |
| 380 if (g_browser_process == NULL) | 380 if (g_browser_process == NULL) |
| 381 return false; | 381 return false; |
| 382 | 382 |
| 383 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 383 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 384 if (!user || (user_manager->IsUserLoggedIn() && | 384 if (!user || (user_manager->IsUserLoggedIn() && |
| 385 user != user_manager->GetPrimaryUser())) { | 385 user != user_manager->GetPrimaryUser())) { |
| 386 return false; | 386 return false; |
| 387 } | 387 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // are set up when the user first logs in. Then the user may customize the | 435 // are set up when the user first logs in. Then the user may customize the |
| 436 // input methods. Hence changing input methods here, just because the user's | 436 // input methods. Hence changing input methods here, just because the user's |
| 437 // UI language is different from the login screen UI language, is not | 437 // UI language is different from the login screen UI language, is not |
| 438 // desirable. Note that input method preferences are synced, so users can use | 438 // desirable. Note that input method preferences are synced, so users can use |
| 439 // their farovite input methods as soon as the preferences are synced. | 439 // their farovite input methods as soon as the preferences are synced. |
| 440 // | 440 // |
| 441 // For Guest mode, user locale preferences will never get initialized. | 441 // For Guest mode, user locale preferences will never get initialized. |
| 442 // So input methods should be enabled somewhere. | 442 // So input methods should be enabled somewhere. |
| 443 const bool enable_layouts = | 443 const bool enable_layouts = |
| 444 user_manager::UserManager::Get()->IsLoggedInAsGuest(); | 444 user_manager::UserManager::Get()->IsLoggedInAsGuest(); |
| 445 locale_util::SwitchLanguage( | 445 locale_util::SwitchLanguage(pref_locale, |
| 446 pref_locale, enable_layouts, false /* login_layouts_only */, callback); | 446 enable_layouts, |
| 447 false /* login_layouts_only */, |
| 448 callback.Pass()); |
| 447 | 449 |
| 448 return true; | 450 return true; |
| 449 } | 451 } |
| 450 | 452 |
| 451 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { | 453 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { |
| 452 return !CommandLine::ForCurrentProcess()->HasSwitch( | 454 return !CommandLine::ForCurrentProcess()->HasSwitch( |
| 453 chromeos::switches::kDisableEasySignin) && | 455 chromeos::switches::kDisableEasySignin) && |
| 454 !user_context_.GetUserID().empty() && | 456 !user_context_.GetUserID().empty() && |
| 455 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && | 457 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && |
| 456 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); | 458 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 return NULL; | 1119 return NULL; |
| 1118 } | 1120 } |
| 1119 | 1121 |
| 1120 if (!easy_unlock_key_manager_) | 1122 if (!easy_unlock_key_manager_) |
| 1121 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1123 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
| 1122 | 1124 |
| 1123 return easy_unlock_key_manager_.get(); | 1125 return easy_unlock_key_manager_.get(); |
| 1124 } | 1126 } |
| 1125 | 1127 |
| 1126 } // namespace chromeos | 1128 } // namespace chromeos |
| OLD | NEW |