| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ibus_controller.h" | 5 #include "chrome/browser/chromeos/input_method/ibus_controller.h" |
| 6 | 6 |
| 7 #if defined(HAVE_IBUS) | 7 #if defined(HAVE_IBUS) |
| 8 #include <ibus.h> | 8 #include <ibus.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include <algorithm> // for std::reverse. | 11 #include <algorithm> // for std::reverse. |
| 12 #include <cstdio> | 12 #include <cstdio> |
| 13 #include <cstring> // for std::strcmp. | 13 #include <cstring> // for std::strcmp. |
| 14 #include <set> | 14 #include <set> |
| 15 #include <sstream> | 15 #include <sstream> |
| 16 #include <stack> | 16 #include <stack> |
| 17 #include <utility> | 17 #include <utility> |
| 18 | 18 |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "chrome/browser/chromeos/input_method/ibus_input_methods.h" | |
| 22 #include "chrome/browser/chromeos/input_method/input_method_engine.h" | 21 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
| 23 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 22 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 24 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 23 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 25 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" | 24 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" |
| 25 #include "chrome/browser/chromeos/input_method/input_methods.h" |
| 26 | 26 |
| 27 namespace chromeos { | 27 namespace chromeos { |
| 28 namespace input_method { | 28 namespace input_method { |
| 29 | 29 |
| 30 #if defined(HAVE_IBUS) | 30 #if defined(HAVE_IBUS) |
| 31 const char kPanelObjectKey[] = "panel-object"; | 31 const char kPanelObjectKey[] = "panel-object"; |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 // Also defined in chrome/browser/chromeos/language_preferences.h (Chrome tree). | 35 // Also defined in chrome/browser/chromeos/language_preferences.h (Chrome tree). |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 799 } |
| 800 | 800 |
| 801 // Retrieves input method status and notifies them to the UI. | 801 // Retrieves input method status and notifies them to the UI. |
| 802 // |current_global_engine_id| is the current global engine id such as "mozc" | 802 // |current_global_engine_id| is the current global engine id such as "mozc" |
| 803 // and "xkb:us::eng". If the id is unknown, an empty string "" can be passed. | 803 // and "xkb:us::eng". If the id is unknown, an empty string "" can be passed. |
| 804 // Warning: you can call this function only from ibus callback functions | 804 // Warning: you can call this function only from ibus callback functions |
| 805 // like FocusIn(). See http://crosbug.com/5217#c9 for details. | 805 // like FocusIn(). See http://crosbug.com/5217#c9 for details. |
| 806 void UpdateUI(const char* current_global_engine_id) { | 806 void UpdateUI(const char* current_global_engine_id) { |
| 807 DCHECK(current_global_engine_id); | 807 DCHECK(current_global_engine_id); |
| 808 | 808 |
| 809 const IBusEngineInfo* engine_info = NULL; | 809 const InputMethodsInfo* engine_info = NULL; |
| 810 for (size_t i = 0; i < arraysize(kIBusEngines); ++i) { | 810 for (size_t i = 0; i < arraysize(kInputMethods); ++i) { |
| 811 if (kIBusEngines[i].input_method_id == | 811 if (kInputMethods[i].input_method_id == |
| 812 std::string(current_global_engine_id)) { | 812 std::string(current_global_engine_id)) { |
| 813 engine_info = &kIBusEngines[i]; | 813 engine_info = &kInputMethods[i]; |
| 814 break; | 814 break; |
| 815 } | 815 } |
| 816 } | 816 } |
| 817 | 817 |
| 818 InputMethodDescriptor current_input_method; | 818 InputMethodDescriptor current_input_method; |
| 819 if (engine_info) { | 819 if (engine_info) { |
| 820 current_input_method = CreateInputMethodDescriptor( | 820 current_input_method = CreateInputMethodDescriptor( |
| 821 engine_info->input_method_id, | 821 engine_info->input_method_id, |
| 822 "", | 822 "", |
| 823 engine_info->xkb_layout_id, | 823 engine_info->xkb_layout_id, |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 #else | 1156 #else |
| 1157 return new IBusControllerStubImpl; | 1157 return new IBusControllerStubImpl; |
| 1158 #endif | 1158 #endif |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 IBusController::~IBusController() { | 1161 IBusController::~IBusController() { |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 } // namespace input_method | 1164 } // namespace input_method |
| 1165 } // namespace chromeos | 1165 } // namespace chromeos |
| OLD | NEW |