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

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

Issue 414423002: Removing ContentViewCore dependencies from few functions which acts as direct wrapper to WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 5dfaa28164aa662116751e3e67f6cdc71bd2d390..27c82c0af52866ccf6bea379f4167fd7f1bcd46e 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
@@ -888,7 +888,8 @@ public class ContentViewCore
* Stops loading the current web contents.
*/
public void stopLoading() {
- if (mWebContents != null) mWebContents.stop();
+ assert mWebContents != null;
+ mWebContents.stop();
}
/**
@@ -897,8 +898,8 @@ public class ContentViewCore
* @return The URL of the current page.
*/
public String getUrl() {
- if (mNativeContentViewCore != 0) return nativeGetURL(mNativeContentViewCore);
- return null;
+ assert mWebContents != null;
+ return mWebContents.getUrl();
}
/**
@@ -907,7 +908,8 @@ public class ContentViewCore
* @return The title of the current page.
*/
public String getTitle() {
- return mWebContents == null ? null : mWebContents.getTitle();
+ assert mWebContents != null;
+ return mWebContents.getTitle();
}
/**
@@ -1503,8 +1505,8 @@ public class ContentViewCore
}
private void resetGestureDetection() {
- if (mNativeContentViewCore == 0) return;
- nativeResetGestureDetection(mNativeContentViewCore);
+ assert mWebContents != null;
+ mWebContents.resetGestureDetection();
}
/**
@@ -1961,19 +1963,18 @@ public class ContentViewCore
}
public void updateMultiTouchZoomSupport(boolean supportsMultiTouchZoom) {
- if (mNativeContentViewCore == 0) return;
- nativeSetMultiTouchZoomSupportEnabled(mNativeContentViewCore, supportsMultiTouchZoom);
+ assert mWebContents != null;
+ mWebContents.updateMultiTouchZoomSupport(supportsMultiTouchZoom);
}
public void updateDoubleTapSupport(boolean supportsDoubleTap) {
- if (mNativeContentViewCore == 0) return;
- nativeSetDoubleTapSupportEnabled(mNativeContentViewCore, supportsDoubleTap);
+ assert mWebContents != null;
+ mWebContents.updateDoubleTapSupport(supportsDoubleTap);
}
public void selectPopupMenuItems(int[] indices) {
- if (mNativeContentViewCore != 0) {
- nativeSelectPopupMenuItems(mNativeContentViewCore, indices);
- }
+ assert mWebContents != null;
+ mWebContents.selectPopupMenuItems(indices);
mSelectPopup = null;
}
@@ -2119,9 +2120,10 @@ public class ContentViewCore
mActionMode = null;
// On ICS, startActionMode throws an NPE when getParent() is null.
if (mContainerView.getParent() != null) {
+ assert mWebContents != null;
mActionMode = mContainerView.startActionMode(
getContentViewClient().getSelectActionModeCallback(getContext(), actionHandler,
- nativeIsIncognito(mNativeContentViewCore)));
+ mWebContents.isIncognito()));
}
mUnselectAllOnActionModeDismiss = true;
if (mActionMode == null) {
@@ -2203,9 +2205,10 @@ public class ContentViewCore
}
private void hideTextHandles() {
+ assert mWebContents != null;
mHasSelection = false;
mHasInsertion = false;
- if (mNativeContentViewCore != 0) nativeHideTextHandles(mNativeContentViewCore);
+ mWebContents.hideTextHandles();
}
/**
@@ -3004,9 +3007,8 @@ public class ContentViewCore
}
public void setBackgroundOpaque(boolean opaque) {
- if (mNativeContentViewCore != 0) {
- nativeSetBackgroundOpaque(mNativeContentViewCore, opaque);
- }
+ assert mWebContents != null;
+ mWebContents.setBackgroundOpaque(opaque);
}
@CalledByNative
@@ -3024,8 +3026,8 @@ public class ContentViewCore
@VisibleForTesting
void setHasPendingNavigationTransitionForTesting() {
- if (mNativeContentViewCore == 0) return;
- nativeSetHasPendingNavigationTransitionForTesting(mNativeContentViewCore);
+ assert mWebContents != null;
+ mWebContents.setHasPendingNavigationTransitionForTesting();
}
public void setNavigationTransitionDelegate(NavigationTransitionDelegate delegate) {
@@ -3094,8 +3096,8 @@ public class ContentViewCore
}
public void resumeResponseDeferredAtStart() {
- if (mNativeContentViewCore == 0) return;
- nativeResumeResponseDeferredAtStart(mNativeContentViewCore);
+ assert mWebContents != null;
+ mWebContents.resumeResponseDeferredAtStart();
}
/**
@@ -3130,10 +3132,6 @@ public class ContentViewCore
boolean canLoadLocalResources,
boolean isRendererInitiated);
- private native String nativeGetURL(long nativeContentViewCoreImpl);
-
- private native boolean nativeIsIncognito(long nativeContentViewCoreImpl);
-
private native void nativeSetFocus(long nativeContentViewCoreImpl, boolean focused);
private native void nativeSendOrientationChangeEvent(
@@ -3193,16 +3191,6 @@ public class ContentViewCore
private native void nativeMoveCaret(long nativeContentViewCoreImpl, float x, float y);
- private native void nativeHideTextHandles(long nativeContentViewCoreImpl);
-
- private native void nativeResetGestureDetection(long nativeContentViewCoreImpl);
- private native void nativeSetDoubleTapSupportEnabled(
- long nativeContentViewCoreImpl, boolean enabled);
- private native void nativeSetMultiTouchZoomSupportEnabled(
- long nativeContentViewCoreImpl, boolean enabled);
-
- private native void nativeSelectPopupMenuItems(long nativeContentViewCoreImpl, int[] indices);
-
private native void nativeClearHistory(long nativeContentViewCoreImpl);
private native void nativeEvaluateJavaScript(long nativeContentViewCoreImpl,
@@ -3243,10 +3231,4 @@ public class ContentViewCore
private native void nativeExtractSmartClipData(long nativeContentViewCoreImpl,
int x, int y, int w, int h);
- private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl, boolean opaque);
-
- private native void nativeResumeResponseDeferredAtStart(
- long nativeContentViewCoreImpl);
- private native void nativeSetHasPendingNavigationTransitionForTesting(
- long nativeContentViewCoreImpl);
}

Powered by Google App Engine
This is Rietveld 408576698