OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/web_contents/web_contents_android.h" | 5 #include "content/browser/web_contents/web_contents_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 host->GetRoutingID(), gfx::Rect())); | 368 host->GetRoutingID(), gfx::Rect())); |
369 } | 369 } |
370 | 370 |
371 void WebContentsAndroid::SelectWordAroundCaret(JNIEnv* env, jobject obj) { | 371 void WebContentsAndroid::SelectWordAroundCaret(JNIEnv* env, jobject obj) { |
372 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 372 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
373 if (!host) | 373 if (!host) |
374 return; | 374 return; |
375 host->SelectWordAroundCaret(); | 375 host->SelectWordAroundCaret(); |
376 } | 376 } |
377 | 377 |
| 378 void WebContentsAndroid::MoveSelectionByCharacterOffset(JNIEnv* env, |
| 379 jobject obj, |
| 380 jint start_adjust, |
| 381 jint end_adjust) { |
| 382 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 383 if (!host) |
| 384 return; |
| 385 host->MoveSelectionByCharacterOffset(start_adjust, end_adjust); |
| 386 } |
| 387 |
378 void WebContentsAndroid::EvaluateJavaScript(JNIEnv* env, | 388 void WebContentsAndroid::EvaluateJavaScript(JNIEnv* env, |
379 jobject obj, | 389 jobject obj, |
380 jstring script, | 390 jstring script, |
381 jobject callback) { | 391 jobject callback) { |
382 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); | 392 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); |
383 DCHECK(rvh); | 393 DCHECK(rvh); |
384 | 394 |
385 if (!rvh->IsRenderViewLive()) { | 395 if (!rvh->IsRenderViewLive()) { |
386 if (!static_cast<WebContentsImpl*>(web_contents_)-> | 396 if (!static_cast<WebContentsImpl*>(web_contents_)-> |
387 CreateRenderViewForInitialEmptyDocument()) { | 397 CreateRenderViewForInitialEmptyDocument()) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 ContentViewCoreImpl* contentViewCore = | 452 ContentViewCoreImpl* contentViewCore = |
443 ContentViewCoreImpl::FromWebContents(web_contents_); | 453 ContentViewCoreImpl::FromWebContents(web_contents_); |
444 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback = | 454 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback = |
445 base::Bind(&AXTreeSnapshotCallback, j_callback, | 455 base::Bind(&AXTreeSnapshotCallback, j_callback, |
446 contentViewCore->GetScaleFactor()); | 456 contentViewCore->GetScaleFactor()); |
447 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot( | 457 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot( |
448 snapshot_callback); | 458 snapshot_callback); |
449 } | 459 } |
450 | 460 |
451 } // namespace content | 461 } // namespace content |
OLD | NEW |