Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / browser_tab_contents.h
1 // Copyright (c) 2012 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.
4
5 #ifndef CHROME_BROWSER_UI_BROWSER_TAB_CONTENTS_H_
6 #define CHROME_BROWSER_UI_BROWSER_TAB_CONTENTS_H_
7
8 class Browser;
9
10 namespace content {
11 class WebContents;
12 }
13
14 namespace chrome {
15 class BrowserTabStripModelDelegate;
16 }
17
18 namespace prerender {
19 class PrerenderContents;
20 }
21
22 // A "tab contents" is a WebContents that is used as a tab in a browser
23 // window, and thus is owned by a Browser's TabStripModel. The
24 // BrowserTabContents class allows specific classes to attach the set of tab
25 // helpers that is used for tab contents.
26 //
27 // TODO(avi): This list is rather large, and for most callers it's due to the
28 // fact that they need tab helpers attached early to deal with arbitrary
29 // content loaded into a WebContents that will later be added to the tabstrip.
30 // Is there a better way to handle this? (Ideally, this list would contain
31 // only Browser and BrowserTabStripModelDelegate.)
32 class BrowserTabContents {
33  private:
34   // Browser and its TabStripModelDelegate have intimate control of tabs.
35   // TabAndroid is the equivalent on Android.
36   friend class Browser;
37   friend class chrome::BrowserTabStripModelDelegate;
38   friend class TabAndroid;
39
40   // chrome::Navigate creates WebContents that are destined for the tab strip,
41   // and that might have WebUI that immediately calls back into random tab
42   // helpers.
43   friend class BrowserNavigatorWebContentsAdoption;
44
45   // Prerendering loads pages that have arbitrary external content; it needs
46   // the full set of tab helpers to deal with it.
47   friend class prerender::PrerenderContents;
48
49   // Adopts the specified WebContents as a full-fledged browser tab, attaching
50   // all the associated tab helpers that are needed for the WebContents to
51   // serve in that role. It is safe to call this on a WebContents that was
52   // already adopted.
53   static void AttachTabHelpers(content::WebContents* web_contents);
54 };
55
56 #endif  // CHROME_BROWSER_UI_BROWSER_TAB_CONTENTS_H_