| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/tab_helpers.h" | 5 #include "chrome/browser/ui/tab_helpers.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 52 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 53 #include "components/autofill/core/browser/autofill_manager.h" | 53 #include "components/autofill/core/browser/autofill_manager.h" |
| 54 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser
ver.h" | 54 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser
ver.h" |
| 55 #include "components/dom_distiller/core/dom_distiller_switches.h" | 55 #include "components/dom_distiller/core/dom_distiller_switches.h" |
| 56 #include "components/history/content/browser/web_contents_top_sites_observer.h" | 56 #include "components/history/content/browser/web_contents_top_sites_observer.h" |
| 57 #include "components/history/core/browser/top_sites.h" | 57 #include "components/history/core/browser/top_sites.h" |
| 58 #include "components/password_manager/core/browser/password_manager.h" | 58 #include "components/password_manager/core/browser/password_manager.h" |
| 59 #include "components/subresource_filter/content/browser/content_subresource_filt
er_driver_factory.h" | 59 #include "components/subresource_filter/content/browser/content_subresource_filt
er_driver_factory.h" |
| 60 #include "components/tracing/common/tracing_switches.h" | 60 #include "components/tracing/common/tracing_switches.h" |
| 61 #include "content/public/browser/web_contents.h" | 61 #include "content/public/browser/web_contents.h" |
| 62 #include "extensions/features/features.h" |
| 62 #include "printing/features/features.h" | 63 #include "printing/features/features.h" |
| 63 | 64 |
| 64 #if BUILDFLAG(ANDROID_JAVA_UI) | 65 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 65 #include "chrome/browser/android/banners/app_banner_manager_android.h" | 66 #include "chrome/browser/android/banners/app_banner_manager_android.h" |
| 66 #include "chrome/browser/android/data_usage/data_use_tab_helper.h" | 67 #include "chrome/browser/android/data_usage/data_use_tab_helper.h" |
| 67 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h" | 68 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h" |
| 68 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" | 69 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" |
| 69 #include "chrome/browser/android/search_geolocation_disclosure_tab_helper.h" | 70 #include "chrome/browser/android/search_geolocation_disclosure_tab_helper.h" |
| 70 #include "chrome/browser/android/voice_search_tab_helper.h" | 71 #include "chrome/browser/android/voice_search_tab_helper.h" |
| 71 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 72 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 85 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | 86 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
| 86 #include "components/pdf/browser/pdf_web_contents_helper.h" | 87 #include "components/pdf/browser/pdf_web_contents_helper.h" |
| 87 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 88 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 88 #include "components/zoom/zoom_controller.h" | 89 #include "components/zoom/zoom_controller.h" |
| 89 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 90 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 90 | 91 |
| 91 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) | 92 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 92 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 93 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
| 93 #endif | 94 #endif |
| 94 | 95 |
| 95 #if defined(ENABLE_EXTENSIONS) | 96 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 96 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 97 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 97 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 98 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 98 #include "chrome/browser/extensions/tab_helper.h" | 99 #include "chrome/browser/extensions/tab_helper.h" |
| 99 #include "extensions/browser/view_type_utils.h" | 100 #include "extensions/browser/view_type_utils.h" |
| 100 #endif | 101 #endif |
| 101 | 102 |
| 102 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 103 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 103 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" | 104 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
| 104 #endif | 105 #endif |
| 105 | 106 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 126 // If already adopted, nothing to be done. | 127 // If already adopted, nothing to be done. |
| 127 base::SupportsUserData::Data* adoption_tag = | 128 base::SupportsUserData::Data* adoption_tag = |
| 128 web_contents->GetUserData(&kTabContentsAttachedTabHelpersUserDataKey); | 129 web_contents->GetUserData(&kTabContentsAttachedTabHelpersUserDataKey); |
| 129 if (adoption_tag) | 130 if (adoption_tag) |
| 130 return; | 131 return; |
| 131 | 132 |
| 132 // Mark as adopted. | 133 // Mark as adopted. |
| 133 web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey, | 134 web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey, |
| 134 new base::SupportsUserData::Data()); | 135 new base::SupportsUserData::Data()); |
| 135 | 136 |
| 136 #if defined(ENABLE_EXTENSIONS) | 137 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 137 // Set the view type. | 138 // Set the view type. |
| 138 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); | 139 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); |
| 139 #endif | 140 #endif |
| 140 | 141 |
| 141 // Create all the tab helpers. | 142 // Create all the tab helpers. |
| 142 | 143 |
| 143 // SessionTabHelper comes first because it sets up the tab ID, and other | 144 // SessionTabHelper comes first because it sets up the tab ID, and other |
| 144 // helpers may rely on that. | 145 // helpers may rely on that. |
| 145 SessionTabHelper::CreateForWebContents(web_contents); | 146 SessionTabHelper::CreateForWebContents(web_contents); |
| 146 #if !BUILDFLAG(ANDROID_JAVA_UI) | 147 #if !BUILDFLAG(ANDROID_JAVA_UI) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 #if defined(OS_WIN) || defined(OS_MACOSX) || \ | 240 #if defined(OS_WIN) || defined(OS_MACOSX) || \ |
| 240 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 241 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 241 metrics::DesktopSessionDurationObserver::CreateForWebContents(web_contents); | 242 metrics::DesktopSessionDurationObserver::CreateForWebContents(web_contents); |
| 242 #endif | 243 #endif |
| 243 // --- Feature tab helpers behind flags --- | 244 // --- Feature tab helpers behind flags --- |
| 244 | 245 |
| 245 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) | 246 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 246 CaptivePortalTabHelper::CreateForWebContents(web_contents); | 247 CaptivePortalTabHelper::CreateForWebContents(web_contents); |
| 247 #endif | 248 #endif |
| 248 | 249 |
| 249 #if defined(ENABLE_EXTENSIONS) | 250 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 250 extensions::TabHelper::CreateForWebContents(web_contents); | 251 extensions::TabHelper::CreateForWebContents(web_contents); |
| 251 #endif | 252 #endif |
| 252 | 253 |
| 253 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 254 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 254 SupervisedUserNavigationObserver::CreateForWebContents(web_contents); | 255 SupervisedUserNavigationObserver::CreateForWebContents(web_contents); |
| 255 #endif | 256 #endif |
| 256 | 257 |
| 257 #if BUILDFLAG(ENABLE_PRINTING) && !BUILDFLAG(ANDROID_JAVA_UI) | 258 #if BUILDFLAG(ENABLE_PRINTING) && !BUILDFLAG(ANDROID_JAVA_UI) |
| 258 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 259 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 259 printing::PrintViewManager::CreateForWebContents(web_contents); | 260 printing::PrintViewManager::CreateForWebContents(web_contents); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 272 | 273 |
| 273 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( | 274 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( |
| 274 web_contents->GetBrowserContext())) { | 275 web_contents->GetBrowserContext())) { |
| 275 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( | 276 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( |
| 276 web_contents); | 277 web_contents); |
| 277 } | 278 } |
| 278 | 279 |
| 279 if (tracing::NavigationTracingObserver::IsEnabled()) | 280 if (tracing::NavigationTracingObserver::IsEnabled()) |
| 280 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); | 281 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); |
| 281 } | 282 } |
| OLD | NEW |