OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/platform_window/android/platform_window_android.h" | 5 #include "ui/platform_window/android/platform_window_android.h" |
6 | 6 |
7 #include <android/input.h> | 7 #include <android/input.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 bool PlatformWindowAndroid::KeyEvent(JNIEnv* env, | 128 bool PlatformWindowAndroid::KeyEvent(JNIEnv* env, |
129 jobject obj, | 129 jobject obj, |
130 bool pressed, | 130 bool pressed, |
131 jint key_code, | 131 jint key_code, |
132 jint unicode_character) { | 132 jint unicode_character) { |
133 ui::KeyEvent key_event(pressed ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED, | 133 ui::KeyEvent key_event(pressed ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED, |
134 ui::KeyboardCodeFromAndroidKeyCode(key_code), 0); | 134 ui::KeyboardCodeFromAndroidKeyCode(key_code), 0); |
135 key_event.set_platform_keycode(key_code); | |
136 delegate_->DispatchEvent(&key_event); | 135 delegate_->DispatchEvent(&key_event); |
137 if (pressed && unicode_character) { | 136 if (pressed && unicode_character) { |
138 ui::KeyEvent char_event(unicode_character, | 137 ui::KeyEvent char_event(unicode_character, |
139 ui::KeyboardCodeFromAndroidKeyCode(key_code), 0); | 138 ui::KeyboardCodeFromAndroidKeyCode(key_code), 0); |
140 char_event.set_platform_keycode(key_code); | |
141 delegate_->DispatchEvent(&char_event); | 139 delegate_->DispatchEvent(&char_event); |
142 } | 140 } |
143 return true; | 141 return true; |
144 } | 142 } |
145 | 143 |
146 void PlatformWindowAndroid::ReleaseWindow() { | 144 void PlatformWindowAndroid::ReleaseWindow() { |
147 ANativeWindow_release(window_); | 145 ANativeWindow_release(window_); |
148 window_ = NULL; | 146 window_ = NULL; |
149 } | 147 } |
150 | 148 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 214 |
217 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) { | 215 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) { |
218 NOTIMPLEMENTED(); | 216 NOTIMPLEMENTED(); |
219 } | 217 } |
220 | 218 |
221 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() { | 219 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() { |
222 return &platform_ime_controller_; | 220 return &platform_ime_controller_; |
223 } | 221 } |
224 | 222 |
225 } // namespace ui | 223 } // namespace ui |
OLD | NEW |