| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 | 263 |
| 264 void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*, jobject, | 264 void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*, jobject, |
| 265 int before, int after) { | 265 int before, int after) { |
| 266 RenderFrameHostImpl* rfh = | 266 RenderFrameHostImpl* rfh = |
| 267 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); | 267 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); |
| 268 if (rfh) | 268 if (rfh) |
| 269 rfh->ExtendSelectionAndDelete(before, after); | 269 rfh->ExtendSelectionAndDelete(before, after); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void ImeAdapterAndroid::Unselect(JNIEnv* env, jobject) { | |
| 273 WebContents* wc = GetWebContents(); | |
| 274 if (wc) | |
| 275 wc->Unselect(); | |
| 276 } | |
| 277 | |
| 278 void ImeAdapterAndroid::SelectAll(JNIEnv* env, jobject) { | |
| 279 WebContents* wc = GetWebContents(); | |
| 280 if (wc) | |
| 281 wc->SelectAll(); | |
| 282 } | |
| 283 | |
| 284 void ImeAdapterAndroid::Cut(JNIEnv* env, jobject) { | |
| 285 WebContents* wc = GetWebContents(); | |
| 286 if (wc) | |
| 287 wc->Cut(); | |
| 288 } | |
| 289 | |
| 290 void ImeAdapterAndroid::Copy(JNIEnv* env, jobject) { | |
| 291 WebContents* wc = GetWebContents(); | |
| 292 if (wc) | |
| 293 wc->Copy(); | |
| 294 } | |
| 295 | |
| 296 void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) { | |
| 297 WebContents* wc = GetWebContents(); | |
| 298 if (wc) | |
| 299 wc->Paste(); | |
| 300 } | |
| 301 | |
| 302 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, jobject) { | 272 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, jobject) { |
| 303 java_ime_adapter_.reset(); | 273 java_ime_adapter_.reset(); |
| 304 } | 274 } |
| 305 | 275 |
| 306 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { | 276 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { |
| 307 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 277 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 308 DCHECK(rwhva_); | 278 DCHECK(rwhva_); |
| 309 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); | 279 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); |
| 310 if (!rwh) | 280 if (!rwh) |
| 311 return NULL; | 281 return NULL; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 331 WebContents* ImeAdapterAndroid::GetWebContents() { | 301 WebContents* ImeAdapterAndroid::GetWebContents() { |
| 332 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 302 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
| 333 if (!rwh) | 303 if (!rwh) |
| 334 return NULL; | 304 return NULL; |
| 335 if (!rwh->IsRenderView()) | 305 if (!rwh->IsRenderView()) |
| 336 return NULL; | 306 return NULL; |
| 337 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 307 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
| 338 } | 308 } |
| 339 | 309 |
| 340 } // namespace content | 310 } // namespace content |
| OLD | NEW |