| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 host->GetRoutingID(), gfx::Rect())); | 388 host->GetRoutingID(), gfx::Rect())); |
| 389 } | 389 } |
| 390 | 390 |
| 391 void WebContentsAndroid::SelectWordAroundCaret(JNIEnv* env, jobject obj) { | 391 void WebContentsAndroid::SelectWordAroundCaret(JNIEnv* env, jobject obj) { |
| 392 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 392 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 393 if (!host) | 393 if (!host) |
| 394 return; | 394 return; |
| 395 host->SelectWordAroundCaret(); | 395 host->SelectWordAroundCaret(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void WebContentsAndroid::ExpandSelectionByCharacterOffset(JNIEnv* env, |
| 399 jobject obj, |
| 400 jint start_adjust, |
| 401 jint end_adjust) { |
| 402 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 403 if (!host) |
| 404 return; |
| 405 host->ExpandSelectionByCharacterOffset(start_adjust, end_adjust); |
| 406 } |
| 407 |
| 398 void WebContentsAndroid::EvaluateJavaScript(JNIEnv* env, | 408 void WebContentsAndroid::EvaluateJavaScript(JNIEnv* env, |
| 399 jobject obj, | 409 jobject obj, |
| 400 jstring script, | 410 jstring script, |
| 401 jobject callback) { | 411 jobject callback) { |
| 402 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); | 412 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); |
| 403 DCHECK(rvh); | 413 DCHECK(rvh); |
| 404 | 414 |
| 405 if (!rvh->IsRenderViewLive()) { | 415 if (!rvh->IsRenderViewLive()) { |
| 406 if (!static_cast<WebContentsImpl*>(web_contents_)-> | 416 if (!static_cast<WebContentsImpl*>(web_contents_)-> |
| 407 CreateRenderViewForInitialEmptyDocument()) { | 417 CreateRenderViewForInitialEmptyDocument()) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 ContentViewCoreImpl* contentViewCore = | 472 ContentViewCoreImpl* contentViewCore = |
| 463 ContentViewCoreImpl::FromWebContents(web_contents_); | 473 ContentViewCoreImpl::FromWebContents(web_contents_); |
| 464 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback = | 474 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback = |
| 465 base::Bind(&AXTreeSnapshotCallback, j_callback, | 475 base::Bind(&AXTreeSnapshotCallback, j_callback, |
| 466 contentViewCore->GetScaleFactor()); | 476 contentViewCore->GetScaleFactor()); |
| 467 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot( | 477 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot( |
| 468 snapshot_callback); | 478 snapshot_callback); |
| 469 } | 479 } |
| 470 | 480 |
| 471 } // namespace content | 481 } // namespace content |
| OLD | NEW |