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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 464393002: Restructuring WebContents functions from ContentViewCore to WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary comment. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 5ea4572ddeff44bd54b55882b2cded4f8f8627ea..aed113e8e1d25acd9d9ce71cff835df784fd54b8 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -76,6 +76,7 @@ import org.chromium.content.browser.input.SelectPopupItem;
import org.chromium.content.browser.input.SelectionEventType;
import org.chromium.content.common.ContentSwitches;
import org.chromium.content_public.browser.GestureStateListener;
+import org.chromium.content_public.browser.JavaScriptCallback;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.DeviceFormFactor;
import org.chromium.ui.base.ViewAndroid;
@@ -1354,11 +1355,6 @@ public class ContentViewCore
mWebContents.addStyleSheetByURL(url);
}
- /** Callback interface for evaluateJavaScript(). */
- public interface JavaScriptCallback {
- void handleJavaScriptResult(String jsonResult);
- }
-
/**
* Injects the passed Javascript code in the current page and evaluates it.
* If a result is required, pass in a callback.
@@ -1371,8 +1367,8 @@ public class ContentViewCore
* If no result is required, pass null.
*/
public void evaluateJavaScript(String script, JavaScriptCallback callback) {
- if (mNativeContentViewCore == 0) return;
- nativeEvaluateJavaScript(mNativeContentViewCore, script, callback, false);
+ assert mWebContents != null;
+ mWebContents.evaluateJavaScript(script, callback, false);
}
/**
@@ -1382,8 +1378,8 @@ public class ContentViewCore
* @param script The Javascript to execute.
*/
public void evaluateJavaScriptEvenIfNotYetNavigated(String script) {
- if (mNativeContentViewCore == 0) return;
- nativeEvaluateJavaScript(mNativeContentViewCore, script, null, true);
+ assert mWebContents != null;
+ mWebContents.evaluateJavaScript(script, null, true);
}
/**
@@ -2410,13 +2406,6 @@ public class ContentViewCore
@SuppressWarnings("unused")
@CalledByNative
- private static void onEvaluateJavaScriptResult(
- String jsonResult, JavaScriptCallback callback) {
- callback.handleJavaScriptResult(jsonResult);
- }
-
- @SuppressWarnings("unused")
- @CalledByNative
private void showPastePopup(int xDip, int yDip) {
if (!mHasInsertion || !canPaste()) return;
final float contentOffsetYPix = mRenderCoordinates.getContentOffsetYPix();
@@ -3175,9 +3164,6 @@ public class ContentViewCore
private native void nativeClearHistory(long nativeContentViewCoreImpl);
- private native void nativeEvaluateJavaScript(long nativeContentViewCoreImpl,
- String script, JavaScriptCallback callback, boolean startRenderer);
-
private native void nativePostMessageToFrame(long nativeContentViewCoreImpl, String frameId,
String message, String sourceOrigin, String targetOrigin);

Powered by Google App Engine
This is Rietveld 408576698