OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/ime_adapter_android.h" | 5 #include "content/browser/renderer_host/ime_adapter_android.h" |
6 | 6 |
7 #include <android/input.h> | 7 #include <android/input.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 | 89 |
90 ImeAdapterAndroid::ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva) | 90 ImeAdapterAndroid::ImeAdapterAndroid(RenderWidgetHostViewAndroid* rwhva) |
91 : rwhva_(rwhva) { | 91 : rwhva_(rwhva) { |
92 } | 92 } |
93 | 93 |
94 ImeAdapterAndroid::~ImeAdapterAndroid() { | 94 ImeAdapterAndroid::~ImeAdapterAndroid() { |
95 JNIEnv* env = AttachCurrentThread(); | 95 JNIEnv* env = AttachCurrentThread(); |
96 base::android::ScopedJavaLocalRef<jobject> obj = java_ime_adapter_.get(env); | 96 base::android::ScopedJavaLocalRef<jobject> obj = java_ime_adapter_.get(env); |
97 if (!obj.is_null()) | 97 if (!obj.is_null()) |
98 Java_ImeAdapter_detach(env, obj.obj()); | 98 Java_ImeAdapter_detach(env, obj.obj(), reinterpret_cast<jint>(this)); |
99 } | 99 } |
100 | 100 |
101 bool ImeAdapterAndroid::SendSyntheticKeyEvent(JNIEnv*, | 101 bool ImeAdapterAndroid::SendSyntheticKeyEvent(JNIEnv*, |
102 jobject, | 102 jobject, |
103 int type, | 103 int type, |
104 long time_ms, | 104 long time_ms, |
105 int key_code, | 105 int key_code, |
106 int text) { | 106 int text) { |
107 NativeWebKeyboardEvent event(static_cast<WebKit::WebInputEvent::Type>(type), | 107 NativeWebKeyboardEvent event(static_cast<WebKit::WebInputEvent::Type>(type), |
108 0 /* modifiers */, time_ms / 1000.0, key_code, | 108 0 /* modifiers */, time_ms / 1000.0, key_code, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) { | 260 void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) { |
261 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( | 261 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( |
262 rwhva_->GetRenderWidgetHost()); | 262 rwhva_->GetRenderWidgetHost()); |
263 if (!rwhi) | 263 if (!rwhi) |
264 return; | 264 return; |
265 | 265 |
266 rwhi->Send(new ViewMsg_Paste(rwhi->GetRoutingID())); | 266 rwhi->Send(new ViewMsg_Paste(rwhi->GetRoutingID())); |
267 } | 267 } |
268 | 268 |
269 } // namespace content | 269 } // namespace content |
OLD | NEW |