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