| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 void InputMethodMenu::PreferenceUpdateNeeded( | 420 void InputMethodMenu::PreferenceUpdateNeeded( |
| 421 InputMethodManager* manager, | 421 InputMethodManager* manager, |
| 422 const input_method::InputMethodDescriptor& previous_input_method, | 422 const input_method::InputMethodDescriptor& previous_input_method, |
| 423 const input_method::InputMethodDescriptor& current_input_method) { | 423 const input_method::InputMethodDescriptor& current_input_method) { |
| 424 if (screen_mode_ == StatusAreaHost::kBrowserMode) { | 424 if (screen_mode_ == StatusAreaHost::kBrowserMode) { |
| 425 if (pref_service_) { // make sure we're not in unit tests. | 425 if (pref_service_) { // make sure we're not in unit tests. |
| 426 // Sometimes (e.g. initial boot) |previous_input_method.id()| is empty. | 426 // Sometimes (e.g. initial boot) |previous_input_method.id()| is empty. |
| 427 previous_input_method_pref_.SetValue(previous_input_method.id()); | 427 previous_input_method_pref_.SetValue(previous_input_method.id()); |
| 428 current_input_method_pref_.SetValue(current_input_method.id()); | 428 current_input_method_pref_.SetValue(current_input_method.id()); |
| 429 pref_service_->ScheduleSavePersistentPrefs(); | |
| 430 } | 429 } |
| 431 } else if (screen_mode_ == StatusAreaHost::kViewsLoginMode || | 430 } else if (screen_mode_ == StatusAreaHost::kViewsLoginMode || |
| 432 screen_mode_ == StatusAreaHost::kWebUILoginMode) { | 431 screen_mode_ == StatusAreaHost::kWebUILoginMode) { |
| 433 if (g_browser_process && g_browser_process->local_state()) { | 432 if (g_browser_process && g_browser_process->local_state()) { |
| 434 g_browser_process->local_state()->SetString( | 433 g_browser_process->local_state()->SetString( |
| 435 language_prefs::kPreferredKeyboardLayout, current_input_method.id()); | 434 language_prefs::kPreferredKeyboardLayout, current_input_method.id()); |
| 436 g_browser_process->local_state()->SavePersistentPrefs(); | 435 g_browser_process->local_state()->CommitPendingWrite(); |
| 437 } | 436 } |
| 438 } | 437 } |
| 439 } | 438 } |
| 440 | 439 |
| 441 void InputMethodMenu::PropertyListChanged( | 440 void InputMethodMenu::PropertyListChanged( |
| 442 InputMethodManager* manager, | 441 InputMethodManager* manager, |
| 443 const input_method::ImePropertyList& current_ime_properties) { | 442 const input_method::ImePropertyList& current_ime_properties) { |
| 444 // Usual order of notifications of input method change is: | 443 // Usual order of notifications of input method change is: |
| 445 // 1. RegisterProperties(empty) | 444 // 1. RegisterProperties(empty) |
| 446 // 2. RegisterProperties(list-of-new-properties) | 445 // 2. RegisterProperties(list-of-new-properties) |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 if (screen_mode_ == StatusAreaHost::kViewsLoginMode || | 718 if (screen_mode_ == StatusAreaHost::kViewsLoginMode || |
| 720 screen_mode_ == StatusAreaHost::kWebUILoginMode) { | 719 screen_mode_ == StatusAreaHost::kWebUILoginMode) { |
| 721 manager->RemovePreLoginPreferenceObserver(this); | 720 manager->RemovePreLoginPreferenceObserver(this); |
| 722 } else if (screen_mode_ == StatusAreaHost::kBrowserMode) { | 721 } else if (screen_mode_ == StatusAreaHost::kBrowserMode) { |
| 723 manager->RemovePostLoginPreferenceObserver(this); | 722 manager->RemovePostLoginPreferenceObserver(this); |
| 724 } | 723 } |
| 725 manager->RemoveObserver(this); | 724 manager->RemoveObserver(this); |
| 726 } | 725 } |
| 727 | 726 |
| 728 } // namespace chromeos | 727 } // namespace chromeos |
| OLD | NEW |