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 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const { | 414 const 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(pref_locale, | 482 locale_util::SwitchLanguage( |
483 enable_layouts, | 483 pref_locale, enable_layouts, false /* login_layouts_only */, callback); |
484 false /* login_layouts_only */, | |
485 callback.Pass()); | |
486 | 484 |
487 return true; | 485 return true; |
488 } | 486 } |
489 | 487 |
490 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { | 488 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { |
491 return EasyUnlockService::IsSignInEnabled() && | 489 return EasyUnlockService::IsSignInEnabled() && |
492 !user_context_.GetUserID().empty() && | 490 !user_context_.GetUserID().empty() && |
493 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && | 491 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && |
494 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); | 492 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); |
495 } | 493 } |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 } | 1146 } |
1149 | 1147 |
1150 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { | 1148 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { |
1151 if (!easy_unlock_key_manager_) | 1149 if (!easy_unlock_key_manager_) |
1152 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1150 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
1153 | 1151 |
1154 return easy_unlock_key_manager_.get(); | 1152 return easy_unlock_key_manager_.get(); |
1155 } | 1153 } |
1156 | 1154 |
1157 } // namespace chromeos | 1155 } // namespace chromeos |
OLD | NEW |