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

Unified Diff: android_webview/native/aw_web_contents_delegate.cc

Issue 10946008: Componentize IgnoreNavigationResourceThrottle and add chrome and webview specific implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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: android_webview/native/aw_web_contents_delegate.cc
diff --git a/android_webview/native/aw_web_contents_delegate.cc b/android_webview/native/aw_web_contents_delegate.cc
index 73021281e067b482292ed45f64d697085dc0ba96..48edbc21986383ebd70e9951fc533ff02a8040d8 100644
--- a/android_webview/native/aw_web_contents_delegate.cc
+++ b/android_webview/native/aw_web_contents_delegate.cc
@@ -4,6 +4,15 @@
#include "android_webview/native/aw_web_contents_delegate.h"
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "googleurl/src/gurl.h"
+#include "jni/AwWebContentsDelegate_jni.h"
+
+using base::android::AttachCurrentThread;
+using base::android::ConvertUTF8ToJavaString;
+using base::android::ScopedJavaLocalRef;
+
namespace android_webview {
AwWebContentsDelegate::AwWebContentsDelegate(
@@ -15,4 +24,25 @@ AwWebContentsDelegate::AwWebContentsDelegate(
AwWebContentsDelegate::~AwWebContentsDelegate() {
}
+bool AwWebContentsDelegate::ShouldIgnoreNavigation(const GURL& url) {
+ if (!url.is_valid())
benm (inactive) 2012/09/19 11:04:04 braces?
mkosiba (inactive) 2012/09/25 18:01:47 optional according to the coding style.
+ return false;
+
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
+ if (obj.is_null())
+ return false;
+
+ ScopedJavaLocalRef<jstring> jstring_url =
+ ConvertUTF8ToJavaString(env, url.spec());
+ bool ret = Java_AwWebContentsDelegate_shouldIgnoreNavigation(
benm (inactive) 2012/09/19 11:04:04 nit: no need for local ret?
mkosiba (inactive) 2012/09/25 18:01:47 Done.
+ env, obj.obj(), jstring_url.obj());
+ return ret;
+}
+
+// register native methods
+bool RegisterAwWebContentsDelegate(JNIEnv* env) {
+ return RegisterNativesImpl(env) >= 0;
+}
+
} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698