| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/content_settings/chrome_content_settings_client.h" | 10 #include "chrome/browser/content_settings/chrome_content_settings_client.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 44 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 45 #include "components/autofill/core/browser/autofill_manager.h" | 45 #include "components/autofill/core/browser/autofill_manager.h" |
| 46 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser
ver.h" | 46 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser
ver.h" |
| 47 #include "components/dom_distiller/core/dom_distiller_switches.h" | 47 #include "components/dom_distiller/core/dom_distiller_switches.h" |
| 48 #include "components/history/content/browser/web_contents_top_sites_observer.h" | 48 #include "components/history/content/browser/web_contents_top_sites_observer.h" |
| 49 #include "components/history/core/browser/top_sites.h" | 49 #include "components/history/core/browser/top_sites.h" |
| 50 #include "components/password_manager/core/browser/password_manager.h" | 50 #include "components/password_manager/core/browser/password_manager.h" |
| 51 #include "components/tracing/tracing_switches.h" | 51 #include "components/tracing/tracing_switches.h" |
| 52 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
| 53 | 53 |
| 54 #include "chrome/browser/permissions/permission_request_manager.h" |
| 55 |
| 54 #if BUILDFLAG(ANDROID_JAVA_UI) | 56 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 55 #include "chrome/browser/android/data_usage/data_use_tab_helper.h" | 57 #include "chrome/browser/android/data_usage/data_use_tab_helper.h" |
| 56 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h" | 58 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h" |
| 57 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" | 59 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" |
| 58 #include "chrome/browser/android/voice_search_tab_helper.h" | 60 #include "chrome/browser/android/voice_search_tab_helper.h" |
| 59 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 61 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| 60 #include "chrome/browser/ui/android/context_menu_helper.h" | 62 #include "chrome/browser/ui/android/context_menu_helper.h" |
| 61 #include "chrome/browser/ui/android/view_android_helper.h" | 63 #include "chrome/browser/ui/android/view_android_helper.h" |
| 62 #include "components/offline_pages/offline_page_feature.h" | 64 #include "components/offline_pages/offline_page_feature.h" |
| 63 #else | 65 #else |
| 64 #include "chrome/browser/banners/app_banner_manager_desktop.h" | 66 #include "chrome/browser/banners/app_banner_manager_desktop.h" |
| 65 #include "chrome/browser/permissions/permission_request_manager.h" | |
| 66 #include "chrome/browser/plugins/plugin_observer.h" | 67 #include "chrome/browser/plugins/plugin_observer.h" |
| 67 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" | 68 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
| 68 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h" | 69 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h" |
| 69 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 70 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 70 #include "chrome/browser/ui/hung_plugin_tab_helper.h" | 71 #include "chrome/browser/ui/hung_plugin_tab_helper.h" |
| 71 #include "chrome/browser/ui/sad_tab_helper.h" | 72 #include "chrome/browser/ui/sad_tab_helper.h" |
| 72 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 73 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| 73 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | 74 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
| 74 #include "components/pdf/browser/pdf_web_contents_helper.h" | 75 #include "components/pdf/browser/pdf_web_contents_helper.h" |
| 75 #include "components/ui/zoom/zoom_controller.h" | 76 #include "components/ui/zoom/zoom_controller.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 PrefsTabHelper::CreateForWebContents(web_contents); | 171 PrefsTabHelper::CreateForWebContents(web_contents); |
| 171 prerender::PrerenderTabHelper::CreateForWebContents(web_contents); | 172 prerender::PrerenderTabHelper::CreateForWebContents(web_contents); |
| 172 SearchTabHelper::CreateForWebContents(web_contents); | 173 SearchTabHelper::CreateForWebContents(web_contents); |
| 173 ChromeSecurityStateModelClient::CreateForWebContents(web_contents); | 174 ChromeSecurityStateModelClient::CreateForWebContents(web_contents); |
| 174 if (SiteEngagementService::IsEnabled()) | 175 if (SiteEngagementService::IsEnabled()) |
| 175 SiteEngagementHelper::CreateForWebContents(web_contents); | 176 SiteEngagementHelper::CreateForWebContents(web_contents); |
| 176 // TODO(vabr): Remove TabSpecificContentSettings from here once their function | 177 // TODO(vabr): Remove TabSpecificContentSettings from here once their function |
| 177 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 | 178 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 |
| 178 TabSpecificContentSettings::CreateForWebContents(web_contents); | 179 TabSpecificContentSettings::CreateForWebContents(web_contents); |
| 179 | 180 |
| 181 PermissionRequestManager::CreateForWebContents(web_contents); |
| 182 |
| 180 // --- Platform-specific tab helpers --- | 183 // --- Platform-specific tab helpers --- |
| 181 | 184 |
| 182 #if BUILDFLAG(ANDROID_JAVA_UI) | 185 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 183 ContextMenuHelper::CreateForWebContents(web_contents); | 186 ContextMenuHelper::CreateForWebContents(web_contents); |
| 184 DataUseTabHelper::CreateForWebContents(web_contents); | 187 DataUseTabHelper::CreateForWebContents(web_contents); |
| 185 | 188 |
| 186 offline_pages::OfflinePageTabHelper::CreateForWebContents(web_contents); | 189 offline_pages::OfflinePageTabHelper::CreateForWebContents(web_contents); |
| 187 if (offline_pages::IsOffliningRecentPagesEnabled()) | 190 if (offline_pages::IsOffliningRecentPagesEnabled()) |
| 188 offline_pages::RecentTabHelper::CreateForWebContents(web_contents); | 191 offline_pages::RecentTabHelper::CreateForWebContents(web_contents); |
| 189 | 192 |
| 190 SingleTabModeTabHelper::CreateForWebContents(web_contents); | 193 SingleTabModeTabHelper::CreateForWebContents(web_contents); |
| 191 ViewAndroidHelper::CreateForWebContents(web_contents); | 194 ViewAndroidHelper::CreateForWebContents(web_contents); |
| 192 VoiceSearchTabHelper::CreateForWebContents(web_contents); | 195 VoiceSearchTabHelper::CreateForWebContents(web_contents); |
| 193 #else | 196 #else |
| 194 BookmarkTabHelper::CreateForWebContents(web_contents); | 197 BookmarkTabHelper::CreateForWebContents(web_contents); |
| 195 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | 198 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( |
| 196 web_contents); | 199 web_contents); |
| 197 extensions::WebNavigationTabObserver::CreateForWebContents(web_contents); | 200 extensions::WebNavigationTabObserver::CreateForWebContents(web_contents); |
| 198 HungPluginTabHelper::CreateForWebContents(web_contents); | 201 HungPluginTabHelper::CreateForWebContents(web_contents); |
| 199 ManagePasswordsUIController::CreateForWebContents(web_contents); | 202 ManagePasswordsUIController::CreateForWebContents(web_contents); |
| 200 pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( | 203 pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( |
| 201 web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>( | 204 web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>( |
| 202 new ChromePDFWebContentsHelperClient())); | 205 new ChromePDFWebContentsHelperClient())); |
| 203 PermissionRequestManager::CreateForWebContents(web_contents); | |
| 204 PluginObserver::CreateForWebContents(web_contents); | 206 PluginObserver::CreateForWebContents(web_contents); |
| 205 SadTabHelper::CreateForWebContents(web_contents); | 207 SadTabHelper::CreateForWebContents(web_contents); |
| 206 safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(web_contents); | 208 safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(web_contents); |
| 207 SearchEngineTabHelper::CreateForWebContents(web_contents); | 209 SearchEngineTabHelper::CreateForWebContents(web_contents); |
| 208 TabContentsSyncedTabDelegate::CreateForWebContents(web_contents); | 210 TabContentsSyncedTabDelegate::CreateForWebContents(web_contents); |
| 209 TabDialogs::CreateForWebContents(web_contents); | 211 TabDialogs::CreateForWebContents(web_contents); |
| 210 ThumbnailTabHelper::CreateForWebContents(web_contents); | 212 ThumbnailTabHelper::CreateForWebContents(web_contents); |
| 211 web_modal::WebContentsModalDialogManager::CreateForWebContents(web_contents); | 213 web_modal::WebContentsModalDialogManager::CreateForWebContents(web_contents); |
| 212 | 214 |
| 213 if (banners::AppBannerManagerDesktop::IsEnabled()) { | 215 if (banners::AppBannerManagerDesktop::IsEnabled()) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 254 |
| 253 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( | 255 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( |
| 254 web_contents->GetBrowserContext())) { | 256 web_contents->GetBrowserContext())) { |
| 255 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( | 257 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( |
| 256 web_contents); | 258 web_contents); |
| 257 } | 259 } |
| 258 | 260 |
| 259 if (tracing::NavigationTracingObserver::IsEnabled()) | 261 if (tracing::NavigationTracingObserver::IsEnabled()) |
| 260 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); | 262 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); |
| 261 } | 263 } |
| OLD | NEW |