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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 | 166 |
167 void ImeAdapterAndroid::AttachImeAdapter(JNIEnv* env, jobject java_object) { | 167 void ImeAdapterAndroid::AttachImeAdapter(JNIEnv* env, jobject java_object) { |
168 java_ime_adapter_ = AttachCurrentThread()->NewGlobalRef(java_object); | 168 java_ime_adapter_ = AttachCurrentThread()->NewGlobalRef(java_object); |
169 } | 169 } |
170 | 170 |
171 void ImeAdapterAndroid::CancelComposition() { | 171 void ImeAdapterAndroid::CancelComposition() { |
172 Java_ImeAdapter_cancelComposition(AttachCurrentThread(), java_ime_adapter_); | 172 Java_ImeAdapter_cancelComposition(AttachCurrentThread(), java_ime_adapter_); |
173 } | 173 } |
174 | 174 |
175 void ImeAdapterAndroid::ReplaceDateTime(JNIEnv* env, jobject, jstring text) { | |
176 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( | |
177 rwhva_->GetRenderWidgetHost()); | |
178 if (!rwhi) | |
179 return; | |
180 | |
181 string16 text16 = ConvertJavaStringToUTF16(env, text); | |
182 rwhi->Send(new ViewMsg_ReplaceDateTime(rwhi->GetRoutingID(), text16)); | |
183 } | |
184 | |
185 | |
186 void ImeAdapterAndroid::CancelDialog(JNIEnv* env, jobject) { | |
187 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( | |
188 rwhva_->GetRenderWidgetHost()); | |
189 if (!rwhi) | |
190 return; | |
191 | |
192 rwhi->Send(new ViewMsg_CancelDateTimeDialog(rwhi->GetRoutingID())); | |
193 } | |
194 | |
195 void ImeAdapterAndroid::SetEditableSelectionOffsets(JNIEnv*, jobject, | 175 void ImeAdapterAndroid::SetEditableSelectionOffsets(JNIEnv*, jobject, |
196 int start, int end) { | 176 int start, int end) { |
197 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( | 177 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( |
198 rwhva_->GetRenderWidgetHost()); | 178 rwhva_->GetRenderWidgetHost()); |
199 if (!rwhi) | 179 if (!rwhi) |
200 return; | 180 return; |
201 | 181 |
202 rwhi->Send(new ViewMsg_SetEditableSelectionOffsets(rwhi->GetRoutingID(), | 182 rwhi->Send(new ViewMsg_SetEditableSelectionOffsets(rwhi->GetRoutingID(), |
203 start, end)); | 183 start, end)); |
204 } | 184 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) { | 248 void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) { |
269 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( | 249 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( |
270 rwhva_->GetRenderWidgetHost()); | 250 rwhva_->GetRenderWidgetHost()); |
271 if (!rwhi) | 251 if (!rwhi) |
272 return; | 252 return; |
273 | 253 |
274 rwhi->Send(new ViewMsg_Paste(rwhi->GetRoutingID())); | 254 rwhi->Send(new ViewMsg_Paste(rwhi->GetRoutingID())); |
275 } | 255 } |
276 | 256 |
277 } // namespace content | 257 } // namespace content |
OLD | NEW |