| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 return chromeos::GetKeyboardOverlayId(input_method_id); | 270 return chromeos::GetKeyboardOverlayId(input_method_id); |
| 271 } | 271 } |
| 272 | 272 |
| 273 virtual void SendHandwritingStroke(const HandwritingStroke& stroke) { | 273 virtual void SendHandwritingStroke(const HandwritingStroke& stroke) { |
| 274 if (!initialized_successfully_) | 274 if (!initialized_successfully_) |
| 275 return; | 275 return; |
| 276 chromeos::SendHandwritingStroke(input_method_status_connection_, stroke); | 276 chromeos::SendHandwritingStroke(input_method_status_connection_, stroke); |
| 277 } | 277 } |
| 278 | 278 |
| 279 virtual void CancelHandwriting(int n_strokes) { | 279 virtual void CancelHandwritingStrokes(int stroke_count) { |
| 280 if (!initialized_successfully_) | 280 if (!initialized_successfully_) |
| 281 return; | 281 return; |
| 282 chromeos::CancelHandwriting(input_method_status_connection_, n_strokes); | 282 // TODO(yusukes): Rename the libcros function to CancelHandwritingStrokes. |
| 283 chromeos::CancelHandwriting(input_method_status_connection_, stroke_count); |
| 283 } | 284 } |
| 284 | 285 |
| 285 private: | 286 private: |
| 286 // Returns true if the given input method config value is a single | 287 // Returns true if the given input method config value is a single |
| 287 // element string list that contains an input method ID of a keyboard | 288 // element string list that contains an input method ID of a keyboard |
| 288 // layout. | 289 // layout. |
| 289 bool ContainOnlyOneKeyboardLayout( | 290 bool ContainOnlyOneKeyboardLayout( |
| 290 const ImeConfigValue& value) { | 291 const ImeConfigValue& value) { |
| 291 return (value.type == ImeConfigValue::kValueTypeStringList && | 292 return (value.type == ImeConfigValue::kValueTypeStringList && |
| 292 value.string_list_value.size() == 1 && | 293 value.string_list_value.size() == 1 && |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 virtual void SetEnableAutoImeShutdown(bool enable) {} | 930 virtual void SetEnableAutoImeShutdown(bool enable) {} |
| 930 | 931 |
| 931 virtual std::string GetKeyboardOverlayId(const std::string& input_method_id) { | 932 virtual std::string GetKeyboardOverlayId(const std::string& input_method_id) { |
| 932 KeyboardOverlayMap::const_iterator iter = | 933 KeyboardOverlayMap::const_iterator iter = |
| 933 keyboard_overlay_map_->find(input_method_id); | 934 keyboard_overlay_map_->find(input_method_id); |
| 934 return (iter != keyboard_overlay_map_->end()) ? | 935 return (iter != keyboard_overlay_map_->end()) ? |
| 935 iter->second : ""; | 936 iter->second : ""; |
| 936 } | 937 } |
| 937 | 938 |
| 938 virtual void SendHandwritingStroke(const HandwritingStroke& stroke) {} | 939 virtual void SendHandwritingStroke(const HandwritingStroke& stroke) {} |
| 939 virtual void CancelHandwriting(int n_strokes) {} | 940 virtual void CancelHandwritingStrokes(int stroke_count) {} |
| 940 | 941 |
| 941 private: | 942 private: |
| 942 typedef std::map<std::string, std::string> KeyboardOverlayMap; | 943 typedef std::map<std::string, std::string> KeyboardOverlayMap; |
| 943 | 944 |
| 944 // Gets input method descriptors for testing. Shouldn't be used for | 945 // Gets input method descriptors for testing. Shouldn't be used for |
| 945 // production. | 946 // production. |
| 946 InputMethodDescriptors* GetInputMethodDescriptorsForTesting() { | 947 InputMethodDescriptors* GetInputMethodDescriptorsForTesting() { |
| 947 InputMethodDescriptors* descriptions = new InputMethodDescriptors; | 948 InputMethodDescriptors* descriptions = new InputMethodDescriptors; |
| 948 // The list is created from output of gen_engines.py in libcros. | 949 // The list is created from output of gen_engines.py in libcros. |
| 949 // % SHARE=/build/x86-generic/usr/share python gen_engines.py | 950 // % SHARE=/build/x86-generic/usr/share python gen_engines.py |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 } | 1194 } |
| 1194 return impl; | 1195 return impl; |
| 1195 } | 1196 } |
| 1196 } | 1197 } |
| 1197 | 1198 |
| 1198 } // namespace chromeos | 1199 } // namespace chromeos |
| 1199 | 1200 |
| 1200 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 1201 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 1201 // won't be deleted until it's last InvokeLater is run. | 1202 // won't be deleted until it's last InvokeLater is run. |
| 1202 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::InputMethodLibraryImpl); | 1203 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::InputMethodLibraryImpl); |
| OLD | NEW |