| 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_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 |
| 23 // window, and thus is owned by a Browser's TabStripModel. The | 25 // (or the equivalent on Android). The TabHelpers class allows specific classes |
| 24 // BrowserTabContents class allows specific classes to attach the set of tab | 26 // to attach the set of tab helpers that is used for tab contents. |
| 25 // helpers that is used for tab contents. | |
| 26 // | 27 // |
| 27 // TODO(avi): This list is rather large, and for most callers it's due to the | 28 // 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 // 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 // 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 // Is there a better way to handle this? (Ideally, this list would contain |
| 31 // only Browser and BrowserTabStripModelDelegate.) | 32 // only Browser and BrowserTabStripModelDelegate.) |
| 32 class BrowserTabContents { | 33 class TabHelpers { |
| 33 private: | 34 private: |
| 34 // Browser and its TabStripModelDelegate have intimate control of tabs. | 35 // Browser and its TabStripModelDelegate have intimate control of tabs. |
| 35 // TabAndroid is the equivalent on Android. | 36 // TabAndroid is the equivalent on Android. |
| 36 friend class Browser; | 37 friend class Browser; |
| 37 friend class chrome::BrowserTabStripModelDelegate; | 38 friend class chrome::BrowserTabStripModelDelegate; |
| 39 |
| 40 // These are the Android equivalents of the two classes above. |
| 38 friend class TabAndroid; | 41 friend class TabAndroid; |
| 42 friend class chrome::android::ChromeWebContentsDelegateAndroid; |
| 39 | 43 |
| 40 // chrome::Navigate creates WebContents that are destined for the tab strip, | 44 // chrome::Navigate creates WebContents that are destined for the tab strip, |
| 41 // and that might have WebUI that immediately calls back into random tab | 45 // and that might have WebUI that immediately calls back into random tab |
| 42 // helpers. | 46 // helpers. |
| 43 friend class BrowserNavigatorWebContentsAdoption; | 47 friend class BrowserNavigatorWebContentsAdoption; |
| 44 | 48 |
| 45 // Prerendering loads pages that have arbitrary external content; it needs | 49 // Prerendering loads pages that have arbitrary external content; it needs |
| 46 // the full set of tab helpers to deal with it. | 50 // the full set of tab helpers to deal with it. |
| 47 friend class prerender::PrerenderContents; | 51 friend class prerender::PrerenderContents; |
| 48 | 52 |
| 49 // Adopts the specified WebContents as a full-fledged browser tab, attaching | 53 // Adopts the specified WebContents as a full-fledged browser tab, attaching |
| 50 // all the associated tab helpers that are needed for the WebContents to | 54 // 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 | 55 // serve in that role. It is safe to call this on a WebContents that was |
| 52 // already adopted. | 56 // already adopted. |
| 53 static void AttachTabHelpers(content::WebContents* web_contents); | 57 static void AttachTabHelpers(content::WebContents* web_contents); |
| 54 }; | 58 }; |
| 55 | 59 |
| 56 #endif // CHROME_BROWSER_UI_BROWSER_TAB_CONTENTS_H_ | 60 #endif // CHROME_BROWSER_UI_TAB_HELPERS_H_ |
| OLD | NEW |