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

Side by Side Diff: content/browser/android/web_contents_observer_proxy.cc

Issue 2716493004: Renamed NavigationHandle::IsSamePage to NavigationHandle::IsSameDocument (Closed)
Patch Set: Rebased Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 void WebContentsObserverProxy::DidStartNavigation( 131 void WebContentsObserverProxy::DidStartNavigation(
132 NavigationHandle* navigation_handle) { 132 NavigationHandle* navigation_handle) {
133 JNIEnv* env = AttachCurrentThread(); 133 JNIEnv* env = AttachCurrentThread();
134 ScopedJavaLocalRef<jobject> obj(java_observer_); 134 ScopedJavaLocalRef<jobject> obj(java_observer_);
135 ScopedJavaLocalRef<jstring> jstring_url( 135 ScopedJavaLocalRef<jstring> jstring_url(
136 ConvertUTF8ToJavaString(env, navigation_handle->GetURL().spec())); 136 ConvertUTF8ToJavaString(env, navigation_handle->GetURL().spec()));
137 Java_WebContentsObserverProxy_didStartNavigation( 137 Java_WebContentsObserverProxy_didStartNavigation(
138 env, obj, jstring_url, navigation_handle->IsInMainFrame(), 138 env, obj, jstring_url, navigation_handle->IsInMainFrame(),
139 navigation_handle->IsSamePage(), navigation_handle->IsErrorPage()); 139 navigation_handle->IsSameDocument(), navigation_handle->IsErrorPage());
140 } 140 }
141 141
142 void WebContentsObserverProxy::DidFinishNavigation( 142 void WebContentsObserverProxy::DidFinishNavigation(
143 NavigationHandle* navigation_handle) { 143 NavigationHandle* navigation_handle) {
144 JNIEnv* env = AttachCurrentThread(); 144 JNIEnv* env = AttachCurrentThread();
145 ScopedJavaLocalRef<jobject> obj(java_observer_); 145 ScopedJavaLocalRef<jobject> obj(java_observer_);
146 ScopedJavaLocalRef<jstring> jstring_url( 146 ScopedJavaLocalRef<jstring> jstring_url(
147 ConvertUTF8ToJavaString(env, navigation_handle->GetURL().spec())); 147 ConvertUTF8ToJavaString(env, navigation_handle->GetURL().spec()));
148 148
149 bool is_fragment_navigation = navigation_handle->IsSamePage(); 149 bool is_fragment_navigation = navigation_handle->IsSameDocument();
150 150
151 if (navigation_handle->HasCommitted()) { 151 if (navigation_handle->HasCommitted()) {
152 // See http://crbug.com/251330 for why it's determined this way. 152 // See http://crbug.com/251330 for why it's determined this way.
153 url::Replacements<char> replacements; 153 url::Replacements<char> replacements;
154 replacements.ClearRef(); 154 replacements.ClearRef();
155 bool urls_same_ignoring_fragment = 155 bool urls_same_ignoring_fragment =
156 navigation_handle->GetURL().ReplaceComponents(replacements) == 156 navigation_handle->GetURL().ReplaceComponents(replacements) ==
157 navigation_handle->GetPreviousURL().ReplaceComponents(replacements); 157 navigation_handle->GetPreviousURL().ReplaceComponents(replacements);
158 is_fragment_navigation &= urls_same_ignoring_fragment; 158 is_fragment_navigation &= urls_same_ignoring_fragment;
159 } 159 }
160 160
161 // TODO(shaktisahu): Provide appropriate error description (crbug/690784). 161 // TODO(shaktisahu): Provide appropriate error description (crbug/690784).
162 ScopedJavaLocalRef<jstring> jerror_description; 162 ScopedJavaLocalRef<jstring> jerror_description;
163 163
164 Java_WebContentsObserverProxy_didFinishNavigation( 164 Java_WebContentsObserverProxy_didFinishNavigation(
165 env, obj, jstring_url, navigation_handle->IsInMainFrame(), 165 env, obj, jstring_url, navigation_handle->IsInMainFrame(),
166 navigation_handle->IsErrorPage(), navigation_handle->HasCommitted(), 166 navigation_handle->IsErrorPage(), navigation_handle->HasCommitted(),
167 navigation_handle->IsSamePage(), is_fragment_navigation, 167 navigation_handle->IsSameDocument(), is_fragment_navigation,
168 navigation_handle->HasCommitted() ? navigation_handle->GetPageTransition() 168 navigation_handle->HasCommitted() ? navigation_handle->GetPageTransition()
169 : -1, 169 : -1,
170 navigation_handle->GetNetErrorCode(), jerror_description, 170 navigation_handle->GetNetErrorCode(), jerror_description,
171 // TODO(shaktisahu): Change default status to -1 after fixing 171 // TODO(shaktisahu): Change default status to -1 after fixing
172 // crbug/690041. 172 // crbug/690041.
173 navigation_handle->GetResponseHeaders() 173 navigation_handle->GetResponseHeaders()
174 ? navigation_handle->GetResponseHeaders()->response_code() 174 ? navigation_handle->GetResponseHeaders()->response_code()
175 : 200); 175 : 200);
176 } 176 }
177 177
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // a base URL if there has been a loadUrl("javascript:...") after 266 // a base URL if there has been a loadUrl("javascript:...") after
267 // loadDataWithBaseUrl. 267 // loadDataWithBaseUrl.
268 *url = base_url_of_last_started_data_url_.possibly_invalid_spec(); 268 *url = base_url_of_last_started_data_url_.possibly_invalid_spec();
269 } 269 }
270 } 270 }
271 271
272 bool RegisterWebContentsObserverProxy(JNIEnv* env) { 272 bool RegisterWebContentsObserverProxy(JNIEnv* env) {
273 return RegisterNativesImpl(env); 273 return RegisterNativesImpl(env);
274 } 274 }
275 } // namespace content 275 } // namespace content
OLDNEW
« no previous file with comments | « components/zoom/zoom_controller.cc ('k') | content/browser/bluetooth/web_bluetooth_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698