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