0

Add documentation to disallow new tab helpers for desktop platforms.

The features should instead use TabFeatures.

Change-Id: I91d31dbf3030fbb40c42161f0e7d222816620cfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5491924
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1293968}
This commit is contained in:
Erik Chen
2024-04-29 21:14:22 +00:00
committed by Chromium LUCI CQ
parent 7495eee4c2
commit 50f7634b1a
3 changed files with 10 additions and 5 deletions

@ -308,6 +308,9 @@ const char kTabContentsAttachedTabHelpersUserDataKey[] =
} // namespace
// static
// WARNING: Do not use this class for desktop chrome. Use TabFeatures instead.
// See
// https://chromium.googlesource.com/chromium/src/+/main/docs/chrome_browser_design_principles.md
void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
// If already adopted, nothing to be done.
base::SupportsUserData::Data* adoption_tag =

@ -43,11 +43,10 @@ class ChromeNoStatePrefetchContentsDelegate;
//
// https://chromium.googlesource.com/chromium/src/+/main/docs/tab_helpers.md
//
// TODO(avi): This list is rather large, and for most callers it's due to the
// fact that they need tab helpers attached early to deal with arbitrary
// content loaded into a WebContents that will later be added to the tabstrip.
// Is there a better way to handle this? (Ideally, this list would contain
// only Browser and BrowserTabStripModelDelegate.)
// WARNING: Do not use this class for desktop chrome. Use TabFeatures instead.
// See
// https://chromium.googlesource.com/chromium/src/+/main/docs/chrome_browser_design_principles.md
class TabHelpers {
private:
#if BUILDFLAG(IS_ANDROID)

@ -4,6 +4,9 @@ The `content/` layer of Chromium has a class called `WebContents`, which is one
of the most basic building blocks of all of Chromium. This document describes
how `WebContents`es are used to build tabs in browser windows.
Tab Helpers are deprecated for Desktop Chrome. Use TabFeatures instead. See
[design principles](chrome_browser_design_principles.md).
[TOC]
## Introduction