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

Side by Side Diff: content/browser/renderer_host/ime_adapter_android.cc

Issue 183923030: Almost finish moving context_menu_node_ from RenderViewImpl to RenderFrameImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/browser/frame_host/render_frame_host_impl.h"
15 #include "content/browser/renderer_host/render_view_host_impl.h"
14 #include "content/browser/renderer_host/render_widget_host_impl.h" 16 #include "content/browser/renderer_host/render_widget_host_impl.h"
15 #include "content/browser/renderer_host/render_widget_host_view_android.h" 17 #include "content/browser/renderer_host/render_widget_host_view_android.h"
16 #include "content/common/view_messages.h" 18 #include "content/common/view_messages.h"
17 #include "content/public/browser/native_web_keyboard_event.h" 19 #include "content/public/browser/native_web_keyboard_event.h"
18 #include "jni/ImeAdapter_jni.h" 20 #include "jni/ImeAdapter_jni.h"
19 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 21 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
20 #include "third_party/WebKit/public/web/WebInputEvent.h" 22 #include "third_party/WebKit/public/web/WebInputEvent.h"
21 23
22 using base::android::AttachCurrentThread; 24 using base::android::AttachCurrentThread;
23 using base::android::ConvertJavaStringToUTF16; 25 using base::android::ConvertJavaStringToUTF16;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 235
234 void ImeAdapterAndroid::SelectAll(JNIEnv* env, jobject) { 236 void ImeAdapterAndroid::SelectAll(JNIEnv* env, jobject) {
235 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); 237 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl();
236 if (!rwhi) 238 if (!rwhi)
237 return; 239 return;
238 240
239 rwhi->SelectAll(); 241 rwhi->SelectAll();
240 } 242 }
241 243
242 void ImeAdapterAndroid::Cut(JNIEnv* env, jobject) { 244 void ImeAdapterAndroid::Cut(JNIEnv* env, jobject) {
243 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); 245 RenderFrameHost* rfh = GetRenderFrameHost();
244 if (!rwhi) 246 if (rfh)
245 return; 247 rfh->Cut();
246
247 rwhi->Cut();
248 } 248 }
249 249
250 void ImeAdapterAndroid::Copy(JNIEnv* env, jobject) { 250 void ImeAdapterAndroid::Copy(JNIEnv* env, jobject) {
251 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); 251 RenderFrameHost* rfh = GetRenderFrameHost();
252 if (!rwhi) 252 if (rfh)
253 return; 253 rfh->Copy();
254
255 rwhi->Copy();
256 } 254 }
257 255
258 void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) { 256 void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) {
259 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); 257 RenderFrameHost* rfh = GetRenderFrameHost();
260 if (!rwhi) 258 if (rfh)
261 return; 259 rfh->Paste();
262
263 rwhi->Paste();
264 } 260 }
265 261
266 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, jobject) { 262 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, jobject) {
267 java_ime_adapter_.reset(); 263 java_ime_adapter_.reset();
268 } 264 }
269 265
270 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { 266 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() {
271 DCHECK(rwhva_); 267 DCHECK(rwhva_);
272 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); 268 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost();
273 if (!rwh) 269 if (!rwh)
274 return NULL; 270 return NULL;
275 271
276 return RenderWidgetHostImpl::From(rwh); 272 return RenderWidgetHostImpl::From(rwh);
277 } 273 }
278 274
275 RenderFrameHost* ImeAdapterAndroid::GetRenderFrameHost() {
nasko 2014/03/05 21:50:47 nit: Shouldn't this be GetFocusedRenderFrameHost?
jam 2014/03/06 00:59:37 Done.
276 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl();
277 if (!rwh)
278 return NULL;
279 if (!rwh->IsRenderView())
280 return NULL;
281 RenderViewHost* rvh = RenderViewHost::From(rwh);
282 return rvh->GetFocusedFrame();
283 }
284
279 } // namespace content 285 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698