OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/web_contents_delegate_android/web_contents_delegate_android
.h" | 5 #include "components/web_contents_delegate_android/web_contents_delegate_android
.h" |
6 | 6 |
7 #include <android/keycodes.h> | 7 #include <android/keycodes.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 line_no, | 268 line_no, |
269 jsource_id.obj()); | 269 jsource_id.obj()); |
270 } | 270 } |
271 | 271 |
272 // This is either called from TabContents::DidNavigateMainFramePostCommit() with | 272 // This is either called from TabContents::DidNavigateMainFramePostCommit() with |
273 // an empty GURL or responding to RenderViewHost::OnMsgUpateTargetURL(). In | 273 // an empty GURL or responding to RenderViewHost::OnMsgUpateTargetURL(). In |
274 // Chrome, the latter is not always called, especially not during history | 274 // Chrome, the latter is not always called, especially not during history |
275 // navigation. So we only handle the first case and pass the source TabContents' | 275 // navigation. So we only handle the first case and pass the source TabContents' |
276 // url to Java to update the UI. | 276 // url to Java to update the UI. |
277 void WebContentsDelegateAndroid::UpdateTargetURL(WebContents* source, | 277 void WebContentsDelegateAndroid::UpdateTargetURL(WebContents* source, |
278 int32 page_id, | |
279 const GURL& url) { | 278 const GURL& url) { |
280 if (!url.is_empty()) | 279 if (!url.is_empty()) |
281 return; | 280 return; |
282 JNIEnv* env = AttachCurrentThread(); | 281 JNIEnv* env = AttachCurrentThread(); |
283 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 282 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
284 if (obj.is_null()) | 283 if (obj.is_null()) |
285 return; | 284 return; |
286 ScopedJavaLocalRef<jstring> java_url = | 285 ScopedJavaLocalRef<jstring> java_url = |
287 ConvertUTF8ToJavaString(env, source->GetURL().spec()); | 286 ConvertUTF8ToJavaString(env, source->GetURL().spec()); |
288 Java_WebContentsDelegateAndroid_onUpdateUrl(env, | 287 Java_WebContentsDelegateAndroid_onUpdateUrl(env, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // Native JNI methods | 382 // Native JNI methods |
384 // ---------------------------------------------------------------------------- | 383 // ---------------------------------------------------------------------------- |
385 | 384 |
386 // Register native methods | 385 // Register native methods |
387 | 386 |
388 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 387 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
389 return RegisterNativesImpl(env); | 388 return RegisterNativesImpl(env); |
390 } | 389 } |
391 | 390 |
392 } // namespace web_contents_delegate_android | 391 } // namespace web_contents_delegate_android |
OLD | NEW |