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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_TAB_HELPERS_H_
6 #define CHROME_BROWSER_UI_TAB_HELPERS_H_
13 class BrowserTabStripModelDelegate
;
16 class ChromeWebContentsDelegateAndroid
;
21 class PrerenderContents
;
24 // A "tab contents" is a WebContents that is used as a tab in a browser window
25 // (or the equivalent on Android). The TabHelpers class allows specific classes
26 // to attach the set of tab helpers that is used for tab contents.
28 // https://chromium.googlesource.com/chromium/src/+/master/docs/tab_helpers.md
30 // TODO(avi): This list is rather large, and for most callers it's due to the
31 // fact that they need tab helpers attached early to deal with arbitrary
32 // content loaded into a WebContents that will later be added to the tabstrip.
33 // Is there a better way to handle this? (Ideally, this list would contain
34 // only Browser and BrowserTabStripModelDelegate.)
37 // Browser and its TabStripModelDelegate have intimate control of tabs.
38 // TabAndroid is the equivalent on Android.
40 friend class chrome::BrowserTabStripModelDelegate
;
42 // These are the Android equivalents of the two classes above.
43 friend class TabAndroid
;
44 friend class chrome::android::ChromeWebContentsDelegateAndroid
;
46 // chrome::Navigate creates WebContents that are destined for the tab strip,
47 // and that might have WebUI that immediately calls back into random tab
49 friend class BrowserNavigatorWebContentsAdoption
;
51 // Prerendering loads pages that have arbitrary external content; it needs
52 // the full set of tab helpers to deal with it.
53 friend class prerender::PrerenderContents
;
55 // FYI: Do NOT add any more friends here. The functions above are the ONLY
56 // ones that need to call AttachTabHelpers; if you think you do, re-read the
57 // design document linked above, especially the section "Reusing tab helpers".
59 // Adopts the specified WebContents as a full-fledged browser tab, attaching
60 // all the associated tab helpers that are needed for the WebContents to
61 // serve in that role. It is safe to call this on a WebContents that was
63 static void AttachTabHelpers(content::WebContents
* web_contents
);
66 #endif // CHROME_BROWSER_UI_TAB_HELPERS_H_