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