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 "chrome/browser/android/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 return profile_android->GetJavaObject(); | 368 return profile_android->GetJavaObject(); |
369 } | 369 } |
370 | 370 |
371 TabAndroid::TabLoadStatus TabAndroid::LoadUrl(JNIEnv* env, | 371 TabAndroid::TabLoadStatus TabAndroid::LoadUrl(JNIEnv* env, |
372 jobject obj, | 372 jobject obj, |
373 jstring url, | 373 jstring url, |
374 jstring j_extra_headers, | 374 jstring j_extra_headers, |
375 jbyteArray j_post_data, | 375 jbyteArray j_post_data, |
376 jint page_transition, | 376 jint page_transition, |
377 jstring j_referrer_url, | 377 jstring j_referrer_url, |
378 jint referrer_policy) { | 378 jint referrer_policy, |
| 379 jboolean is_renderer_initiated) { |
379 content::ContentViewCore* content_view = GetContentViewCore(); | 380 content::ContentViewCore* content_view = GetContentViewCore(); |
380 if (!content_view) | 381 if (!content_view) |
381 return PAGE_LOAD_FAILED; | 382 return PAGE_LOAD_FAILED; |
382 | 383 |
383 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url)); | 384 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url)); |
384 if (gurl.is_empty()) | 385 if (gurl.is_empty()) |
385 return PAGE_LOAD_FAILED; | 386 return PAGE_LOAD_FAILED; |
386 | 387 |
387 // If the page was prerendered, use it. | 388 // If the page was prerendered, use it. |
388 // Note in incognito mode, we don't have a PrerenderManager. | 389 // Note in incognito mode, we don't have a PrerenderManager. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 } | 446 } |
446 const base::string16 search_terms = | 447 const base::string16 search_terms = |
447 chrome::ExtractSearchTermsFromURL(GetProfile(), gurl); | 448 chrome::ExtractSearchTermsFromURL(GetProfile(), gurl); |
448 SearchTabHelper* search_tab_helper = | 449 SearchTabHelper* search_tab_helper = |
449 SearchTabHelper::FromWebContents(web_contents_.get()); | 450 SearchTabHelper::FromWebContents(web_contents_.get()); |
450 if (!search_terms.empty() && search_tab_helper && | 451 if (!search_terms.empty() && search_tab_helper && |
451 search_tab_helper->SupportsInstant()) { | 452 search_tab_helper->SupportsInstant()) { |
452 search_tab_helper->Submit(search_terms); | 453 search_tab_helper->Submit(search_terms); |
453 return DEFAULT_PAGE_LOAD; | 454 return DEFAULT_PAGE_LOAD; |
454 } | 455 } |
| 456 load_params.is_renderer_initiated = is_renderer_initiated; |
455 content_view->LoadUrl(load_params); | 457 content_view->LoadUrl(load_params); |
456 } | 458 } |
457 return DEFAULT_PAGE_LOAD; | 459 return DEFAULT_PAGE_LOAD; |
458 } | 460 } |
459 | 461 |
460 ToolbarModel::SecurityLevel TabAndroid::GetSecurityLevel(JNIEnv* env, | 462 ToolbarModel::SecurityLevel TabAndroid::GetSecurityLevel(JNIEnv* env, |
461 jobject obj) { | 463 jobject obj) { |
462 return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents()); | 464 return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents()); |
463 } | 465 } |
464 | 466 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 507 |
506 static void Init(JNIEnv* env, jobject obj) { | 508 static void Init(JNIEnv* env, jobject obj) { |
507 TRACE_EVENT0("native", "TabAndroid::Init"); | 509 TRACE_EVENT0("native", "TabAndroid::Init"); |
508 // This will automatically bind to the Java object and pass ownership there. | 510 // This will automatically bind to the Java object and pass ownership there. |
509 new TabAndroid(env, obj); | 511 new TabAndroid(env, obj); |
510 } | 512 } |
511 | 513 |
512 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 514 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
513 return RegisterNativesImpl(env); | 515 return RegisterNativesImpl(env); |
514 } | 516 } |
OLD | NEW |