| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 if (user->GetAccountLocale() == NULL) | 332 if (user->GetAccountLocale() == NULL) |
| 333 return false; // wait until Account profile is loaded. | 333 return false; // wait until Account profile is loaded. |
| 334 account_locale = user->GetAccountLocale(); | 334 account_locale = user->GetAccountLocale(); |
| 335 pref_locale = *account_locale; | 335 pref_locale = *account_locale; |
| 336 } | 336 } |
| 337 const std::string global_app_locale = | 337 const std::string global_app_locale = |
| 338 g_browser_process->GetApplicationLocale(); | 338 g_browser_process->GetApplicationLocale(); |
| 339 if (pref_locale.empty()) | 339 if (pref_locale.empty()) |
| 340 pref_locale = global_app_locale; | 340 pref_locale = global_app_locale; |
| 341 DCHECK(!pref_locale.empty()); | 341 DCHECK(!pref_locale.empty()); |
| 342 LOG(WARNING) << "RespectLocalePreference: " | 342 VLOG(1) << "RespectLocalePreference: " |
| 343 << "app_locale='" << pref_app_locale << "', " | 343 << "app_locale='" << pref_app_locale << "', " |
| 344 << "bkup_locale='" << pref_bkup_locale << "', " | 344 << "bkup_locale='" << pref_bkup_locale << "', " |
| 345 << (account_locale != NULL | 345 << (account_locale != NULL |
| 346 ? (std::string("account_locale='") + (*account_locale) + | 346 ? (std::string("account_locale='") + (*account_locale) + |
| 347 "'. ") | 347 "'. ") |
| 348 : (std::string("account_locale - unused. "))) | 348 : (std::string("account_locale - unused. "))) |
| 349 << " Selected '" << pref_locale << "'"; | 349 << " Selected '" << pref_locale << "'"; |
| 350 profile->ChangeAppLocale(pref_locale, Profile::APP_LOCALE_CHANGED_VIA_LOGIN); | 350 profile->ChangeAppLocale(pref_locale, Profile::APP_LOCALE_CHANGED_VIA_LOGIN); |
| 351 | 351 |
| 352 // Here we don't enable keyboard layouts for normal users. Input methods | 352 // Here we don't enable keyboard layouts for normal users. Input methods |
| 353 // are set up when the user first logs in. Then the user may customize the | 353 // are set up when the user first logs in. Then the user may customize the |
| 354 // input methods. Hence changing input methods here, just because the user's | 354 // input methods. Hence changing input methods here, just because the user's |
| 355 // UI language is different from the login screen UI language, is not | 355 // UI language is different from the login screen UI language, is not |
| 356 // desirable. Note that input method preferences are synced, so users can use | 356 // desirable. Note that input method preferences are synced, so users can use |
| 357 // their farovite input methods as soon as the preferences are synced. | 357 // their farovite input methods as soon as the preferences are synced. |
| 358 // | 358 // |
| 359 // For Guest mode, user locale preferences will never get initialized. | 359 // For Guest mode, user locale preferences will never get initialized. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 OAuth2LoginManager* login_manager = | 411 OAuth2LoginManager* login_manager = |
| 412 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); | 412 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); |
| 413 login_manager->RemoveObserver(this); | 413 login_manager->RemoveObserver(this); |
| 414 | 414 |
| 415 // Mark user auth token status as valid. | 415 // Mark user auth token status as valid. |
| 416 UserManager::Get()->SaveUserOAuthStatus( | 416 UserManager::Get()->SaveUserOAuthStatus( |
| 417 UserManager::Get()->GetLoggedInUser()->email(), | 417 UserManager::Get()->GetLoggedInUser()->email(), |
| 418 User::OAUTH2_TOKEN_STATUS_VALID); | 418 User::OAUTH2_TOKEN_STATUS_VALID); |
| 419 | 419 |
| 420 LOG(WARNING) << "Exiting after new refresh token fetched"; | 420 VLOG(1) << "Exiting after new refresh token fetched"; |
| 421 | 421 |
| 422 // We need to restart cleanly in this case to make sure OAuth2 RT is actually | 422 // We need to restart cleanly in this case to make sure OAuth2 RT is actually |
| 423 // saved. | 423 // saved. |
| 424 chrome::AttemptRestart(); | 424 chrome::AttemptRestart(); |
| 425 } | 425 } |
| 426 | 426 |
| 427 void UserSessionManager::OnConnectionTypeChanged( | 427 void UserSessionManager::OnConnectionTypeChanged( |
| 428 net::NetworkChangeNotifier::ConnectionType type) { | 428 net::NetworkChangeNotifier::ConnectionType type) { |
| 429 UserManager* user_manager = UserManager::Get(); | 429 UserManager* user_manager = UserManager::Get(); |
| 430 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || | 430 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 primary_user && | 751 primary_user && |
| 752 profile == ProfileHelper::Get()->GetProfileByUser(primary_user) && | 752 profile == ProfileHelper::Get()->GetProfileByUser(primary_user) && |
| 753 CertLoader::IsInitialized() && | 753 CertLoader::IsInitialized() && |
| 754 base::SysInfo::IsRunningOnChromeOS()) { | 754 base::SysInfo::IsRunningOnChromeOS()) { |
| 755 GetNSSCertDatabaseForProfile(profile, | 755 GetNSSCertDatabaseForProfile(profile, |
| 756 base::Bind(&OnGetNSSCertDatabaseForUser)); | 756 base::Bind(&OnGetNSSCertDatabaseForUser)); |
| 757 } | 757 } |
| 758 } | 758 } |
| 759 | 759 |
| 760 } // namespace chromeos | 760 } // namespace chromeos |
| OLD | NEW |