| 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 "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/content_settings/chrome_content_settings_client.h" | 9 #include "chrome/browser/content_settings/chrome_content_settings_client.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" | 22 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
| 23 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 23 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
| 24 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 24 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 25 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 25 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 26 #include "chrome/browser/ui/navigation_correction_tab_observer.h" | 26 #include "chrome/browser/ui/navigation_correction_tab_observer.h" |
| 27 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" | 27 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" |
| 28 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 28 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
| 29 #include "chrome/browser/ui/search/search_tab_helper.h" | 29 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 30 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 30 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "components/autofill/content/browser/content_autofill_driver.h" | 32 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 33 #include "components/autofill/core/browser/autofill_manager.h" | 33 #include "components/autofill/core/browser/autofill_manager.h" |
| 34 #include "components/dom_distiller/content/web_contents_main_frame_observer.h" | 34 #include "components/dom_distiller/content/web_contents_main_frame_observer.h" |
| 35 #include "components/password_manager/core/browser/password_manager.h" | 35 #include "components/password_manager/core/browser/password_manager.h" |
| 36 #include "components/signin/core/common/profile_management_switches.h" | 36 #include "components/signin/core/common/profile_management_switches.h" |
| 37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 38 | 38 |
| 39 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
| 40 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 40 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| 41 #include "chrome/browser/ui/android/context_menu_helper.h" | 41 #include "chrome/browser/ui/android/context_menu_helper.h" |
| 42 #include "chrome/browser/ui/android/window_android_helper.h" | 42 #include "chrome/browser/ui/android/window_android_helper.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 SessionTabHelper::CreateForWebContents(web_contents); | 122 SessionTabHelper::CreateForWebContents(web_contents); |
| 123 #if !defined(OS_ANDROID) | 123 #if !defined(OS_ANDROID) |
| 124 // ZoomController comes before common tab helpers since ChromeAutofillClient | 124 // ZoomController comes before common tab helpers since ChromeAutofillClient |
| 125 // may want to register as a ZoomObserver with it. | 125 // may want to register as a ZoomObserver with it. |
| 126 ZoomController::CreateForWebContents(web_contents); | 126 ZoomController::CreateForWebContents(web_contents); |
| 127 #endif | 127 #endif |
| 128 | 128 |
| 129 // --- Common tab helpers --- | 129 // --- Common tab helpers --- |
| 130 | 130 |
| 131 autofill::ChromeAutofillClient::CreateForWebContents(web_contents); | 131 autofill::ChromeAutofillClient::CreateForWebContents(web_contents); |
| 132 autofill::ContentAutofillDriver::CreateForWebContentsAndDelegate( | 132 autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( |
| 133 web_contents, | 133 web_contents, |
| 134 autofill::ChromeAutofillClient::FromWebContents(web_contents), | 134 autofill::ChromeAutofillClient::FromWebContents(web_contents), |
| 135 g_browser_process->GetApplicationLocale(), | 135 g_browser_process->GetApplicationLocale(), |
| 136 autofill::AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); | 136 autofill::AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); |
| 137 BookmarkTabHelper::CreateForWebContents(web_contents); | 137 BookmarkTabHelper::CreateForWebContents(web_contents); |
| 138 chrome_browser_net::NetErrorTabHelper::CreateForWebContents(web_contents); | 138 chrome_browser_net::NetErrorTabHelper::CreateForWebContents(web_contents); |
| 139 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( | 139 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( |
| 140 web_contents, | 140 web_contents, |
| 141 autofill::ChromeAutofillClient::FromWebContents(web_contents)); | 141 autofill::ChromeAutofillClient::FromWebContents(web_contents)); |
| 142 CoreTabHelper::CreateForWebContents(web_contents); | 142 CoreTabHelper::CreateForWebContents(web_contents); |
| 143 FaviconTabHelper::CreateForWebContents(web_contents); | 143 FaviconTabHelper::CreateForWebContents(web_contents); |
| 144 FindTabHelper::CreateForWebContents(web_contents); | 144 FindTabHelper::CreateForWebContents(web_contents); |
| 145 HistoryTabHelper::CreateForWebContents(web_contents); | 145 HistoryTabHelper::CreateForWebContents(web_contents); |
| 146 InfoBarService::CreateForWebContents(web_contents); | 146 InfoBarService::CreateForWebContents(web_contents); |
| 147 NavigationCorrectionTabObserver::CreateForWebContents(web_contents); | 147 NavigationCorrectionTabObserver::CreateForWebContents(web_contents); |
| 148 NavigationMetricsRecorder::CreateForWebContents(web_contents); | 148 NavigationMetricsRecorder::CreateForWebContents(web_contents); |
| 149 PopupBlockerTabHelper::CreateForWebContents(web_contents); | 149 PopupBlockerTabHelper::CreateForWebContents(web_contents); |
| 150 PrefsTabHelper::CreateForWebContents(web_contents); | 150 PrefsTabHelper::CreateForWebContents(web_contents); |
| 151 prerender::PrerenderTabHelper::CreateForWebContentsWithPasswordManager( | 151 prerender::PrerenderTabHelper::CreateForWebContents(web_contents); |
| 152 web_contents, | |
| 153 ChromePasswordManagerClient::GetManagerFromWebContents(web_contents)); | |
| 154 SearchTabHelper::CreateForWebContents(web_contents); | 152 SearchTabHelper::CreateForWebContents(web_contents); |
| 155 // TODO(vabr): Remove TabSpecificContentSettings from here once their function | 153 // TODO(vabr): Remove TabSpecificContentSettings from here once their function |
| 156 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 | 154 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 |
| 157 TabSpecificContentSettings::CreateForWebContents(web_contents); | 155 TabSpecificContentSettings::CreateForWebContents(web_contents); |
| 158 ChromeContentSettingsClient::CreateForWebContents(web_contents); | 156 ChromeContentSettingsClient::CreateForWebContents(web_contents); |
| 159 ChromeTranslateClient::CreateForWebContents(web_contents); | 157 ChromeTranslateClient::CreateForWebContents(web_contents); |
| 160 | 158 |
| 161 // --- Platform-specific tab helpers --- | 159 // --- Platform-specific tab helpers --- |
| 162 | 160 |
| 163 #if defined(OS_ANDROID) | 161 #if defined(OS_ANDROID) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // If this is not an incognito window, setup to handle one-click login. | 221 // If this is not an incognito window, setup to handle one-click login. |
| 224 // We don't want to check that the profile is already connected at this time | 222 // We don't want to check that the profile is already connected at this time |
| 225 // because the connected state may change while this tab is open. Having a | 223 // because the connected state may change while this tab is open. Having a |
| 226 // one-click signin helper attached does not cause problems if the profile | 224 // one-click signin helper attached does not cause problems if the profile |
| 227 // happens to be already connected. | 225 // happens to be already connected. |
| 228 if (switches::IsEnableWebBasedSignin() && | 226 if (switches::IsEnableWebBasedSignin() && |
| 229 OneClickSigninHelper::CanOffer(web_contents, | 227 OneClickSigninHelper::CanOffer(web_contents, |
| 230 OneClickSigninHelper::CAN_OFFER_FOR_ALL, | 228 OneClickSigninHelper::CAN_OFFER_FOR_ALL, |
| 231 std::string(), | 229 std::string(), |
| 232 NULL)) { | 230 NULL)) { |
| 233 OneClickSigninHelper::CreateForWebContentsWithPasswordManager( | 231 OneClickSigninHelper::CreateForWebContents(web_contents); |
| 234 web_contents, | |
| 235 ChromePasswordManagerClient::GetManagerFromWebContents(web_contents)); | |
| 236 } | 232 } |
| 237 #endif | 233 #endif |
| 238 | 234 |
| 239 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( | 235 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( |
| 240 web_contents->GetBrowserContext())) { | 236 web_contents->GetBrowserContext())) { |
| 241 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( | 237 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( |
| 242 web_contents); | 238 web_contents); |
| 243 } | 239 } |
| 244 } | 240 } |
| OLD | NEW |