OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/android/web_contents_observer_proxy.h" | 5 #include "content/browser/android/web_contents_observer_proxy.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 Java_WebContentsObserverProxy_didFinishNavigation( | 87 Java_WebContentsObserverProxy_didFinishNavigation( |
88 env, obj.obj(), navigation_handle->IsInMainFrame(), | 88 env, obj.obj(), navigation_handle->IsInMainFrame(), |
89 navigation_handle->IsErrorPage(), navigation_handle->HasCommitted()); | 89 navigation_handle->IsErrorPage(), navigation_handle->HasCommitted()); |
90 } | 90 } |
91 | 91 |
92 void WebContentsObserverProxy::DidStartLoading() { | 92 void WebContentsObserverProxy::DidStartLoading() { |
93 JNIEnv* env = AttachCurrentThread(); | 93 JNIEnv* env = AttachCurrentThread(); |
94 ScopedJavaLocalRef<jobject> obj(java_observer_); | 94 ScopedJavaLocalRef<jobject> obj(java_observer_); |
95 ScopedJavaLocalRef<jstring> jstring_url( | 95 ScopedJavaLocalRef<jstring> jstring_url( |
96 ConvertUTF8ToJavaString(env, web_contents()->GetVisibleURL().spec())); | 96 ConvertUTF8ToJavaString(env, web_contents()->GetVisibleURL().spec())); |
97 if (auto entry = web_contents()->GetController().GetPendingEntry()) { | 97 if (auto* entry = web_contents()->GetController().GetPendingEntry()) { |
98 base_url_of_last_started_data_url_ = entry->GetBaseURLForDataURL(); | 98 base_url_of_last_started_data_url_ = entry->GetBaseURLForDataURL(); |
99 } | 99 } |
100 Java_WebContentsObserverProxy_didStartLoading(env, obj.obj(), | 100 Java_WebContentsObserverProxy_didStartLoading(env, obj.obj(), |
101 jstring_url.obj()); | 101 jstring_url.obj()); |
102 } | 102 } |
103 | 103 |
104 void WebContentsObserverProxy::DidStopLoading() { | 104 void WebContentsObserverProxy::DidStopLoading() { |
105 JNIEnv* env = AttachCurrentThread(); | 105 JNIEnv* env = AttachCurrentThread(); |
106 ScopedJavaLocalRef<jobject> obj(java_observer_); | 106 ScopedJavaLocalRef<jobject> obj(java_observer_); |
107 std::string url_string = web_contents()->GetLastCommittedURL().spec(); | 107 std::string url_string = web_contents()->GetLastCommittedURL().spec(); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // a base URL if there has been a loadUrl("javascript:...") after | 336 // a base URL if there has been a loadUrl("javascript:...") after |
337 // loadDataWithBaseUrl. | 337 // loadDataWithBaseUrl. |
338 *url = base_url_of_last_started_data_url_.possibly_invalid_spec(); | 338 *url = base_url_of_last_started_data_url_.possibly_invalid_spec(); |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 bool RegisterWebContentsObserverProxy(JNIEnv* env) { | 342 bool RegisterWebContentsObserverProxy(JNIEnv* env) { |
343 return RegisterNativesImpl(env); | 343 return RegisterNativesImpl(env); |
344 } | 344 } |
345 } // namespace content | 345 } // namespace content |
OLD | NEW |