Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: content/browser/renderer_host/native_web_keyboard_event_aura.cc

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git mv desktop_host_unittest.cc desktop_host_ime_unittest.cc Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | ui/aura/desktop_host.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/native_web_keyboard_event_aura.cc
diff --git a/content/browser/renderer_host/native_web_keyboard_event_aura.cc b/content/browser/renderer_host/native_web_keyboard_event_aura.cc
index fa3d0d6d569a0712a536bce910ebe5a7993ac93b..15120bff81eb5690e578aa58c8f5463165150d50 100644
--- a/content/browser/renderer_host/native_web_keyboard_event_aura.cc
+++ b/content/browser/renderer_host/native_web_keyboard_event_aura.cc
@@ -4,10 +4,24 @@
#include "content/public/browser/native_web_keyboard_event.h"
+#include "base/logging.h"
#include "content/browser/renderer_host/web_input_event_aura.h"
+#include "ui/base/events.h"
using WebKit::WebKeyboardEvent;
+namespace {
+
+int EventFlagsToWebInputEventModifiers(int flags) {
+ return
+ (flags & ui::EF_SHIFT_DOWN ? WebKit::WebInputEvent::ShiftKey : 0) |
+ (flags & ui::EF_CONTROL_DOWN ? WebKit::WebInputEvent::ControlKey : 0) |
+ (flags & ui::EF_CAPS_LOCK_DOWN ? WebKit::WebInputEvent::CapsLockOn : 0) |
+ (flags & ui::EF_ALT_DOWN ? WebKit::WebInputEvent::AltKey : 0);
+}
+
+} // namespace
+
NativeWebKeyboardEvent::NativeWebKeyboardEvent()
: os_event(NULL),
skip_in_browser(false) {
@@ -27,6 +41,36 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(
skip_in_browser(other.skip_in_browser) {
}
+// From chrome/common/native_web_keyboard_event_views.cc.
sky 2011/12/01 17:01:09 Is this comment right (meaning I think you hat the
Yusuke Sato 2011/12/02 02:18:31 I actually copied (and then slightly modified) the
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(
+ ui::EventType key_event_type,
+ bool is_char,
+ wchar_t character,
+ int state,
+ double time_stamp_seconds)
+ : os_event(NULL),
+ skip_in_browser(true /* already handled by the input method */) {
+ switch (key_event_type) {
+ case ui::ET_KEY_PRESSED:
+ type = is_char ? WebKit::WebInputEvent::Char :
+ WebKit::WebInputEvent::RawKeyDown;
+ break;
+ case ui::ET_KEY_RELEASED:
+ type = WebKit::WebInputEvent::KeyUp;
+ break;
+ default:
+ NOTREACHED();
+ }
+
+ modifiers = EventFlagsToWebInputEventModifiers(state);
+ timeStampSeconds = time_stamp_seconds;
+ windowsKeyCode = character;
+ nativeKeyCode = character;
+ text[0] = character;
+ unmodifiedText[0] = character;
+ isSystemKey = (state & ui::EF_ALT_DOWN) != 0;
+}
+
NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
const NativeWebKeyboardEvent& other) {
WebKeyboardEvent::operator=(other);
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | ui/aura/desktop_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698