diff options
author | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-08 18:47:23 +0000 |
---|---|---|
committer | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-08 18:47:23 +0000 |
commit | e30c79bc4bd1a2bc0c637caaeb853067bdf67a94 (patch) | |
tree | 2d809113eb27530f17d69c9b5f86b0120d151d67 /android_webview | |
parent | 82401939f0c7adaa0ab1adf7d27310bc0c0973fe (diff) | |
download | chromium_src-e30c79bc4bd1a2bc0c637caaeb853067bdf67a94.zip chromium_src-e30c79bc4bd1a2bc0c637caaeb853067bdf67a94.tar.gz chromium_src-e30c79bc4bd1a2bc0c637caaeb853067bdf67a94.tar.bz2 |
[android_webview] Stop exposing ContentViewCore to the embedder.
This is something we should have done a while ago. The change is to
expose the ContentViewCore methods used by the embedder on AwContents
and stop exposing the ContentViewCore type to the embedding layer.
BUG=None
TEST=builds
Android only, builds on the trybot.
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/12611008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187004 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 262 |
1 files changed, 259 insertions, 3 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 5db36f0..01927a9 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -17,9 +17,14 @@ import android.os.Bundle; import android.os.Message; import android.text.TextUtils; import android.util.Log; +import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; import android.webkit.GeolocationPermissions; import android.webkit.ValueCallback; @@ -40,6 +45,7 @@ import org.chromium.ui.gfx.DeviceDisplayInfo; import org.chromium.ui.gfx.NativeWindow; import java.io.File; +import java.lang.annotation.Annotation; import java.net.MalformedURLException; import java.net.URL; @@ -291,6 +297,7 @@ public class AwContents { new AwContentVideoViewDelegate(contentsClient, containerView.getContext())); } + // TODO(mkosiba): Remove this once we move the embedding layer to use methods on AwContents. public ContentViewCore getContentViewCore() { return mContentViewCore; } @@ -361,11 +368,11 @@ public class AwContents { } public int getContentHeightCss() { - return (int) Math.ceil(getContentViewCore().getContentHeightCss()); + return (int) Math.ceil(mContentViewCore.getContentHeightCss()); } public int getContentWidthCss() { - return (int) Math.ceil(getContentViewCore().getContentWidthCss()); + return (int) Math.ceil(mContentViewCore.getContentWidthCss()); } public Picture capturePicture() { @@ -473,6 +480,16 @@ public class AwContents { } /** + * Get the URL of the current page. + * + * @return The URL of the current page or null if it's empty. + */ + public String getUrl() { + String url = mContentViewCore.getUrl(); + if (url == null || url.trim().isEmpty()) return null; + return url; + } + /** * Called on the "source" AwContents that is opening the popup window to * provide the AwContents to host the pop up content. */ @@ -535,6 +552,104 @@ public class AwContents { //-------------------------------------------------------------------------------------------- /** + * @see ContentViewCore#getContentSettings() + */ + public ContentSettings getContentSettings() { + return mContentViewCore.getContentSettings(); + } + + /** + * @see ContentViewCore#computeHorizontalScrollRange() + */ + public int computeHorizontalScrollRange() { + return mContentViewCore.computeHorizontalScrollRange(); + } + + /** + * @see ContentViewCore#computeHorizontalScrollOffset() + */ + public int computeHorizontalScrollOffset() { + return mContentViewCore.computeHorizontalScrollOffset(); + } + + /** + * @see ContentViewCore#computeVerticalScrollRange() + */ + public int computeVerticalScrollRange() { + return mContentViewCore.computeVerticalScrollRange(); + } + + /** + * @see ContentViewCore#computeVerticalScrollOffset() + */ + public int computeVerticalScrollOffset() { + return mContentViewCore.computeVerticalScrollOffset(); + } + + /** + * @see ContentViewCore#computeVerticalScrollExtent() + */ + public int computeVerticalScrollExtent() { + return mContentViewCore.computeVerticalScrollExtent(); + } + + /** + * @see android.webkit.WebView#stopLoading() + */ + public void stopLoading() { + mContentViewCore.stopLoading(); + } + + /** + * @see android.webkit.WebView#reload() + */ + public void reload() { + mContentViewCore.reload(); + } + + /** + * @see android.webkit.WebView#canGoBack() + */ + public boolean canGoBack() { + return mContentViewCore.canGoBack(); + } + + /** + * @see android.webkit.WebView#goBack() + */ + public void goBack() { + mContentViewCore.goBack(); + } + + /** + * @see android.webkit.WebView#canGoForward() + */ + public boolean canGoForward() { + return mContentViewCore.canGoForward(); + } + + /** + * @see android.webkit.WebView#goForward() + */ + public void goForward() { + mContentViewCore.goForward(); + } + + /** + * @see android.webkit.WebView#canGoBackOrForward(int) + */ + public boolean canGoBackOrForward(int steps) { + return mContentViewCore.canGoToOffset(steps); + } + + /** + * @see android.webkit.WebView#goBackOrForward(int) + */ + public void goBackOrForward(int steps) { + mContentViewCore.goToOffset(steps); + } + + /** * @see android.webkit.WebView#pauseTimers() */ public void pauseTimers() { @@ -572,6 +687,27 @@ public class AwContents { } /** + * @see android.webkit.WebView#onCreateInputConnection(EditorInfo) + */ + public InputConnection onCreateInputConnection(EditorInfo outAttrs) { + return mContentViewCore.onCreateInputConnection(outAttrs); + } + + /** + * @see android.webkit.WebView#onKeyUp(int, KeyEvent) + */ + public boolean onKeyUp(int keyCode, KeyEvent event) { + return mContentViewCore.onKeyUp(keyCode, event); + } + + /** + * @see android.webkit.WebView#dispatchKeyEvent(KeyEvent) + */ + public boolean dispatchKeyEvent(KeyEvent event) { + return mContentViewCore.dispatchKeyEvent(event); + } + + /** * Clears the resource cache. Note that the cache is per-application, so this will clear the * cache for all WebViews used. * @@ -617,6 +753,27 @@ public class AwContents { return null; } + /** + * @see ContentViewCore#getNavigationHistory() + */ + public NavigationHistory getNavigationHistory() { + return mContentViewCore.getNavigationHistory(); + } + + /** + * @see android.webkit.WebView#getTitle() + */ + public String getTitle() { + return mContentViewCore.getTitle(); + } + + /** + * @see android.webkit.WebView#clearHistory() + */ + public void clearHistory() { + mContentViewCore.clearHistory(); + } + public String[] getHttpAuthUsernamePassword(String host, String realm) { return HttpAuthDatabase.getInstance(mContentViewCore.getContext()) .getHttpAuthUsernamePassword(host, realm); @@ -637,6 +794,13 @@ public class AwContents { } /** + * @see android.webkit.WebView#clearSslPreferences() + */ + public void clearSslPreferences() { + mContentViewCore.clearSslPreferences(); + } + + /** * Method to return all hit test values relevant to public WebView API. * Note that this expose more data than needed for WebView.getHitTestResult. * Unsafely returning reference to mutable internal object to avoid excessive @@ -683,7 +847,63 @@ public class AwContents { * the screen density factor. See CTS WebViewTest.testSetInitialScale. */ public float getScale() { - return (float)(getContentViewCore().getScale() * mDIPScale); + return (float)(mContentViewCore.getScale() * mDIPScale); + } + + /** + * @see android.webkit.WebView#flingScroll(int, int) + */ + public void flingScroll(int vx, int vy) { + mContentViewCore.flingScroll(vx, vy); + } + + /** + * @see android.webkit.WebView#pageUp(boolean) + */ + public boolean pageUp(boolean top) { + return mContentViewCore.pageUp(top); + } + + /** + * @see android.webkit.WebView#pageDown(boolean) + */ + public boolean pageDown(boolean bottom) { + return mContentViewCore.pageDown(bottom); + } + + /** + * @see android.webkit.WebView#canZoomIn() + */ + public boolean canZoomIn() { + return mContentViewCore.canZoomIn(); + } + + /** + * @see android.webkit.WebView#canZoomOut() + */ + public boolean canZoomOut() { + return mContentViewCore.canZoomOut(); + } + + /** + * @see android.webkit.WebView#zoomIn() + */ + public boolean zoomIn() { + return mContentViewCore.zoomIn(); + } + + /** + * @see android.webkit.WebView#zoomOut() + */ + public boolean zoomOut() { + return mContentViewCore.zoomOut(); + } + + /** + * @see android.webkit.WebView#invokeZoomPicker() + */ + public void invokeZoomPicker() { + mContentViewCore.invokeZoomPicker(); } //-------------------------------------------------------------------------------------------- @@ -846,6 +1066,42 @@ public class AwContents { return result; } + /** + * @see ContentViewCore#addPossiblyUnsafeJavascriptInterface(Object, String, Class) + */ + public void addPossiblyUnsafeJavascriptInterface(Object object, String name, + Class<? extends Annotation> requiredAnnotation) { + mContentViewCore.addPossiblyUnsafeJavascriptInterface(object, name, requiredAnnotation); + } + + /** + * @see android.webkit.WebView#removeJavascriptInterface(String) + */ + public void removeJavascriptInterface(String interfaceName) { + mContentViewCore.removeJavascriptInterface(interfaceName); + } + + /** + * @see android.webkit.WebView#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo) + */ + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + mContentViewCore.onInitializeAccessibilityNodeInfo(info); + } + + /** + * @see android.webkit.WebView#onInitializeAccessibilityEvent(AccessibilityEvent) + */ + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + mContentViewCore.onInitializeAccessibilityEvent(event); + } + + /** + * @see android.webkit.WebView#performAccessibilityAction(int, Bundle) + */ + public boolean performAccessibilityAction(int action, Bundle arguments) { + return mContentViewCore.performAccessibilityAction(action, arguments); + } + //-------------------------------------------------------------------------------------------- // Methods called from native via JNI //-------------------------------------------------------------------------------------------- |