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/input_method/input_method_manager.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include <glib.h> | 9 #include <glib.h> |
10 | 10 |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 } | 678 } |
679 } | 679 } |
680 | 680 |
681 // Change the keyboard layout per input method configuration being | 681 // Change the keyboard layout per input method configuration being |
682 // updated, if necessary. See also: MaybeStartInputMethodDaemon(). | 682 // updated, if necessary. See also: MaybeStartInputMethodDaemon(). |
683 void MaybeChangeCurrentKeyboardLayout(const std::string& section, | 683 void MaybeChangeCurrentKeyboardLayout(const std::string& section, |
684 const std::string& config_name, | 684 const std::string& config_name, |
685 const ImeConfigValue& value) { | 685 const ImeConfigValue& value) { |
686 if (section == language_prefs::kGeneralSectionName && | 686 if (section == language_prefs::kGeneralSectionName && |
687 config_name == language_prefs::kPreloadEnginesConfigName) { | 687 config_name == language_prefs::kPreloadEnginesConfigName) { |
688 if (value.string_list_value.size() == 1) { | 688 if (value.string_list_value.size() == 1 || |
| 689 (value.string_list_value.size() != 0 && |
| 690 current_input_method_.id().empty())) { |
689 // This is necessary to initialize current_input_method_. This is also | 691 // This is necessary to initialize current_input_method_. This is also |
690 // necessary when the current layout (e.g. INTL) out of two (e.g. US and | 692 // necessary when the current layout (e.g. INTL) out of two (e.g. US and |
691 // INTL) is disabled. | 693 // INTL) is disabled. |
692 ChangeCurrentInputMethodFromId(value.string_list_value[0]); | 694 ChangeCurrentInputMethodFromId(value.string_list_value[0]); |
693 } | 695 } |
| 696 DCHECK(!current_input_method_.id().empty()); |
| 697 |
694 // Update the indicator. | 698 // Update the indicator. |
695 // TODO(yusukes): Remove ActiveInputMethodsChanged notification in | 699 // TODO(yusukes): Remove ActiveInputMethodsChanged notification in |
696 // FlushImeConfig(). | 700 // FlushImeConfig(). |
697 const size_t num_active_input_methods = GetNumActiveInputMethods(); | 701 const size_t num_active_input_methods = GetNumActiveInputMethods(); |
698 FOR_EACH_OBSERVER(InputMethodManager::Observer, observers_, | 702 FOR_EACH_OBSERVER(InputMethodManager::Observer, observers_, |
699 ActiveInputMethodsChanged(this, | 703 ActiveInputMethodsChanged(this, |
700 current_input_method(), | 704 current_input_method(), |
701 num_active_input_methods)); | 705 num_active_input_methods)); |
702 } | 706 } |
703 } | 707 } |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 return InputMethodManagerImpl::GetInstance(); | 1389 return InputMethodManagerImpl::GetInstance(); |
1386 } | 1390 } |
1387 | 1391 |
1388 } // namespace input_method | 1392 } // namespace input_method |
1389 } // namespace chromeos | 1393 } // namespace chromeos |
1390 | 1394 |
1391 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 1395 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
1392 // won't be deleted until it's last InvokeLater is run. | 1396 // won't be deleted until it's last InvokeLater is run. |
1393 DISABLE_RUNNABLE_METHOD_REFCOUNT( | 1397 DISABLE_RUNNABLE_METHOD_REFCOUNT( |
1394 chromeos::input_method::InputMethodManagerImpl); | 1398 chromeos::input_method::InputMethodManagerImpl); |
OLD | NEW |