| 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/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| 45 #include "components/google/core/browser/google_url_tracker.h" | |
| 46 #include "components/google/core/browser/google_util.h" | |
| 47 #include "components/infobars/core/infobar_container.h" | 44 #include "components/infobars/core/infobar_container.h" |
| 48 #include "components/url_fixer/url_fixer.h" | 45 #include "components/url_fixer/url_fixer.h" |
| 49 #include "content/public/browser/android/content_view_core.h" | 46 #include "content/public/browser/android/content_view_core.h" |
| 50 #include "content/public/browser/navigation_entry.h" | 47 #include "content/public/browser/navigation_entry.h" |
| 51 #include "content/public/browser/notification_service.h" | 48 #include "content/public/browser/notification_service.h" |
| 52 #include "content/public/browser/render_process_host.h" | 49 #include "content/public/browser/render_process_host.h" |
| 53 #include "content/public/browser/user_metrics.h" | 50 #include "content/public/browser/user_metrics.h" |
| 54 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
| 55 #include "jni/Tab_jni.h" | 52 #include "jni/Tab_jni.h" |
| 56 #include "skia/ext/image_operations.h" | 53 #include "skia/ext/image_operations.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 FULL_PRERENDERED_PAGE_LOAD : PARTIAL_PRERENDERED_PAGE_LOAD; | 544 FULL_PRERENDERED_PAGE_LOAD : PARTIAL_PRERENDERED_PAGE_LOAD; |
| 548 } | 545 } |
| 549 } | 546 } |
| 550 | 547 |
| 551 GURL fixed_url( | 548 GURL fixed_url( |
| 552 url_fixer::FixupURL(gurl.possibly_invalid_spec(), std::string())); | 549 url_fixer::FixupURL(gurl.possibly_invalid_spec(), std::string())); |
| 553 if (!fixed_url.is_valid()) | 550 if (!fixed_url.is_valid()) |
| 554 return PAGE_LOAD_FAILED; | 551 return PAGE_LOAD_FAILED; |
| 555 | 552 |
| 556 if (!HandleNonNavigationAboutURL(fixed_url)) { | 553 if (!HandleNonNavigationAboutURL(fixed_url)) { |
| 557 // Notify the GoogleURLTracker of searches, it might want to change the | |
| 558 // actual Google site used (for instance when in the UK, google.co.uk, when | |
| 559 // in the US google.com). | |
| 560 // Note that this needs to happen before we initiate the navigation as the | |
| 561 // GoogleURLTracker uses the navigation pending notification to trigger the | |
| 562 // infobar. | |
| 563 if (google_util::IsGoogleSearchUrl(fixed_url) && | |
| 564 (page_transition & ui::PAGE_TRANSITION_GENERATED)) { | |
| 565 GoogleURLTracker* tracker = | |
| 566 GoogleURLTrackerFactory::GetForProfile(GetProfile()); | |
| 567 if (tracker) | |
| 568 tracker->SearchCommitted(); | |
| 569 } | |
| 570 | |
| 571 // Record UMA "ShowHistory" here. That way it'll pick up both user | 554 // Record UMA "ShowHistory" here. That way it'll pick up both user |
| 572 // typing chrome://history as well as selecting from the drop down menu. | 555 // typing chrome://history as well as selecting from the drop down menu. |
| 573 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { | 556 if (fixed_url.spec() == chrome::kChromeUIHistoryURL) { |
| 574 content::RecordAction(base::UserMetricsAction("ShowHistory")); | 557 content::RecordAction(base::UserMetricsAction("ShowHistory")); |
| 575 } | 558 } |
| 576 | 559 |
| 577 content::NavigationController::LoadURLParams load_params(fixed_url); | 560 content::NavigationController::LoadURLParams load_params(fixed_url); |
| 578 if (j_extra_headers) { | 561 if (j_extra_headers) { |
| 579 load_params.extra_headers = base::android::ConvertJavaStringToUTF8( | 562 load_params.extra_headers = base::android::ConvertJavaStringToUTF8( |
| 580 env, | 563 env, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 static void Init(JNIEnv* env, jobject obj) { | 698 static void Init(JNIEnv* env, jobject obj) { |
| 716 TRACE_EVENT0("native", "TabAndroid::Init"); | 699 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 717 // This will automatically bind to the Java object and pass ownership there. | 700 // This will automatically bind to the Java object and pass ownership there. |
| 718 new TabAndroid(env, obj); | 701 new TabAndroid(env, obj); |
| 719 } | 702 } |
| 720 | 703 |
| 721 // static | 704 // static |
| 722 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 705 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 723 return RegisterNativesImpl(env); | 706 return RegisterNativesImpl(env); |
| 724 } | 707 } |
| OLD | NEW |