| 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" |
| 11 #include "base/memory/ptr_util.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/content_settings/mixed_content_settings_tab_helper.h" | 15 #include "chrome/browser/content_settings/mixed_content_settings_tab_helper.h" |
| 15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 16 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 16 #include "chrome/browser/data_use_measurement/data_use_web_contents_observer.h" | 17 #include "chrome/browser/data_use_measurement/data_use_web_contents_observer.h" |
| 17 #include "chrome/browser/engagement/site_engagement_helper.h" | 18 #include "chrome/browser/engagement/site_engagement_helper.h" |
| 18 #include "chrome/browser/engagement/site_engagement_service.h" | 19 #include "chrome/browser/engagement/site_engagement_service.h" |
| 19 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 20 #include "chrome/browser/external_protocol/external_protocol_observer.h" |
| 20 #include "chrome/browser/favicon/favicon_utils.h" | 21 #include "chrome/browser/favicon/favicon_utils.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // static | 132 // static |
| 132 void TabHelpers::AttachTabHelpers(WebContents* web_contents) { | 133 void TabHelpers::AttachTabHelpers(WebContents* web_contents) { |
| 133 // If already adopted, nothing to be done. | 134 // If already adopted, nothing to be done. |
| 134 base::SupportsUserData::Data* adoption_tag = | 135 base::SupportsUserData::Data* adoption_tag = |
| 135 web_contents->GetUserData(&kTabContentsAttachedTabHelpersUserDataKey); | 136 web_contents->GetUserData(&kTabContentsAttachedTabHelpersUserDataKey); |
| 136 if (adoption_tag) | 137 if (adoption_tag) |
| 137 return; | 138 return; |
| 138 | 139 |
| 139 // Mark as adopted. | 140 // Mark as adopted. |
| 140 web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey, | 141 web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey, |
| 141 new base::SupportsUserData::Data()); | 142 base::MakeUnique<base::SupportsUserData::Data>()); |
| 142 | 143 |
| 143 #if BUILDFLAG(ENABLE_EXTENSIONS) | 144 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 144 // Set the view type. | 145 // Set the view type. |
| 145 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); | 146 extensions::SetViewType(web_contents, extensions::VIEW_TYPE_TAB_CONTENTS); |
| 146 #endif | 147 #endif |
| 147 | 148 |
| 148 // Create all the tab helpers. | 149 // Create all the tab helpers. |
| 149 | 150 |
| 150 // SessionTabHelper comes first because it sets up the tab ID, and other | 151 // SessionTabHelper comes first because it sets up the tab ID, and other |
| 151 // helpers may rely on that. | 152 // helpers may rely on that. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 295 |
| 295 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( | 296 if (predictors::ResourcePrefetchPredictorFactory::GetForProfile( |
| 296 web_contents->GetBrowserContext())) { | 297 web_contents->GetBrowserContext())) { |
| 297 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( | 298 predictors::ResourcePrefetchPredictorTabHelper::CreateForWebContents( |
| 298 web_contents); | 299 web_contents); |
| 299 } | 300 } |
| 300 | 301 |
| 301 if (tracing::NavigationTracingObserver::IsEnabled()) | 302 if (tracing::NavigationTracingObserver::IsEnabled()) |
| 302 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); | 303 tracing::NavigationTracingObserver::CreateForWebContents(web_contents); |
| 303 } | 304 } |
| OLD | NEW |