| 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/cros/input_method_library.h" | 5 #include "chrome/browser/chromeos/cros/input_method_library.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include <glib.h> | 9 #include <glib.h> |
| 10 | 10 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 return current_ime_properties_; | 255 return current_ime_properties_; |
| 256 } | 256 } |
| 257 | 257 |
| 258 virtual std::string GetKeyboardOverlayId(const std::string& input_method_id) { | 258 virtual std::string GetKeyboardOverlayId(const std::string& input_method_id) { |
| 259 if (!initialized_successfully_) | 259 if (!initialized_successfully_) |
| 260 return ""; | 260 return ""; |
| 261 | 261 |
| 262 return chromeos::GetKeyboardOverlayId(input_method_id); | 262 return chromeos::GetKeyboardOverlayId(input_method_id); |
| 263 } | 263 } |
| 264 | 264 |
| 265 virtual void SendHandwritingStroke(const HandwritingStroke& stroke) { |
| 266 if (!initialized_successfully_) |
| 267 return; |
| 268 chromeos::SendHandwritingStroke(input_method_status_connection_, stroke); |
| 269 } |
| 270 |
| 271 virtual void CancelHandwriting(int n_strokes) { |
| 272 if (!initialized_successfully_) |
| 273 return; |
| 274 chromeos::CancelHandwriting(input_method_status_connection_, n_strokes); |
| 275 } |
| 276 |
| 265 private: | 277 private: |
| 266 // Returns true if the given input method config value is a single | 278 // Returns true if the given input method config value is a single |
| 267 // element string list that contains an input method ID of a keyboard | 279 // element string list that contains an input method ID of a keyboard |
| 268 // layout. | 280 // layout. |
| 269 bool ContainOnlyOneKeyboardLayout( | 281 bool ContainOnlyOneKeyboardLayout( |
| 270 const ImeConfigValue& value) { | 282 const ImeConfigValue& value) { |
| 271 return (value.type == ImeConfigValue::kValueTypeStringList && | 283 return (value.type == ImeConfigValue::kValueTypeStringList && |
| 272 value.string_list_value.size() == 1 && | 284 value.string_list_value.size() == 1 && |
| 273 chromeos::input_method::IsKeyboardLayout( | 285 chromeos::input_method::IsKeyboardLayout( |
| 274 value.string_list_value[0])); | 286 value.string_list_value[0])); |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 virtual void SetDeferImeStartup(bool defer) {} | 900 virtual void SetDeferImeStartup(bool defer) {} |
| 889 virtual void SetEnableAutoImeShutdown(bool enable) {} | 901 virtual void SetEnableAutoImeShutdown(bool enable) {} |
| 890 | 902 |
| 891 virtual std::string GetKeyboardOverlayId(const std::string& input_method_id) { | 903 virtual std::string GetKeyboardOverlayId(const std::string& input_method_id) { |
| 892 KeyboardOverlayMap::const_iterator iter = | 904 KeyboardOverlayMap::const_iterator iter = |
| 893 keyboard_overlay_map_->find(input_method_id); | 905 keyboard_overlay_map_->find(input_method_id); |
| 894 return (iter != keyboard_overlay_map_->end()) ? | 906 return (iter != keyboard_overlay_map_->end()) ? |
| 895 iter->second : ""; | 907 iter->second : ""; |
| 896 } | 908 } |
| 897 | 909 |
| 910 virtual void SendHandwritingStroke(const HandwritingStroke& stroke) {} |
| 911 virtual void CancelHandwriting(int n_strokes) {} |
| 912 |
| 898 private: | 913 private: |
| 899 typedef std::map<std::string, std::string> KeyboardOverlayMap; | 914 typedef std::map<std::string, std::string> KeyboardOverlayMap; |
| 900 | 915 |
| 901 // Gets input method descriptors for testing. Shouldn't be used for | 916 // Gets input method descriptors for testing. Shouldn't be used for |
| 902 // production. | 917 // production. |
| 903 InputMethodDescriptors* GetInputMethodDescriptorsForTesting() { | 918 InputMethodDescriptors* GetInputMethodDescriptorsForTesting() { |
| 904 InputMethodDescriptors* descriptions = new InputMethodDescriptors; | 919 InputMethodDescriptors* descriptions = new InputMethodDescriptors; |
| 905 // The list is created from output of gen_engines.py in libcros. | 920 // The list is created from output of gen_engines.py in libcros. |
| 906 // % SHARE=/build/x86-generic/usr/share python gen_engines.py | 921 // % SHARE=/build/x86-generic/usr/share python gen_engines.py |
| 907 // $SHARE/chromeos-assets/input_methods/whitelist.txt | 922 // $SHARE/chromeos-assets/input_methods/whitelist.txt |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 } | 1165 } |
| 1151 return impl; | 1166 return impl; |
| 1152 } | 1167 } |
| 1153 } | 1168 } |
| 1154 | 1169 |
| 1155 } // namespace chromeos | 1170 } // namespace chromeos |
| 1156 | 1171 |
| 1157 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 1172 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 1158 // won't be deleted until it's last InvokeLater is run. | 1173 // won't be deleted until it's last InvokeLater is run. |
| 1159 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::InputMethodLibraryImpl); | 1174 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::InputMethodLibraryImpl); |
| OLD | NEW |