| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <android/input.h> | 8 #include <android/input.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, jobject) { | 275 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, jobject) { |
| 276 java_ime_adapter_.reset(); | 276 java_ime_adapter_.reset(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { | 279 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { |
| 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 281 DCHECK(rwhva_); | 281 DCHECK(rwhva_); |
| 282 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); | 282 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); |
| 283 if (!rwh) | 283 if (!rwh) |
| 284 return NULL; | 284 return nullptr; |
| 285 | 285 |
| 286 return RenderWidgetHostImpl::From(rwh); | 286 return RenderWidgetHostImpl::From(rwh); |
| 287 } | 287 } |
| 288 | 288 |
| 289 RenderFrameHost* ImeAdapterAndroid::GetFocusedFrame() { | 289 RenderFrameHost* ImeAdapterAndroid::GetFocusedFrame() { |
| 290 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 290 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
| 291 if (!rwh) | 291 if (!rwh) |
| 292 return NULL; | 292 return nullptr; |
| 293 if (!rwh->IsRenderView()) | |
| 294 return NULL; | |
| 295 RenderViewHost* rvh = RenderViewHost::From(rwh); | 293 RenderViewHost* rvh = RenderViewHost::From(rwh); |
| 294 if (!rvh) |
| 295 return nullptr; |
| 296 FrameTreeNode* focused_frame = | 296 FrameTreeNode* focused_frame = |
| 297 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); | 297 rvh->GetDelegate()->GetFrameTree()->GetFocusedFrame(); |
| 298 if (!focused_frame) | 298 if (!focused_frame) |
| 299 return NULL; | 299 return nullptr; |
| 300 | 300 |
| 301 return focused_frame->current_frame_host(); | 301 return focused_frame->current_frame_host(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 WebContents* ImeAdapterAndroid::GetWebContents() { | 304 WebContents* ImeAdapterAndroid::GetWebContents() { |
| 305 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 305 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
| 306 if (!rwh) | 306 if (!rwh) |
| 307 return NULL; | 307 return nullptr; |
| 308 if (!rwh->IsRenderView()) | |
| 309 return NULL; | |
| 310 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 308 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
| 311 } | 309 } |
| 312 | 310 |
| 313 } // namespace content | 311 } // namespace content |
| OLD | NEW |