Chromium Code Reviews| 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 |