| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 #if BUILDFLAG(ENABLE_EXTENSIONS) | 143 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 144 // Set the view type. | 144 // Set the view type. |
| 145 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); | 145 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); |
| 146 #endif | 146 #endif |
| 147 | 147 |
| 148 // Create all the tab helpers. | 148 // Create all the tab helpers. |
| 149 | 149 |
| 150 // SessionTabHelper comes first because it sets up the tab ID, and other | 150 // SessionTabHelper comes first because it sets up the tab ID, and other |
| 151 // helpers may rely on that. | 151 // helpers may rely on that. |
| 152 SessionTabHelper::CreateForWebContents(web_contents); | 152 SessionTabHelper::CreateForWebContents(web_contents); |
| 153 |
| 153 #if !defined(OS_ANDROID) | 154 #if !defined(OS_ANDROID) |
| 154 // ZoomController comes before common tab helpers since ChromeAutofillClient | 155 // ZoomController comes before common tab helpers since ChromeAutofillClient |
| 155 // may want to register as a ZoomObserver with it. | 156 // may want to register as a ZoomObserver with it. |
| 156 zoom::ZoomController::CreateForWebContents(web_contents); | 157 zoom::ZoomController::CreateForWebContents(web_contents); |
| 157 #endif | 158 #endif |
| 158 | 159 |
| 159 // --- Common tab helpers --- | 160 // --- Common tab helpers --- |
| 160 | 161 |
| 161 autofill::ChromeAutofillClient::CreateForWebContents(web_contents); | 162 autofill::ChromeAutofillClient::CreateForWebContents(web_contents); |
| 162 autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( | 163 autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 178 web_contents); | 179 web_contents); |
| 179 ExternalProtocolObserver::CreateForWebContents(web_contents); | 180 ExternalProtocolObserver::CreateForWebContents(web_contents); |
| 180 favicon::CreateContentFaviconDriverForWebContents(web_contents); | 181 favicon::CreateContentFaviconDriverForWebContents(web_contents); |
| 181 FindTabHelper::CreateForWebContents(web_contents); | 182 FindTabHelper::CreateForWebContents(web_contents); |
| 182 history::WebContentsTopSitesObserver::CreateForWebContents( | 183 history::WebContentsTopSitesObserver::CreateForWebContents( |
| 183 web_contents, TopSitesFactory::GetForProfile( | 184 web_contents, TopSitesFactory::GetForProfile( |
| 184 Profile::FromBrowserContext( | 185 Profile::FromBrowserContext( |
| 185 web_contents->GetBrowserContext())).get()); | 186 web_contents->GetBrowserContext())).get()); |
| 186 HistoryTabHelper::CreateForWebContents(web_contents); | 187 HistoryTabHelper::CreateForWebContents(web_contents); |
| 187 InfoBarService::CreateForWebContents(web_contents); | 188 InfoBarService::CreateForWebContents(web_contents); |
| 189 metrics::RendererUptimeWebContentsObserver::CreateForWebContents( |
| 190 web_contents); |
| 191 if (content::IsBrowserSideNavigationEnabled()) |
| 192 MixedContentSettingsTabHelper::CreateForWebContents(web_contents); |
| 188 NavigationCorrectionTabObserver::CreateForWebContents(web_contents); | 193 NavigationCorrectionTabObserver::CreateForWebContents(web_contents); |
| 189 NavigationMetricsRecorder::CreateForWebContents(web_contents); | 194 NavigationMetricsRecorder::CreateForWebContents(web_contents); |
| 190 chrome::InitializePageLoadMetricsForWebContents(web_contents); | 195 chrome::InitializePageLoadMetricsForWebContents(web_contents); |
| 191 PermissionRequestManager::CreateForWebContents(web_contents); | 196 PermissionRequestManager::CreateForWebContents(web_contents); |
| 192 PopupBlockerTabHelper::CreateForWebContents(web_contents); | 197 PopupBlockerTabHelper::CreateForWebContents(web_contents); |
| 193 PrefsTabHelper::CreateForWebContents(web_contents); | 198 PrefsTabHelper::CreateForWebContents(web_contents); |
| 194 prerender::PrerenderTabHelper::CreateForWebContents(web_contents); | 199 prerender::PrerenderTabHelper::CreateForWebContents(web_contents); |
| 195 PreviewsInfoBarTabHelper::CreateForWebContents(web_contents); | 200 PreviewsInfoBarTabHelper::CreateForWebContents(web_contents); |
| 196 SearchTabHelper::CreateForWebContents(web_contents); | 201 SearchTabHelper::CreateForWebContents(web_contents); |
| 197 SearchEngineTabHelper::CreateForWebContents(web_contents); | 202 SearchEngineTabHelper::CreateForWebContents(web_contents); |
| 198 SecurityStateTabHelper::CreateForWebContents(web_contents); | 203 SecurityStateTabHelper::CreateForWebContents(web_contents); |
| 199 if (SiteEngagementService::IsEnabled()) | 204 if (SiteEngagementService::IsEnabled()) |
| 200 SiteEngagementService::Helper::CreateForWebContents(web_contents); | 205 SiteEngagementService::Helper::CreateForWebContents(web_contents); |
| 201 std::unique_ptr<ChromeSubresourceFilterClient> subresource_filter_client( | 206 std::unique_ptr<ChromeSubresourceFilterClient> subresource_filter_client( |
| 202 new ChromeSubresourceFilterClient(web_contents)); | 207 new ChromeSubresourceFilterClient(web_contents)); |
| 203 subresource_filter::ContentSubresourceFilterDriverFactory:: | 208 subresource_filter::ContentSubresourceFilterDriverFactory:: |
| 204 CreateForWebContents(web_contents, std::move(subresource_filter_client)); | 209 CreateForWebContents(web_contents, std::move(subresource_filter_client)); |
| 205 sync_sessions::SyncSessionsRouterTabHelper::CreateForWebContents( | 210 sync_sessions::SyncSessionsRouterTabHelper::CreateForWebContents( |
| 206 web_contents, | 211 web_contents, |
| 207 sync_sessions::SyncSessionsWebContentsRouterFactory::GetForProfile( | 212 sync_sessions::SyncSessionsWebContentsRouterFactory::GetForProfile( |
| 208 Profile::FromBrowserContext(web_contents->GetBrowserContext()))); | 213 Profile::FromBrowserContext(web_contents->GetBrowserContext()))); |
| 209 // TODO(vabr): Remove TabSpecificContentSettings from here once their function | 214 // TODO(vabr): Remove TabSpecificContentSettings from here once their function |
| 210 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 | 215 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 |
| 211 TabSpecificContentSettings::CreateForWebContents(web_contents); | 216 TabSpecificContentSettings::CreateForWebContents(web_contents); |
| 212 if (content::IsBrowserSideNavigationEnabled()) | 217 |
| 213 MixedContentSettingsTabHelper::CreateForWebContents(web_contents); | 218 // NO! Do not just add your tab helper here. This is a large alphabetized |
| 214 metrics::RendererUptimeWebContentsObserver::CreateForWebContents( | 219 // block; please insert your tab helper above in alphabetical order. |
| 215 web_contents); | |
| 216 | 220 |
| 217 // --- Platform-specific tab helpers --- | 221 // --- Platform-specific tab helpers --- |
| 218 | 222 |
| 219 #if defined(OS_ANDROID) | 223 #if defined(OS_ANDROID) |
| 220 banners::AppBannerManagerAndroid::CreateForWebContents(web_contents); | 224 banners::AppBannerManagerAndroid::CreateForWebContents(web_contents); |
| 221 ContextMenuHelper::CreateForWebContents(web_contents); | 225 ContextMenuHelper::CreateForWebContents(web_contents); |
| 222 DataUseTabHelper::CreateForWebContents(web_contents); | 226 DataUseTabHelper::CreateForWebContents(web_contents); |
| 223 | 227 |
| 224 offline_pages::OfflinePageTabHelper::CreateForWebContents(web_contents); | 228 offline_pages::OfflinePageTabHelper::CreateForWebContents(web_contents); |
| 225 offline_pages::RecentTabHelper::CreateForWebContents(web_contents); | 229 offline_pages::RecentTabHelper::CreateForWebContents(web_contents); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 250 web_modal::WebContentsModalDialogManager::CreateForWebContents(web_contents); | 254 web_modal::WebContentsModalDialogManager::CreateForWebContents(web_contents); |
| 251 | 255 |
| 252 if (banners::AppBannerManagerDesktop::IsEnabled()) | 256 if (banners::AppBannerManagerDesktop::IsEnabled()) |
| 253 banners::AppBannerManagerDesktop::CreateForWebContents(web_contents); | 257 banners::AppBannerManagerDesktop::CreateForWebContents(web_contents); |
| 254 #endif | 258 #endif |
| 255 | 259 |
| 256 #if defined(OS_WIN) || defined(OS_MACOSX) || \ | 260 #if defined(OS_WIN) || defined(OS_MACOSX) || \ |
| 257 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 261 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 258 metrics::DesktopSessionDurationObserver::CreateForWebContents(web_contents); | 262 metrics::DesktopSessionDurationObserver::CreateForWebContents(web_contents); |
| 259 #endif | 263 #endif |
| 264 |
| 260 // --- Feature tab helpers behind flags --- | 265 // --- Feature tab helpers behind flags --- |
| 261 | 266 |
| 262 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) | 267 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 263 CaptivePortalTabHelper::CreateForWebContents(web_contents); | 268 CaptivePortalTabHelper::CreateForWebContents(web_contents); |
| 264 #endif | 269 #endif |
| 265 | 270 |
| 266 #if BUILDFLAG(ENABLE_EXTENSIONS) | 271 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 267 extensions::TabHelper::CreateForWebContents(web_contents); | 272 extensions::TabHelper::CreateForWebContents(web_contents); |
| 268 #endif | 273 #endif |
| 269 | 274 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 289 | 294 |
| 290 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( | 295 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( |
| 291 web_contents->GetBrowserContext())) { | 296 web_contents->GetBrowserContext())) { |
| 292 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( | 297 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( |
| 293 web_contents); | 298 web_contents); |
| 294 } | 299 } |
| 295 | 300 |
| 296 if (tracing::NavigationTracingObserver::IsEnabled()) | 301 if (tracing::NavigationTracingObserver::IsEnabled()) |
| 297 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); | 302 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); |
| 298 } | 303 } |
| OLD | NEW |