| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 using content::WebContents; | 131 using content::WebContents; |
| 132 | 132 |
| 133 namespace { | 133 namespace { |
| 134 | 134 |
| 135 const char kTabContentsAttachedTabHelpersUserDataKey[] = | 135 const char kTabContentsAttachedTabHelpersUserDataKey[] = |
| 136 "TabContentsAttachedTabHelpers"; | 136 "TabContentsAttachedTabHelpers"; |
| 137 | 137 |
| 138 } // namespace | 138 } // namespace |
| 139 | 139 |
| 140 // static | 140 // static |
| 141 void TabHelpers::AttachTabHelpers(WebContents* web_contents) { | 141 void TabHelpers::AttachTabHelpers( |
| 142 WebContents* web_contents, |
| 143 const base::Optional<WebContents::CreateParams>& create_params) { |
| 142 // If already adopted, nothing to be done. | 144 // If already adopted, nothing to be done. |
| 143 base::SupportsUserData::Data* adoption_tag = | 145 base::SupportsUserData::Data* adoption_tag = |
| 144 web_contents->GetUserData(&kTabContentsAttachedTabHelpersUserDataKey); | 146 web_contents->GetUserData(&kTabContentsAttachedTabHelpersUserDataKey); |
| 145 if (adoption_tag) | 147 if (adoption_tag) |
| 146 return; | 148 return; |
| 147 | 149 |
| 148 // Mark as adopted. | 150 // Mark as adopted. |
| 149 web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey, | 151 web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey, |
| 150 base::MakeUnique<base::SupportsUserData::Data>()); | 152 base::MakeUnique<base::SupportsUserData::Data>()); |
| 151 | 153 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 Profile::FromBrowserContext( | 197 Profile::FromBrowserContext( |
| 196 web_contents->GetBrowserContext())).get()); | 198 web_contents->GetBrowserContext())).get()); |
| 197 HistoryTabHelper::CreateForWebContents(web_contents); | 199 HistoryTabHelper::CreateForWebContents(web_contents); |
| 198 InfoBarService::CreateForWebContents(web_contents); | 200 InfoBarService::CreateForWebContents(web_contents); |
| 199 metrics::RendererUptimeWebContentsObserver::CreateForWebContents( | 201 metrics::RendererUptimeWebContentsObserver::CreateForWebContents( |
| 200 web_contents); | 202 web_contents); |
| 201 if (content::IsBrowserSideNavigationEnabled()) | 203 if (content::IsBrowserSideNavigationEnabled()) |
| 202 MixedContentSettingsTabHelper::CreateForWebContents(web_contents); | 204 MixedContentSettingsTabHelper::CreateForWebContents(web_contents); |
| 203 NavigationCorrectionTabObserver::CreateForWebContents(web_contents); | 205 NavigationCorrectionTabObserver::CreateForWebContents(web_contents); |
| 204 NavigationMetricsRecorder::CreateForWebContents(web_contents); | 206 NavigationMetricsRecorder::CreateForWebContents(web_contents); |
| 205 chrome::InitializePageLoadMetricsForWebContents(web_contents); | 207 chrome::InitializePageLoadMetricsForWebContents(web_contents, create_params); |
| 206 PermissionRequestManager::CreateForWebContents(web_contents); | 208 PermissionRequestManager::CreateForWebContents(web_contents); |
| 207 PopupBlockerTabHelper::CreateForWebContents(web_contents); | 209 PopupBlockerTabHelper::CreateForWebContents(web_contents); |
| 208 PrefsTabHelper::CreateForWebContents(web_contents); | 210 PrefsTabHelper::CreateForWebContents(web_contents); |
| 209 prerender::PrerenderTabHelper::CreateForWebContents(web_contents); | 211 prerender::PrerenderTabHelper::CreateForWebContents(web_contents); |
| 210 PreviewsInfoBarTabHelper::CreateForWebContents(web_contents); | 212 PreviewsInfoBarTabHelper::CreateForWebContents(web_contents); |
| 211 SearchTabHelper::CreateForWebContents(web_contents); | 213 SearchTabHelper::CreateForWebContents(web_contents); |
| 212 SearchEngineTabHelper::CreateForWebContents(web_contents); | 214 SearchEngineTabHelper::CreateForWebContents(web_contents); |
| 213 SecurityStateTabHelper::CreateForWebContents(web_contents); | 215 SecurityStateTabHelper::CreateForWebContents(web_contents); |
| 214 if (SiteEngagementService::IsEnabled()) | 216 if (SiteEngagementService::IsEnabled()) |
| 215 SiteEngagementService::Helper::CreateForWebContents(web_contents); | 217 SiteEngagementService::Helper::CreateForWebContents(web_contents); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 313 |
| 312 if (tracing::NavigationTracingObserver::IsEnabled()) | 314 if (tracing::NavigationTracingObserver::IsEnabled()) |
| 313 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); | 315 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); |
| 314 | 316 |
| 315 if (MediaEngagementService::IsEnabled()) | 317 if (MediaEngagementService::IsEnabled()) |
| 316 MediaEngagementService::CreateWebContentsObserver(web_contents); | 318 MediaEngagementService::CreateWebContentsObserver(web_contents); |
| 317 | 319 |
| 318 if (ResourceCoordinatorWebContentsObserver::IsEnabled()) | 320 if (ResourceCoordinatorWebContentsObserver::IsEnabled()) |
| 319 ResourceCoordinatorWebContentsObserver::CreateForWebContents(web_contents); | 321 ResourceCoordinatorWebContentsObserver::CreateForWebContents(web_contents); |
| 320 } | 322 } |
| OLD | NEW |