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

Unified Diff: content/browser/android/web_contents_observer_proxy.cc

Issue 1432083004: [Android WebView] Fire onPageFinished from WebContentsObserver::didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore required AwWebContentsObserverTest changes Created 5 years, 1 month 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
« no previous file with comments | « content/browser/android/web_contents_observer_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/web_contents_observer_proxy.cc
diff --git a/content/browser/android/web_contents_observer_proxy.cc b/content/browser/android/web_contents_observer_proxy.cc
index c04f9263b0031ff90b8981244a55a9d7e52eb464..923f5a6bdd3c27d05f1ec57bed63c755a4a6a1fd 100644
--- a/content/browser/android/web_contents_observer_proxy.cc
+++ b/content/browser/android/web_contents_observer_proxy.cc
@@ -87,8 +87,10 @@ void WebContentsObserverProxy::DidStartLoading() {
void WebContentsObserverProxy::DidStopLoading() {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> obj(java_observer_);
+ std::string url_string = web_contents()->GetLastCommittedURL().spec();
+ SetToBaseURLForDataURLIfNeeded(&url_string);
ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString(
- env, web_contents()->GetLastCommittedURL().spec()));
+ env, url_string));
Java_WebContentsObserverProxy_didStopLoading(env, obj.obj(),
jstring_url.obj());
}
@@ -205,11 +207,7 @@ void WebContentsObserverProxy::DidFinishLoad(RenderFrameHost* render_frame_host,
ScopedJavaLocalRef<jobject> obj(java_observer_);
std::string url_string = validated_url.spec();
- NavigationEntry* entry =
- web_contents()->GetController().GetLastCommittedEntry();
- // Note that GetBaseURLForDataURL is only used by the Android WebView.
- if (entry && !entry->GetBaseURLForDataURL().is_empty())
- url_string = entry->GetBaseURLForDataURL().possibly_invalid_spec();
+ SetToBaseURLForDataURLIfNeeded(&url_string);
ScopedJavaLocalRef<jstring> jstring_url(
ConvertUTF8ToJavaString(env, url_string));
@@ -300,6 +298,15 @@ void WebContentsObserverProxy::MediaSessionStateChanged(bool is_controllable,
env, obj.obj(), is_controllable, is_suspended);
}
+void WebContentsObserverProxy::SetToBaseURLForDataURLIfNeeded(
+ std::string* url) {
+ NavigationEntry* entry =
+ web_contents()->GetController().GetLastCommittedEntry();
+ // Note that GetBaseURLForDataURL is only used by the Android WebView.
+ if (entry && !entry->GetBaseURLForDataURL().is_empty())
+ *url = entry->GetBaseURLForDataURL().possibly_invalid_spec();
+}
+
bool RegisterWebContentsObserverProxy(JNIEnv* env) {
return RegisterNativesImpl(env);
}
« no previous file with comments | « content/browser/android/web_contents_observer_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698