| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 if (user->GetAccountLocale() == NULL) | 360 if (user->GetAccountLocale() == NULL) |
| 361 return false; // wait until Account profile is loaded. | 361 return false; // wait until Account profile is loaded. |
| 362 account_locale = user->GetAccountLocale(); | 362 account_locale = user->GetAccountLocale(); |
| 363 pref_locale = *account_locale; | 363 pref_locale = *account_locale; |
| 364 } | 364 } |
| 365 const std::string global_app_locale = | 365 const std::string global_app_locale = |
| 366 g_browser_process->GetApplicationLocale(); | 366 g_browser_process->GetApplicationLocale(); |
| 367 if (pref_locale.empty()) | 367 if (pref_locale.empty()) |
| 368 pref_locale = global_app_locale; | 368 pref_locale = global_app_locale; |
| 369 DCHECK(!pref_locale.empty()); | 369 DCHECK(!pref_locale.empty()); |
| 370 LOG(WARNING) << "RespectLocalePreference: " | 370 VLOG(1) << "RespectLocalePreference: " |
| 371 << "app_locale='" << pref_app_locale << "', " | 371 << "app_locale='" << pref_app_locale << "', " |
| 372 << "bkup_locale='" << pref_bkup_locale << "', " | 372 << "bkup_locale='" << pref_bkup_locale << "', " |
| 373 << (account_locale != NULL | 373 << (account_locale != NULL |
| 374 ? (std::string("account_locale='") + (*account_locale) + | 374 ? (std::string("account_locale='") + (*account_locale) + |
| 375 "'. ") | 375 "'. ") |
| 376 : (std::string("account_locale - unused. "))) | 376 : (std::string("account_locale - unused. "))) |
| 377 << " Selected '" << pref_locale << "'"; | 377 << " Selected '" << pref_locale << "'"; |
| 378 profile->ChangeAppLocale(pref_locale, Profile::APP_LOCALE_CHANGED_VIA_LOGIN); | 378 profile->ChangeAppLocale(pref_locale, Profile::APP_LOCALE_CHANGED_VIA_LOGIN); |
| 379 | 379 |
| 380 // Here we don't enable keyboard layouts for normal users. Input methods | 380 // Here we don't enable keyboard layouts for normal users. Input methods |
| 381 // are set up when the user first logs in. Then the user may customize the | 381 // are set up when the user first logs in. Then the user may customize the |
| 382 // input methods. Hence changing input methods here, just because the user's | 382 // input methods. Hence changing input methods here, just because the user's |
| 383 // UI language is different from the login screen UI language, is not | 383 // UI language is different from the login screen UI language, is not |
| 384 // desirable. Note that input method preferences are synced, so users can use | 384 // desirable. Note that input method preferences are synced, so users can use |
| 385 // their farovite input methods as soon as the preferences are synced. | 385 // their farovite input methods as soon as the preferences are synced. |
| 386 // | 386 // |
| 387 // For Guest mode, user locale preferences will never get initialized. | 387 // For Guest mode, user locale preferences will never get initialized. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 OAuth2LoginManager* login_manager = | 451 OAuth2LoginManager* login_manager = |
| 452 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); | 452 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); |
| 453 login_manager->RemoveObserver(this); | 453 login_manager->RemoveObserver(this); |
| 454 | 454 |
| 455 // Mark user auth token status as valid. | 455 // Mark user auth token status as valid. |
| 456 UserManager::Get()->SaveUserOAuthStatus( | 456 UserManager::Get()->SaveUserOAuthStatus( |
| 457 UserManager::Get()->GetLoggedInUser()->email(), | 457 UserManager::Get()->GetLoggedInUser()->email(), |
| 458 User::OAUTH2_TOKEN_STATUS_VALID); | 458 User::OAUTH2_TOKEN_STATUS_VALID); |
| 459 | 459 |
| 460 LOG(WARNING) << "Exiting after new refresh token fetched"; | 460 VLOG(1) << "Exiting after new refresh token fetched"; |
| 461 | 461 |
| 462 // We need to restart cleanly in this case to make sure OAuth2 RT is actually | 462 // We need to restart cleanly in this case to make sure OAuth2 RT is actually |
| 463 // saved. | 463 // saved. |
| 464 chrome::AttemptRestart(); | 464 chrome::AttemptRestart(); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void UserSessionManager::OnConnectionTypeChanged( | 467 void UserSessionManager::OnConnectionTypeChanged( |
| 468 net::NetworkChangeNotifier::ConnectionType type) { | 468 net::NetworkChangeNotifier::ConnectionType type) { |
| 469 UserManager* user_manager = UserManager::Get(); | 469 UserManager* user_manager = UserManager::Get(); |
| 470 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || | 470 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 | 886 |
| 887 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { | 887 void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() { |
| 888 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 888 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 889 user_sessions_restored_ = true; | 889 user_sessions_restored_ = true; |
| 890 FOR_EACH_OBSERVER(UserSessionStateObserver, | 890 FOR_EACH_OBSERVER(UserSessionStateObserver, |
| 891 session_state_observer_list_, | 891 session_state_observer_list_, |
| 892 PendingUserSessionsRestoreFinished()); | 892 PendingUserSessionsRestoreFinished()); |
| 893 } | 893 } |
| 894 | 894 |
| 895 } // namespace chromeos | 895 } // namespace chromeos |
| OLD | NEW |