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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (!chrome::IsRunningInForcedAppMode()) | 421 if (!chrome::IsRunningInForcedAppMode()) |
422 return; | 422 return; |
423 | 423 |
424 chrome_client_id_ = chrome_client_id; | 424 chrome_client_id_ = chrome_client_id; |
425 chrome_client_secret_ = chrome_client_secret; | 425 chrome_client_secret_ = chrome_client_secret; |
426 } | 426 } |
427 | 427 |
428 bool UserSessionManager::RespectLocalePreference( | 428 bool UserSessionManager::RespectLocalePreference( |
429 Profile* profile, | 429 Profile* profile, |
430 const user_manager::User* user, | 430 const user_manager::User* user, |
431 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const { | 431 const locale_util::SwitchLanguageCallback& callback) const { |
432 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in | 432 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in |
433 // the Google user profile. | 433 // the Google user profile. |
434 if (g_browser_process == NULL) | 434 if (g_browser_process == NULL) |
435 return false; | 435 return false; |
436 | 436 |
437 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 437 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
438 if (!user || (user_manager->IsUserLoggedIn() && | 438 if (!user || (user_manager->IsUserLoggedIn() && |
439 user != user_manager->GetPrimaryUser())) { | 439 user != user_manager->GetPrimaryUser())) { |
440 return false; | 440 return false; |
441 } | 441 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 // are set up when the user first logs in. Then the user may customize the | 489 // are set up when the user first logs in. Then the user may customize the |
490 // input methods. Hence changing input methods here, just because the user's | 490 // input methods. Hence changing input methods here, just because the user's |
491 // UI language is different from the login screen UI language, is not | 491 // UI language is different from the login screen UI language, is not |
492 // desirable. Note that input method preferences are synced, so users can use | 492 // desirable. Note that input method preferences are synced, so users can use |
493 // their farovite input methods as soon as the preferences are synced. | 493 // their farovite input methods as soon as the preferences are synced. |
494 // | 494 // |
495 // For Guest mode, user locale preferences will never get initialized. | 495 // For Guest mode, user locale preferences will never get initialized. |
496 // So input methods should be enabled somewhere. | 496 // So input methods should be enabled somewhere. |
497 const bool enable_layouts = | 497 const bool enable_layouts = |
498 user_manager::UserManager::Get()->IsLoggedInAsGuest(); | 498 user_manager::UserManager::Get()->IsLoggedInAsGuest(); |
499 locale_util::SwitchLanguage(pref_locale, | 499 locale_util::SwitchLanguage( |
500 enable_layouts, | 500 pref_locale, enable_layouts, false /* login_layouts_only */, callback); |
501 false /* login_layouts_only */, | |
502 callback.Pass()); | |
503 | 501 |
504 return true; | 502 return true; |
505 } | 503 } |
506 | 504 |
507 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { | 505 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { |
508 return EasyUnlockService::IsSignInEnabled() && | 506 return EasyUnlockService::IsSignInEnabled() && |
509 !user_context_.GetUserID().empty() && | 507 !user_context_.GetUserID().empty() && |
510 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && | 508 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && |
511 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); | 509 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); |
512 } | 510 } |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 } | 1279 } |
1282 | 1280 |
1283 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { | 1281 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { |
1284 if (!easy_unlock_key_manager_) | 1282 if (!easy_unlock_key_manager_) |
1285 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1283 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
1286 | 1284 |
1287 return easy_unlock_key_manager_.get(); | 1285 return easy_unlock_key_manager_.get(); |
1288 } | 1286 } |
1289 | 1287 |
1290 } // namespace chromeos | 1288 } // namespace chromeos |
OLD | NEW |