| 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/favicon/favicon_tab_helper.h" | 15 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 16 #include "chrome/browser/google/google_url_tracker_factory.h" | |
| 17 #include "chrome/browser/infobars/infobar_service.h" | 16 #include "chrome/browser/infobars/infobar_service.h" |
| 18 #include "chrome/browser/prerender/prerender_contents.h" | 17 #include "chrome/browser/prerender/prerender_contents.h" |
| 19 #include "chrome/browser/prerender/prerender_manager.h" | 18 #include "chrome/browser/prerender/prerender_manager.h" |
| 20 #include "chrome/browser/prerender/prerender_manager_factory.h" | 19 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 21 #include "chrome/browser/printing/print_view_manager_basic.h" | 20 #include "chrome/browser/printing/print_view_manager_basic.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/profiles/profile_android.h" | 22 #include "chrome/browser/profiles/profile_android.h" |
| 24 #include "chrome/browser/search/instant_service.h" | 23 #include "chrome/browser/search/instant_service.h" |
| 25 #include "chrome/browser/search/instant_service_factory.h" | 24 #include "chrome/browser/search/instant_service_factory.h" |
| 26 #include "chrome/browser/search/search.h" | 25 #include "chrome/browser/search/search.h" |
| 27 #include "chrome/browser/sessions/session_tab_helper.h" | 26 #include "chrome/browser/sessions/session_tab_helper.h" |
| 28 #include "chrome/browser/sessions/tab_restore_service.h" | 27 #include "chrome/browser/sessions/tab_restore_service.h" |
| 29 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 28 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 30 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" | 29 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" |
| 31 #include "chrome/browser/tab_contents/tab_util.h" | 30 #include "chrome/browser/tab_contents/tab_util.h" |
| 32 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg
ate.h" | 31 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg
ate.h" |
| 33 #include "chrome/browser/ui/android/context_menu_helper.h" | 32 #include "chrome/browser/ui/android/context_menu_helper.h" |
| 34 #include "chrome/browser/ui/android/infobars/infobar_container_android.h" | 33 #include "chrome/browser/ui/android/infobars/infobar_container_android.h" |
| 35 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 34 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 36 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 35 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
| 37 #include "chrome/browser/ui/android/window_android_helper.h" | 36 #include "chrome/browser/ui/android/window_android_helper.h" |
| 38 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 37 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
| 39 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 38 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 40 #include "chrome/browser/ui/search/search_tab_helper.h" | 39 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 41 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 40 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 42 #include "chrome/browser/ui/tab_helpers.h" | 41 #include "chrome/browser/ui/tab_helpers.h" |
| 43 #include "chrome/common/instant_types.h" | 42 #include "chrome/common/instant_types.h" |
| 44 #include "chrome/common/render_messages.h" | 43 #include "chrome/common/render_messages.h" |
| 45 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
| 46 #include "components/google/core/browser/google_url_tracker.h" | |
| 47 #include "components/google/core/browser/google_util.h" | |
| 48 #include "components/infobars/core/infobar_container.h" | 45 #include "components/infobars/core/infobar_container.h" |
| 49 #include "components/url_fixer/url_fixer.h" | 46 #include "components/url_fixer/url_fixer.h" |
| 50 #include "content/public/browser/android/content_view_core.h" | 47 #include "content/public/browser/android/content_view_core.h" |
| 51 #include "content/public/browser/navigation_entry.h" | 48 #include "content/public/browser/navigation_entry.h" |
| 52 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
| 53 #include "content/public/browser/render_frame_host.h" | 50 #include "content/public/browser/render_frame_host.h" |
| 54 #include "content/public/browser/render_process_host.h" | 51 #include "content/public/browser/render_process_host.h" |
| 55 #include "content/public/browser/user_metrics.h" | 52 #include "content/public/browser/user_metrics.h" |
| 56 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
| 57 #include "content/public/common/top_controls_state.h" | 54 #include "content/public/common/top_controls_state.h" |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 FULL_PRERENDERED_PAGE_LOAD : PARTIAL_PRERENDERED_PAGE_LOAD; | 551 FULL_PRERENDERED_PAGE_LOAD : PARTIAL_PRERENDERED_PAGE_LOAD; |
| 555 } | 552 } |
| 556 } | 553 } |
| 557 | 554 |
| 558 GURL fixed_url( | 555 GURL fixed_url( |
| 559 url_fixer::FixupURL(gurl.possibly_invalid_spec(), std::string())); | 556 url_fixer::FixupURL(gurl.possibly_invalid_spec(), std::string())); |
| 560 if (!fixed_url.is_valid()) | 557 if (!fixed_url.is_valid()) |
| 561 return PAGE_LOAD_FAILED; | 558 return PAGE_LOAD_FAILED; |
| 562 | 559 |
| 563 if (!HandleNonNavigationAboutURL(fixed_url)) { | 560 if (!HandleNonNavigationAboutURL(fixed_url)) { |
| 564 // Notify the GoogleURLTracker of searches, it might want to change the | |
| 565 // actual Google site used (for instance when in the UK, google.co.uk, when | |
| 566 // in the US google.com). | |
| 567 // Note that this needs to happen before we initiate the navigation as the | |
| 568 // GoogleURLTracker uses the navigation pending notification to trigger the | |
| 569 // infobar. | |
| 570 if (google_util::IsGoogleSearchUrl(fixed_url) && | |
| 571 (page_transition & ui::PAGE_TRANSITION_GENERATED)) { | |
| 572 GoogleURLTracker* tracker = | |
| 573 GoogleURLTrackerFactory::GetForProfile(GetProfile()); | |
| 574 if (tracker) | |
| 575 tracker->SearchCommitted(); | |
| 576 } | |
| 577 | |
| 578 // Record UMA "ShowHistory" here. That way it'll pick up both user | 561 // Record UMA "ShowHistory" here. That way it'll pick up both user |
| 579 // typing chrome://history as well as selecting from the drop down menu. | 562 // typing chrome://history as well as selecting from the drop down menu. |
| 580 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { | 563 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { |
| 581 content::RecordAction(base::UserMetricsAction("ShowHistory")); | 564 content::RecordAction(base::UserMetricsAction("ShowHistory")); |
| 582 } | 565 } |
| 583 | 566 |
| 584 content::NavigationController::LoadURLParams load_params(fixed_url); | 567 content::NavigationController::LoadURLParams load_params(fixed_url); |
| 585 if (j_extra_headers) { | 568 if (j_extra_headers) { |
| 586 load_params.extra_headers = base::android::ConvertJavaStringToUTF8( | 569 load_params.extra_headers = base::android::ConvertJavaStringToUTF8( |
| 587 env, | 570 env, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 static void Init(JNIEnv* env, jobject obj) { | 731 static void Init(JNIEnv* env, jobject obj) { |
| 749 TRACE_EVENT0("native", "TabAndroid::Init"); | 732 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 750 // This will automatically bind to the Java object and pass ownership there. | 733 // This will automatically bind to the Java object and pass ownership there. |
| 751 new TabAndroid(env, obj); | 734 new TabAndroid(env, obj); |
| 752 } | 735 } |
| 753 | 736 |
| 754 // static | 737 // static |
| 755 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 738 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 756 return RegisterNativesImpl(env); | 739 return RegisterNativesImpl(env); |
| 757 } | 740 } |
| OLD | NEW |