[email protected] | af2b593d | 2014-01-29 11:39:56 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 5 | #include "chrome/browser/ui/tab_helpers.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 6 | |
| 7 | #include "base/command_line.h" |
[email protected] | 0b2f513b | 2013-04-05 20:13:23 | [diff] [blame] | 8 | #include "chrome/browser/browser_process.h" |
vabr | 6a586eb | 2014-10-14 15:06:38 | [diff] [blame] | 9 | #include "chrome/browser/content_settings/chrome_content_settings_client.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 10 | #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 11 | #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 12 | #include "chrome/browser/history/history_tab_helper.h" |
[email protected] | 4a8adfa0 | 2013-03-19 22:37:46 | [diff] [blame] | 13 | #include "chrome/browser/infobars/infobar_service.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 14 | #include "chrome/browser/net/net_error_tab_helper.h" |
[email protected] | 7d7e0b7 | 2014-02-10 18:36:05 | [diff] [blame] | 15 | #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
zhenw | 9f71822 | 2014-09-19 00:41:03 | [diff] [blame] | 16 | #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
| 17 | #include "chrome/browser/predictors/resource_prefetch_predictor_tab_helper.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 18 | #include "chrome/browser/prerender/prerender_tab_helper.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 19 | #include "chrome/browser/sessions/session_tab_helper.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 20 | #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" |
[email protected] | 255ab97 | 2014-06-04 12:14:22 | [diff] [blame] | 21 | #include "chrome/browser/translate/chrome_translate_client.h" |
[email protected] | b4db6d4 | 2014-06-07 04:36:58 | [diff] [blame] | 22 | #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
[email protected] | 9ac649e | 2013-07-17 16:48:36 | [diff] [blame] | 23 | #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 24 | #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 25 | #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
[email protected] | 26bd3893c | 2014-04-15 18:59:58 | [diff] [blame] | 26 | #include "chrome/browser/ui/navigation_correction_tab_observer.h" |
Sadrul Habib Chowdhury | 2f8807f | 2014-08-28 03:50:36 | [diff] [blame] | 27 | #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 28 | #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
[email protected] | 0443e08 | 2014-04-30 04:52:50 | [diff] [blame] | 29 | #include "chrome/browser/ui/search/search_tab_helper.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 30 | #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
andresantoso | 063151d | 2014-12-18 22:37:55 | [diff] [blame] | 31 | #include "chrome/browser/ui/tab_dialogs.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 32 | #include "chrome/common/chrome_switches.h" |
estade | b1bc9bd | 2014-12-02 22:44:11 | [diff] [blame] | 33 | #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 34 | #include "components/autofill/core/browser/autofill_manager.h" |
[email protected] | d289bd7 | 2014-05-28 01:24:12 | [diff] [blame] | 35 | #include "components/dom_distiller/content/web_contents_main_frame_observer.h" |
[email protected] | 1f730bd | 2014-02-28 15:11:32 | [diff] [blame] | 36 | #include "components/password_manager/core/browser/password_manager.h" |
guohui | 639bf9e | 2014-10-31 22:19:50 | [diff] [blame] | 37 | #include "components/signin/core/common/profile_management_switches.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 38 | #include "content/public/browser/web_contents.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 39 | |
| 40 | #if defined(OS_ANDROID) |
| 41 | #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| 42 | #include "chrome/browser/ui/android/context_menu_helper.h" |
| 43 | #include "chrome/browser/ui/android/window_android_helper.h" |
| 44 | #else |
[email protected] | 86fad30d | 2014-07-29 21:39:27 | [diff] [blame] | 45 | #include "chrome/browser/external_protocol/external_protocol_observer.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 46 | #include "chrome/browser/net/predictor_tab_helper.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 47 | #include "chrome/browser/plugins/plugin_observer.h" |
| 48 | #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
| 49 | #include "chrome/browser/thumbnails/thumbnail_tab_helper.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 50 | #include "chrome/browser/ui/hung_plugin_tab_helper.h" |
[email protected] | d27fd770 | 2014-05-07 07:42:30 | [diff] [blame] | 51 | #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 52 | #include "chrome/browser/ui/sad_tab_helper.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 53 | #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 54 | #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
[email protected] | dd1ba69 | 2014-01-24 23:17:37 | [diff] [blame] | 55 | #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
Sadrul Habib Chowdhury | 2f8807f | 2014-08-28 03:50:36 | [diff] [blame] | 56 | #include "components/pdf/browser/pdf_web_contents_helper.h" |
wjmaclean | 7f63c6b | 2014-12-09 14:59:55 | [diff] [blame] | 57 | #include "components/ui/zoom/zoom_controller.h" |
[email protected] | e41d008 | 2013-05-16 04:37:54 | [diff] [blame] | 58 | #include "components/web_modal/web_contents_modal_dialog_manager.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 59 | #endif // defined(OS_ANDROID) |
| 60 | |
| 61 | #if defined(OS_WIN) |
| 62 | #include "chrome/browser/ui/metro_pin_tab_helper_win.h" |
| 63 | #endif |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 64 | |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 65 | #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 66 | #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
| 67 | #endif |
| 68 | |
[email protected] | c7264f4 | 2014-06-22 21:23:09 | [diff] [blame] | 69 | #if defined(ENABLE_EXTENSIONS) |
[email protected] | ddef62e | 2014-07-12 06:18:57 | [diff] [blame] | 70 | #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 71 | #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
[email protected] | c7264f4 | 2014-06-22 21:23:09 | [diff] [blame] | 72 | #include "chrome/browser/extensions/tab_helper.h" |
[email protected] | ddef62e | 2014-07-12 06:18:57 | [diff] [blame] | 73 | #include "extensions/browser/view_type_utils.h" |
[email protected] | c7264f4 | 2014-06-22 21:23:09 | [diff] [blame] | 74 | #endif |
| 75 | |
treib | 87bb89cbb | 2014-12-01 16:01:47 | [diff] [blame] | 76 | #if defined(ENABLE_SUPERVISED_USERS) |
[email protected] | cce15bb | 2014-06-17 13:43:51 | [diff] [blame] | 77 | #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 78 | #endif |
| 79 | |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 80 | #if defined(ENABLE_PRINTING) |
vitalybuka | e29991c | 2014-11-05 21:15:12 | [diff] [blame] | 81 | #if defined(ENABLE_PRINT_PREVIEW) |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 82 | #include "chrome/browser/printing/print_preview_message_handler.h" |
| 83 | #include "chrome/browser/printing/print_view_manager.h" |
[email protected] | 1e54c1c | 2013-08-12 17:16:05 | [diff] [blame] | 84 | #else |
| 85 | #include "chrome/browser/printing/print_view_manager_basic.h" |
vitalybuka | e29991c | 2014-11-05 21:15:12 | [diff] [blame] | 86 | #endif // defined(ENABLE_PRINT_PREVIEW) |
[email protected] | 1e54c1c | 2013-08-12 17:16:05 | [diff] [blame] | 87 | #endif // defined(ENABLE_PRINTING) |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 88 | |
| 89 | #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 90 | #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 91 | #endif |
| 92 | |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 93 | using content::WebContents; |
| 94 | |
| 95 | namespace { |
| 96 | |
| 97 | const char kTabContentsAttachedTabHelpersUserDataKey[] = |
| 98 | "TabContentsAttachedTabHelpers"; |
| 99 | |
| 100 | } // namespace |
| 101 | |
| 102 | // static |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 103 | void TabHelpers::AttachTabHelpers(WebContents* web_contents) { |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 104 | // If already adopted, nothing to be done. |
| 105 | base::SupportsUserData::Data* adoption_tag = |
| 106 | web_contents->GetUserData(&kTabContentsAttachedTabHelpersUserDataKey); |
| 107 | if (adoption_tag) |
| 108 | return; |
| 109 | |
| 110 | // Mark as adopted. |
| 111 | web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey, |
| 112 | new base::SupportsUserData::Data()); |
| 113 | |
[email protected] | ddef62e | 2014-07-12 06:18:57 | [diff] [blame] | 114 | #if defined(ENABLE_EXTENSIONS) |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 115 | // Set the view type. |
[email protected] | cb2edf2 | 2013-04-01 20:25:23 | [diff] [blame] | 116 | extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); |
[email protected] | ddef62e | 2014-07-12 06:18:57 | [diff] [blame] | 117 | #endif |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 118 | |
| 119 | // Create all the tab helpers. |
| 120 | |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 121 | // SessionTabHelper comes first because it sets up the tab ID, and other |
| 122 | // helpers may rely on that. |
| 123 | SessionTabHelper::CreateForWebContents(web_contents); |
[email protected] | 76a5450 | 2014-07-10 22:59:34 | [diff] [blame] | 124 | #if !defined(OS_ANDROID) |
| 125 | // ZoomController comes before common tab helpers since ChromeAutofillClient |
| 126 | // may want to register as a ZoomObserver with it. |
wjmaclean | 7f63c6b | 2014-12-09 14:59:55 | [diff] [blame] | 127 | ui_zoom::ZoomController::CreateForWebContents(web_contents); |
[email protected] | 76a5450 | 2014-07-10 22:59:34 | [diff] [blame] | 128 | #endif |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 129 | |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 130 | // --- Common tab helpers --- |
| 131 | |
[email protected] | b4db6d4 | 2014-06-07 04:36:58 | [diff] [blame] | 132 | autofill::ChromeAutofillClient::CreateForWebContents(web_contents); |
estade | b1bc9bd | 2014-12-02 22:44:11 | [diff] [blame] | 133 | autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( |
[email protected] | bfb4d6721 | 2013-02-14 20:32:29 | [diff] [blame] | 134 | web_contents, |
[email protected] | b4db6d4 | 2014-06-07 04:36:58 | [diff] [blame] | 135 | autofill::ChromeAutofillClient::FromWebContents(web_contents), |
[email protected] | ae1741ecf | 2013-05-10 19:06:49 | [diff] [blame] | 136 | g_browser_process->GetApplicationLocale(), |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 137 | autofill::AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 138 | BookmarkTabHelper::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 139 | chrome_browser_net::NetErrorTabHelper::CreateForWebContents(web_contents); |
[email protected] | b4db6d4 | 2014-06-07 04:36:58 | [diff] [blame] | 140 | ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( |
[email protected] | c281d50 | 2014-04-24 21:07:36 | [diff] [blame] | 141 | web_contents, |
[email protected] | b4db6d4 | 2014-06-07 04:36:58 | [diff] [blame] | 142 | autofill::ChromeAutofillClient::FromWebContents(web_contents)); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 143 | CoreTabHelper::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 144 | FaviconTabHelper::CreateForWebContents(web_contents); |
| 145 | FindTabHelper::CreateForWebContents(web_contents); |
| 146 | HistoryTabHelper::CreateForWebContents(web_contents); |
[email protected] | 4f822f02 | 2012-12-20 19:11:42 | [diff] [blame] | 147 | InfoBarService::CreateForWebContents(web_contents); |
[email protected] | 26bd3893c | 2014-04-15 18:59:58 | [diff] [blame] | 148 | NavigationCorrectionTabObserver::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 149 | NavigationMetricsRecorder::CreateForWebContents(web_contents); |
[email protected] | 992e291 | 2013-08-19 15:05:24 | [diff] [blame] | 150 | PopupBlockerTabHelper::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 151 | PrefsTabHelper::CreateForWebContents(web_contents); |
estade | b1bc9bd | 2014-12-02 22:44:11 | [diff] [blame] | 152 | prerender::PrerenderTabHelper::CreateForWebContents(web_contents); |
[email protected] | 0443e08 | 2014-04-30 04:52:50 | [diff] [blame] | 153 | SearchTabHelper::CreateForWebContents(web_contents); |
vabr | 6a586eb | 2014-10-14 15:06:38 | [diff] [blame] | 154 | // TODO(vabr): Remove TabSpecificContentSettings from here once their function |
| 155 | // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 156 | TabSpecificContentSettings::CreateForWebContents(web_contents); |
vabr | 6a586eb | 2014-10-14 15:06:38 | [diff] [blame] | 157 | ChromeContentSettingsClient::CreateForWebContents(web_contents); |
[email protected] | 255ab97 | 2014-06-04 12:14:22 | [diff] [blame] | 158 | ChromeTranslateClient::CreateForWebContents(web_contents); |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 159 | |
| 160 | // --- Platform-specific tab helpers --- |
| 161 | |
| 162 | #if defined(OS_ANDROID) |
| 163 | ContextMenuHelper::CreateForWebContents(web_contents); |
| 164 | SingleTabModeTabHelper::CreateForWebContents(web_contents); |
| 165 | WindowAndroidHelper::CreateForWebContents(web_contents); |
| 166 | #else |
| 167 | chrome_browser_net::PredictorTabHelper::CreateForWebContents(web_contents); |
[email protected] | 1ce1597 | 2014-03-20 19:25:48 | [diff] [blame] | 168 | extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( |
| 169 | web_contents); |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 170 | extensions::WebNavigationTabObserver::CreateForWebContents(web_contents); |
[email protected] | 86fad30d | 2014-07-29 21:39:27 | [diff] [blame] | 171 | ExternalProtocolObserver::CreateForWebContents(web_contents); |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 172 | HungPluginTabHelper::CreateForWebContents(web_contents); |
[email protected] | d27fd770 | 2014-05-07 07:42:30 | [diff] [blame] | 173 | ManagePasswordsUIController::CreateForWebContents(web_contents); |
Sadrul Habib Chowdhury | 2f8807f | 2014-08-28 03:50:36 | [diff] [blame] | 174 | pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( |
| 175 | web_contents, |
| 176 | scoped_ptr<pdf::PDFWebContentsHelperClient>( |
| 177 | new ChromePDFWebContentsHelperClient())); |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 178 | PermissionBubbleManager::CreateForWebContents(web_contents); |
| 179 | PluginObserver::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 180 | SadTabHelper::CreateForWebContents(web_contents); |
| 181 | safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(web_contents); |
| 182 | SearchEngineTabHelper::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 183 | TabContentsSyncedTabDelegate::CreateForWebContents(web_contents); |
andresantoso | 063151d | 2014-12-18 22:37:55 | [diff] [blame] | 184 | TabDialogs::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 185 | ThumbnailTabHelper::CreateForWebContents(web_contents); |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 186 | web_modal::WebContentsModalDialogManager::CreateForWebContents(web_contents); |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 187 | #endif |
| 188 | |
| 189 | #if defined(OS_WIN) |
| 190 | MetroPinTabHelper::CreateForWebContents(web_contents); |
| 191 | #endif |
| 192 | |
| 193 | // --- Feature tab helpers behind flags --- |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 194 | |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 195 | #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
[email protected] | b1a160d | 2014-04-29 18:05:44 | [diff] [blame] | 196 | CaptivePortalTabHelper::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 197 | #endif |
| 198 | |
[email protected] | c7264f4 | 2014-06-22 21:23:09 | [diff] [blame] | 199 | #if defined(ENABLE_EXTENSIONS) |
| 200 | extensions::TabHelper::CreateForWebContents(web_contents); |
| 201 | #endif |
| 202 | |
treib | 87bb89cbb | 2014-12-01 16:01:47 | [diff] [blame] | 203 | #if defined(ENABLE_SUPERVISED_USERS) |
[email protected] | cce15bb | 2014-06-17 13:43:51 | [diff] [blame] | 204 | SupervisedUserNavigationObserver::CreateForWebContents(web_contents); |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 205 | #endif |
[email protected] | dd0aa013 | 2013-04-11 14:52:32 | [diff] [blame] | 206 | |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 207 | #if defined(ENABLE_PRINTING) && !defined(OS_ANDROID) |
vitalybuka | e29991c | 2014-11-05 21:15:12 | [diff] [blame] | 208 | #if defined(ENABLE_PRINT_PREVIEW) |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 209 | printing::PrintViewManager::CreateForWebContents(web_contents); |
[email protected] | 1e54c1c | 2013-08-12 17:16:05 | [diff] [blame] | 210 | printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents); |
| 211 | #else |
| 212 | printing::PrintViewManagerBasic::CreateForWebContents(web_contents); |
vitalybuka | e29991c | 2014-11-05 21:15:12 | [diff] [blame] | 213 | #endif // defined(ENABLE_PRINT_PREVIEW) |
[email protected] | e0bc75d5 | 2014-01-30 23:42:59 | [diff] [blame] | 214 | #endif // defined(ENABLE_PRINTING) && !defined(OS_ANDROID) |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 215 | |
avi | 556c0502 | 2014-12-22 23:31:43 | [diff] [blame^] | 216 | if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
[email protected] | d289bd7 | 2014-05-28 01:24:12 | [diff] [blame] | 217 | switches::kEnableDomDistiller)) { |
| 218 | dom_distiller::WebContentsMainFrameObserver::CreateForWebContents( |
| 219 | web_contents); |
| 220 | } |
| 221 | |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 222 | #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 223 | // 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 |
| 225 | // 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 |
| 227 | // happens to be already connected. |
guohui | 639bf9e | 2014-10-31 22:19:50 | [diff] [blame] | 228 | if (switches::IsEnableWebBasedSignin() && |
| 229 | OneClickSigninHelper::CanOffer(web_contents, |
[email protected] | 007b3f8 | 2013-04-09 08:46:45 | [diff] [blame] | 230 | OneClickSigninHelper::CAN_OFFER_FOR_ALL, |
| 231 | std::string(), |
| 232 | NULL)) { |
estade | b1bc9bd | 2014-12-02 22:44:11 | [diff] [blame] | 233 | OneClickSigninHelper::CreateForWebContents(web_contents); |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 234 | } |
| 235 | #endif |
zhenw | 9f71822 | 2014-09-19 00:41:03 | [diff] [blame] | 236 | |
| 237 | if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( |
| 238 | web_contents->GetBrowserContext())) { |
| 239 | predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( |
| 240 | web_contents); |
| 241 | } |
[email protected] | 27e5b391 | 2012-12-16 00:45:37 | [diff] [blame] | 242 | } |