Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 620563002: ChromeOS NetworkScreenHandler should not call CheckAndResolveLocale on UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chrome_browser_main_chromeos.h" 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 445 }
446 } 446 }
447 447
448 class GuestLanguageSetCallbackData { 448 class GuestLanguageSetCallbackData {
449 public: 449 public:
450 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { 450 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) {
451 } 451 }
452 452
453 // Must match SwitchLanguageCallback type. 453 // Must match SwitchLanguageCallback type.
454 static void Callback(const scoped_ptr<GuestLanguageSetCallbackData>& self, 454 static void Callback(const scoped_ptr<GuestLanguageSetCallbackData>& self,
455 const std::string& locale, 455 scoped_ptr<locale_util::LanguageSwitchResult> result);
456 const std::string& loaded_locale,
457 bool success);
458 456
459 Profile* profile; 457 Profile* profile;
460 }; 458 };
461 459
462 // static 460 // static
463 void GuestLanguageSetCallbackData::Callback( 461 void GuestLanguageSetCallbackData::Callback(
464 const scoped_ptr<GuestLanguageSetCallbackData>& self, 462 const scoped_ptr<GuestLanguageSetCallbackData>& self,
465 const std::string& locale, 463 scoped_ptr<locale_util::LanguageSwitchResult> result) {
466 const std::string& loaded_locale,
467 bool success) {
468 input_method::InputMethodManager* manager = 464 input_method::InputMethodManager* manager =
469 input_method::InputMethodManager::Get(); 465 input_method::InputMethodManager::Get();
470 scoped_refptr<input_method::InputMethodManager::State> ime_state = 466 scoped_refptr<input_method::InputMethodManager::State> ime_state =
471 manager->GetActiveIMEState(); 467 manager->GetActiveIMEState();
472 // Active layout must be hardware "login layout". 468 // Active layout must be hardware "login layout".
473 // The previous one must be "locale default layout". 469 // The previous one must be "locale default layout".
474 // First, enable all hardware input methods. 470 // First, enable all hardware input methods.
475 const std::vector<std::string>& input_methods = 471 const std::vector<std::string>& input_methods =
476 manager->GetInputMethodUtil()->GetHardwareInputMethodIds(); 472 manager->GetInputMethodUtil()->GetHardwareInputMethodIds();
477 for (size_t i = 0; i < input_methods.size(); ++i) 473 for (size_t i = 0; i < input_methods.size(); ++i)
478 ime_state->EnableInputMethod(input_methods[i]); 474 ime_state->EnableInputMethod(input_methods[i]);
479 475
480 // Second, enable locale based input methods. 476 // Second, enable locale based input methods.
481 const std::string locale_default_input_method = 477 const std::string locale_default_input_method =
482 manager->GetInputMethodUtil()->GetLanguageDefaultInputMethodId( 478 manager->GetInputMethodUtil()->GetLanguageDefaultInputMethodId(
483 loaded_locale); 479 result->loaded_locale);
484 if (!locale_default_input_method.empty()) { 480 if (!locale_default_input_method.empty()) {
485 PrefService* user_prefs = self->profile->GetPrefs(); 481 PrefService* user_prefs = self->profile->GetPrefs();
486 user_prefs->SetString(prefs::kLanguagePreviousInputMethod, 482 user_prefs->SetString(prefs::kLanguagePreviousInputMethod,
487 locale_default_input_method); 483 locale_default_input_method);
488 ime_state->EnableInputMethod(locale_default_input_method); 484 ime_state->EnableInputMethod(locale_default_input_method);
489 } 485 }
490 486
491 // Finally, activate the first login input method. 487 // Finally, activate the first login input method.
492 const std::vector<std::string>& login_input_methods = 488 const std::vector<std::string>& login_input_methods =
493 manager->GetInputMethodUtil()->GetHardwareLoginInputMethodIds(); 489 manager->GetInputMethodUtil()->GetHardwareLoginInputMethodIds();
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // Destroy DBus services immediately after threads are stopped. 762 // Destroy DBus services immediately after threads are stopped.
767 dbus_services_.reset(); 763 dbus_services_.reset();
768 764
769 ChromeBrowserMainPartsLinux::PostDestroyThreads(); 765 ChromeBrowserMainPartsLinux::PostDestroyThreads();
770 766
771 // Destroy DeviceSettingsService after g_browser_process. 767 // Destroy DeviceSettingsService after g_browser_process.
772 DeviceSettingsService::Shutdown(); 768 DeviceSettingsService::Shutdown();
773 } 769 }
774 770
775 } // namespace chromeos 771 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698