diff options
author | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-09 22:10:46 +0000 |
---|---|---|
committer | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-09 22:10:46 +0000 |
commit | 4360ae79dc73cb3c29a590dafa4d19817b5a47bf (patch) | |
tree | d2fca3225b319701d30946db524b8b849dda5084 /android_webview/java | |
parent | e87d91382514612bf857f9eee1c373f568bba926 (diff) | |
download | chromium_src-4360ae79dc73cb3c29a590dafa4d19817b5a47bf.zip chromium_src-4360ae79dc73cb3c29a590dafa4d19817b5a47bf.tar.gz chromium_src-4360ae79dc73cb3c29a590dafa4d19817b5a47bf.tar.bz2 |
Componentize IgnoreNavigationResourceThrottle and add chrome and webview specific implementations.
This change moves the IgnoreNavigationResourceThrottle to a separate component
as it will be shared between chrome/android and android_webview.
This change also adds the chrome/ and android_webview/ specializations of the
throttle (or more precisely the callback that is used to find the right method
on the right delegate).
BUG=130006
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10946008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160945 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/java')
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 17 | ||||
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContentsClient.java | 7 |
2 files changed, 18 insertions, 6 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 67848b05..377e568 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -16,6 +16,7 @@ import android.webkit.ValueCallback; import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; import org.chromium.base.ThreadUtils; +import org.chromium.chrome.browser.component.navigation_interception.InterceptNavigationDelegate; import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.NavigationHistory; import org.chromium.content.common.CleanupReference; @@ -48,6 +49,7 @@ public class AwContents { private ContentViewCore mContentViewCore; private AwContentsClient mContentsClient; private AwContentsIoThreadClient mIoThreadClient; + private InterceptNavigationDelegate mInterceptNavigationDelegate; // This can be accessed on any thread after construction. See AwContentsIoThreadClient. private final AwSettings mSettings; @@ -78,6 +80,13 @@ public class AwContents { } } + private class InterceptNavigationDelegateImpl implements InterceptNavigationDelegate { + @Override + public boolean shouldIgnoreNavigation(String url, boolean isUserGestrue) { + return AwContents.this.mContentsClient.shouldIgnoreNavigation(url); + } + } + /** * @param containerView the view-hierarchy item this object will be bound to. * @param internalAccessAdapter to access private methods on containerView. @@ -105,6 +114,7 @@ public class AwContents { mSettings = new AwSettings(mContentViewCore.getContext()); setIoThreadClient(new IoThreadClientImpl()); + setInterceptNavigationDelegate(new InterceptNavigationDelegateImpl()); } public ContentViewCore getContentViewCore() { @@ -121,6 +131,11 @@ public class AwContents { nativeSetIoThreadClient(mNativeAwContents, mIoThreadClient); } + public void setInterceptNavigationDelegate(InterceptNavigationDelegate delegate) { + mInterceptNavigationDelegate = delegate; + nativeSetInterceptNavigationDelegate(mNativeAwContents, delegate); + } + public void destroy() { if (mContentViewCore != null) { mContentViewCore.destroy(); @@ -363,6 +378,8 @@ public class AwContents { private native void nativeSetIoThreadClient(int nativeAwContents, AwContentsIoThreadClient ioThreadClient); + private native void nativeSetInterceptNavigationDelegate(int nativeAwContents, + InterceptNavigationDelegate navigationInterceptionDelegate); private native int nativeFindAllSync(int nativeAwContents, String searchString); private native void nativeFindAllAsync(int nativeAwContents, String searchString); diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java index 15be569..f646040 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java @@ -43,11 +43,6 @@ public abstract class AwContentsClient extends ContentViewClient { } @Override - public boolean shouldOverrideUrlLoading(String url) { - return AwContentsClient.this.shouldOverrideUrlLoading(url); - } - - @Override public void handleKeyboardEvent(KeyEvent event) { AwContentsClient.this.onUnhandledKeyEvent(event); } @@ -147,7 +142,7 @@ public abstract class AwContentsClient extends ContentViewClient { public abstract InterceptedRequestData shouldInterceptRequest(String url); - public abstract boolean shouldOverrideUrlLoading(String url); + public abstract boolean shouldIgnoreNavigation(String url); public abstract void onUnhandledKeyEvent(KeyEvent event); |