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" |
11 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" | 11 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" |
12 #include "chrome/browser/browser_about_handler.h" | 12 #include "chrome/browser/browser_about_handler.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
15 #include "chrome/browser/google/google_url_tracker.h" | 15 #include "chrome/browser/google/google_url_tracker.h" |
16 #include "chrome/browser/google/google_util.h" | 16 #include "chrome/browser/google/google_util.h" |
17 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
18 #include "chrome/browser/prerender/prerender_contents.h" | 18 #include "chrome/browser/prerender/prerender_contents.h" |
19 #include "chrome/browser/prerender/prerender_manager.h" | 19 #include "chrome/browser/prerender/prerender_manager.h" |
20 #include "chrome/browser/prerender/prerender_manager_factory.h" | 20 #include "chrome/browser/prerender/prerender_manager_factory.h" |
21 #include "chrome/browser/printing/print_view_manager_basic.h" | 21 #include "chrome/browser/printing/print_view_manager_basic.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_android.h" | 23 #include "chrome/browser/profiles/profile_android.h" |
| 24 #include "chrome/browser/search/search.h" |
24 #include "chrome/browser/sessions/session_tab_helper.h" | 25 #include "chrome/browser/sessions/session_tab_helper.h" |
25 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" | 26 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" |
26 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg
ate.h" | 27 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg
ate.h" |
27 #include "chrome/browser/ui/android/context_menu_helper.h" | 28 #include "chrome/browser/ui/android/context_menu_helper.h" |
28 #include "chrome/browser/ui/android/infobars/infobar_container_android.h" | 29 #include "chrome/browser/ui/android/infobars/infobar_container_android.h" |
29 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 30 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
30 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 31 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
31 #include "chrome/browser/ui/android/window_android_helper.h" | 32 #include "chrome/browser/ui/android/window_android_helper.h" |
32 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 33 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
| 34 #include "chrome/browser/ui/search/search_tab_helper.h" |
33 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 35 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
34 #include "chrome/browser/ui/tab_helpers.h" | 36 #include "chrome/browser/ui/tab_helpers.h" |
35 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 37 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
36 #include "chrome/common/net/url_fixer_upper.h" | 38 #include "chrome/common/net/url_fixer_upper.h" |
37 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
38 #include "components/infobars/core/infobar_container.h" | 40 #include "components/infobars/core/infobar_container.h" |
39 #include "content/public/browser/android/content_view_core.h" | 41 #include "content/public/browser/android/content_view_core.h" |
40 #include "content/public/browser/navigation_entry.h" | 42 #include "content/public/browser/navigation_entry.h" |
41 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/user_metrics.h" | 44 #include "content/public/browser/user_metrics.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 load_params.browser_initiated_post_data = | 456 load_params.browser_initiated_post_data = |
455 base::RefCountedBytes::TakeVector(&post_data); | 457 base::RefCountedBytes::TakeVector(&post_data); |
456 } | 458 } |
457 load_params.transition_type = | 459 load_params.transition_type = |
458 content::PageTransitionFromInt(page_transition); | 460 content::PageTransitionFromInt(page_transition); |
459 if (j_referrer_url) { | 461 if (j_referrer_url) { |
460 load_params.referrer = content::Referrer( | 462 load_params.referrer = content::Referrer( |
461 GURL(base::android::ConvertJavaStringToUTF8(env, j_referrer_url)), | 463 GURL(base::android::ConvertJavaStringToUTF8(env, j_referrer_url)), |
462 static_cast<blink::WebReferrerPolicy>(referrer_policy)); | 464 static_cast<blink::WebReferrerPolicy>(referrer_policy)); |
463 } | 465 } |
| 466 const base::string16 search_terms = |
| 467 chrome::ExtractSearchTermsFromURL(GetProfile(), gurl); |
| 468 SearchTabHelper* search_tab_helper = |
| 469 SearchTabHelper::FromWebContents(web_contents_.get()); |
| 470 if (!search_terms.empty() && search_tab_helper && |
| 471 search_tab_helper->SupportsInstant()) { |
| 472 search_tab_helper->Submit(search_terms); |
| 473 return DEFAULT_PAGE_LOAD; |
| 474 } |
464 content_view->LoadUrl(load_params); | 475 content_view->LoadUrl(load_params); |
465 } | 476 } |
466 return DEFAULT_PAGE_LOAD; | 477 return DEFAULT_PAGE_LOAD; |
467 } | 478 } |
468 | 479 |
469 ToolbarModel::SecurityLevel TabAndroid::GetSecurityLevel(JNIEnv* env, | 480 ToolbarModel::SecurityLevel TabAndroid::GetSecurityLevel(JNIEnv* env, |
470 jobject obj) { | 481 jobject obj) { |
471 return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents()); | 482 return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents()); |
472 } | 483 } |
473 | 484 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 525 |
515 static void Init(JNIEnv* env, jobject obj) { | 526 static void Init(JNIEnv* env, jobject obj) { |
516 TRACE_EVENT0("native", "TabAndroid::Init"); | 527 TRACE_EVENT0("native", "TabAndroid::Init"); |
517 // This will automatically bind to the Java object and pass ownership there. | 528 // This will automatically bind to the Java object and pass ownership there. |
518 new TabAndroid(env, obj); | 529 new TabAndroid(env, obj); |
519 } | 530 } |
520 | 531 |
521 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 532 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
522 return RegisterNativesImpl(env); | 533 return RegisterNativesImpl(env); |
523 } | 534 } |
OLD | NEW |