Index: ui/base/ime/input_method.cc |
diff --git a/ui/base/ime/input_method.cc b/ui/base/ime/input_method.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..332f44437142dea836f59124f703941c5f5f4741 |
--- /dev/null |
+++ b/ui/base/ime/input_method.cc |
@@ -0,0 +1,53 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/base/ime/input_method.h" |
+ |
+namespace ui { |
+ |
+InputMethod::~InputMethod() { |
+} |
+ |
+// We emulate Windows' WM_KEYDOWN and WM_CHAR messages. WM_CHAR events are only |
+// generated for certain keys; see |
+// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646268.aspx. |
+bool InputMethod::ShouldSendCharEventForKeyboardCode(KeyboardCode keycode) { |
+ if ((keycode >= VKEY_0 && keycode <= VKEY_9) || |
+ (keycode >= VKEY_A && keycode <= VKEY_Z) || |
+ (keycode >= VKEY_NUMPAD0 && keycode <= VKEY_NUMPAD9)) { |
+ return true; |
+ } |
+ |
+ switch (keycode) { |
+ case VKEY_BACK: |
+ case VKEY_RETURN: |
+ case VKEY_ESCAPE: |
+ case VKEY_SPACE: |
+ case VKEY_TAB: |
+ // In addition to the keys listed at MSDN, we include other |
+ // graphic-character and numpad keys. |
+ case VKEY_MULTIPLY: |
+ case VKEY_ADD: |
+ case VKEY_SUBTRACT: |
+ case VKEY_DECIMAL: |
+ case VKEY_DIVIDE: |
+ case VKEY_OEM_1: |
+ case VKEY_OEM_2: |
+ case VKEY_OEM_3: |
+ case VKEY_OEM_4: |
+ case VKEY_OEM_5: |
+ case VKEY_OEM_6: |
+ case VKEY_OEM_7: |
+ case VKEY_OEM_102: |
+ case VKEY_OEM_PLUS: |
+ case VKEY_OEM_COMMA: |
+ case VKEY_OEM_MINUS: |
+ case VKEY_OEM_PERIOD: |
+ return true; |
+ default: |
+ return false; |
+ } |
+} |
+ |
+} // namespace ui |