| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (!chrome::IsRunningInForcedAppMode()) | 404 if (!chrome::IsRunningInForcedAppMode()) |
| 405 return; | 405 return; |
| 406 | 406 |
| 407 chrome_client_id_ = chrome_client_id; | 407 chrome_client_id_ = chrome_client_id; |
| 408 chrome_client_secret_ = chrome_client_secret; | 408 chrome_client_secret_ = chrome_client_secret; |
| 409 } | 409 } |
| 410 | 410 |
| 411 bool UserSessionManager::RespectLocalePreference( | 411 bool UserSessionManager::RespectLocalePreference( |
| 412 Profile* profile, | 412 Profile* profile, |
| 413 const user_manager::User* user, | 413 const user_manager::User* user, |
| 414 const locale_util::SwitchLanguageCallback& callback) const { | 414 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const { |
| 415 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in | 415 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in |
| 416 // the Google user profile. | 416 // the Google user profile. |
| 417 if (g_browser_process == NULL) | 417 if (g_browser_process == NULL) |
| 418 return false; | 418 return false; |
| 419 | 419 |
| 420 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 420 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 421 if (!user || (user_manager->IsUserLoggedIn() && | 421 if (!user || (user_manager->IsUserLoggedIn() && |
| 422 user != user_manager->GetPrimaryUser())) { | 422 user != user_manager->GetPrimaryUser())) { |
| 423 return false; | 423 return false; |
| 424 } | 424 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 // are set up when the user first logs in. Then the user may customize the | 472 // are set up when the user first logs in. Then the user may customize the |
| 473 // input methods. Hence changing input methods here, just because the user's | 473 // input methods. Hence changing input methods here, just because the user's |
| 474 // UI language is different from the login screen UI language, is not | 474 // UI language is different from the login screen UI language, is not |
| 475 // desirable. Note that input method preferences are synced, so users can use | 475 // desirable. Note that input method preferences are synced, so users can use |
| 476 // their farovite input methods as soon as the preferences are synced. | 476 // their farovite input methods as soon as the preferences are synced. |
| 477 // | 477 // |
| 478 // For Guest mode, user locale preferences will never get initialized. | 478 // For Guest mode, user locale preferences will never get initialized. |
| 479 // So input methods should be enabled somewhere. | 479 // So input methods should be enabled somewhere. |
| 480 const bool enable_layouts = | 480 const bool enable_layouts = |
| 481 user_manager::UserManager::Get()->IsLoggedInAsGuest(); | 481 user_manager::UserManager::Get()->IsLoggedInAsGuest(); |
| 482 locale_util::SwitchLanguage( | 482 locale_util::SwitchLanguage(pref_locale, |
| 483 pref_locale, enable_layouts, false /* login_layouts_only */, callback); | 483 enable_layouts, |
| 484 false /* login_layouts_only */, |
| 485 callback.Pass()); |
| 484 | 486 |
| 485 return true; | 487 return true; |
| 486 } | 488 } |
| 487 | 489 |
| 488 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { | 490 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { |
| 489 return EasyUnlockService::IsSignInEnabled() && | 491 return EasyUnlockService::IsSignInEnabled() && |
| 490 !user_context_.GetUserID().empty() && | 492 !user_context_.GetUserID().empty() && |
| 491 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && | 493 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && |
| 492 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); | 494 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); |
| 493 } | 495 } |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 } | 1148 } |
| 1147 | 1149 |
| 1148 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { | 1150 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { |
| 1149 if (!easy_unlock_key_manager_) | 1151 if (!easy_unlock_key_manager_) |
| 1150 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1152 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
| 1151 | 1153 |
| 1152 return easy_unlock_key_manager_.get(); | 1154 return easy_unlock_key_manager_.get(); |
| 1153 } | 1155 } |
| 1154 | 1156 |
| 1155 } // namespace chromeos | 1157 } // namespace chromeos |
| OLD | NEW |