- add sources.
[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   // ChromeFrame is defined as a complete tab of Chrome inside of an IE
46   // window, so it need to have the full complement of tab helpers that it
47   // would have if it were in a Browser.
48   // TODO(avi): It's still probably a good idea for Chrome Frame to more
49   // explicitly control which tab helpers get created for its WebContentses.
50   // http://crbug.com/157590
51   friend class ExternalTabContainerWin;
52
53   // Prerendering loads pages that have arbitrary external content; it needs
54   // the full set of tab helpers to deal with it.
55   friend class prerender::PrerenderContents;
56
57   // Adopts the specified WebContents as a full-fledged browser tab, attaching
58   // all the associated tab helpers that are needed for the WebContents to
59   // serve in that role. It is safe to call this on a WebContents that was
60   // already adopted.
61   static void AttachTabHelpers(content::WebContents* web_contents);
62 };
63
64 #endif  // CHROME_BROWSER_UI_BROWSER_TAB_CONTENTS_H_