Index: content/browser/android/web_contents_observer_android.cc |
diff --git a/content/browser/android/web_contents_observer_android.cc b/content/browser/android/web_contents_observer_android.cc |
index 3fa212d1fe674e848163274c090265b34ecc4590..e57c2a5e76858a63fd661d1b76c281cb1757a947 100644 |
--- a/content/browser/android/web_contents_observer_android.cc |
+++ b/content/browser/android/web_contents_observer_android.cc |
@@ -35,11 +35,11 @@ WebContentsObserverAndroid::WebContentsObserverAndroid( |
WebContentsObserverAndroid::~WebContentsObserverAndroid() { |
} |
-jint Init(JNIEnv* env, jobject obj, jint native_web_contents) { |
- WebContents* web_contents = |
- reinterpret_cast<WebContents*>(native_web_contents); |
+jint Init(JNIEnv* env, jobject obj, jint native_content_view_core) { |
+ ContentViewCore* content_view_core = |
+ reinterpret_cast<ContentViewCore*>(native_content_view_core); |
WebContentsObserverAndroid* native_observer = new WebContentsObserverAndroid( |
- env, obj, web_contents); |
+ env, obj, content_view_core->GetWebContents()); |
return reinterpret_cast<jint>(native_observer); |
} |
@@ -105,6 +105,21 @@ void WebContentsObserverAndroid::DidFailLoad( |
false, is_main_frame, error_code, error_description, validated_url); |
} |
+void WebContentsObserverAndroid::DidNavigateMainFrame( |
+ const LoadCommittedDetails& details, |
+ const FrameNavigateParams& params) { |
+ JNIEnv* env = AttachCurrentThread(); |
+ ScopedJavaLocalRef<jobject> obj = weak_java_observer_.get(env); |
+ if (obj.is_null()) |
+ return; |
+ ScopedJavaLocalRef<jstring> jstring_url = |
+ ConvertUTF8ToJavaString(env, params.url.spec()); |
+ ScopedJavaLocalRef<jstring> jstring_base_url = |
+ ConvertUTF8ToJavaString(env, params.base_url.spec()); |
+ Java_WebContentsObserverAndroid_didNavigateMainFrame( |
+ env, obj.obj(), jstring_url.obj(), jstring_base_url.obj()); |
+} |
+ |
void WebContentsObserverAndroid::DidFailLoadInternal( |
bool is_provisional_load, |
bool is_main_frame, |