| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/status/input_method_menu.h" | 5 #include "chrome/browser/chromeos/status/input_method_menu.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 415 |
| 416 void InputMethodMenu::PreferenceUpdateNeeded( | 416 void InputMethodMenu::PreferenceUpdateNeeded( |
| 417 InputMethodManager* manager, | 417 InputMethodManager* manager, |
| 418 const input_method::InputMethodDescriptor& previous_input_method, | 418 const input_method::InputMethodDescriptor& previous_input_method, |
| 419 const input_method::InputMethodDescriptor& current_input_method) { | 419 const input_method::InputMethodDescriptor& current_input_method) { |
| 420 if (StatusAreaViewChromeos::IsBrowserMode()) { | 420 if (StatusAreaViewChromeos::IsBrowserMode()) { |
| 421 if (pref_service_) { // make sure we're not in unit tests. | 421 if (pref_service_) { // make sure we're not in unit tests. |
| 422 // Sometimes (e.g. initial boot) |previous_input_method.id()| is empty. | 422 // Sometimes (e.g. initial boot) |previous_input_method.id()| is empty. |
| 423 previous_input_method_pref_.SetValue(previous_input_method.id()); | 423 previous_input_method_pref_.SetValue(previous_input_method.id()); |
| 424 current_input_method_pref_.SetValue(current_input_method.id()); | 424 current_input_method_pref_.SetValue(current_input_method.id()); |
| 425 pref_service_->ScheduleSavePersistentPrefs(); | |
| 426 } | 425 } |
| 427 } else if (StatusAreaViewChromeos::IsLoginMode()) { | 426 } else if (StatusAreaViewChromeos::IsLoginMode()) { |
| 428 if (g_browser_process && g_browser_process->local_state()) { | 427 if (g_browser_process && g_browser_process->local_state()) { |
| 429 g_browser_process->local_state()->SetString( | 428 g_browser_process->local_state()->SetString( |
| 430 language_prefs::kPreferredKeyboardLayout, current_input_method.id()); | 429 language_prefs::kPreferredKeyboardLayout, current_input_method.id()); |
| 431 g_browser_process->local_state()->ScheduleSavePersistentPrefs(); | |
| 432 } | 430 } |
| 433 } | 431 } |
| 434 } | 432 } |
| 435 | 433 |
| 436 void InputMethodMenu::PropertyListChanged( | 434 void InputMethodMenu::PropertyListChanged( |
| 437 InputMethodManager* manager, | 435 InputMethodManager* manager, |
| 438 const input_method::ImePropertyList& current_ime_properties) { | 436 const input_method::ImePropertyList& current_ime_properties) { |
| 439 // Usual order of notifications of input method change is: | 437 // Usual order of notifications of input method change is: |
| 440 // 1. RegisterProperties(empty) | 438 // 1. RegisterProperties(empty) |
| 441 // 2. RegisterProperties(list-of-new-properties) | 439 // 2. RegisterProperties(list-of-new-properties) |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 if (!initialized_prefs_) { | 754 if (!initialized_prefs_) { |
| 757 initialized_prefs_ = true; | 755 initialized_prefs_ = true; |
| 758 previous_input_method_pref_.Init( | 756 previous_input_method_pref_.Init( |
| 759 prefs::kLanguagePreviousInputMethod, pref_service_, this); | 757 prefs::kLanguagePreviousInputMethod, pref_service_, this); |
| 760 current_input_method_pref_.Init( | 758 current_input_method_pref_.Init( |
| 761 prefs::kLanguageCurrentInputMethod, pref_service_, this); | 759 prefs::kLanguageCurrentInputMethod, pref_service_, this); |
| 762 } | 760 } |
| 763 } | 761 } |
| 764 | 762 |
| 765 } // namespace chromeos | 763 } // namespace chromeos |
| OLD | NEW |