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_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
7 | 7 |
8 #include <Cocoa/Cocoa.h> | 8 #include <Cocoa/Cocoa.h> |
9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 |
| 12 class FullscreenObserver; |
| 13 |
10 namespace content { | 14 namespace content { |
11 class WebContents; | 15 class WebContents; |
12 } | 16 } |
13 | 17 |
14 // A class that controls the WebContents view. It manages displaying the | 18 // A class that controls the WebContents view. It manages displaying the |
15 // native view for a given WebContents. | 19 // native view for a given WebContents. |
16 // Note that just creating the class does not display the view. We defer | 20 // Note that just creating the class does not display the view. We defer |
17 // inserting it until the box is the correct size to avoid multiple resize | 21 // inserting it until the box is the correct size to avoid multiple resize |
18 // messages to the renderer. You must call |-ensureContentsVisible| to display | 22 // messages to the renderer. You must call |-ensureContentsVisible| to display |
19 // the render widget host view. | 23 // the render widget host view. |
20 | 24 |
21 @interface TabContentsController : NSViewController { | 25 @interface TabContentsController : NSViewController { |
22 @private | 26 @private |
23 content::WebContents* contents_; // weak | 27 content::WebContents* contents_; // weak |
| 28 scoped_ptr<FullscreenObserver> fullscreenObserver_; |
| 29 BOOL isEmbeddingFullscreenWidget_; |
24 } | 30 } |
25 @property(readonly, nonatomic) content::WebContents* webContents; | 31 @property(readonly, nonatomic) content::WebContents* webContents; |
26 | 32 |
27 // Create the contents of a tab represented by |contents|. | 33 // Create the contents of a tab represented by |contents|. When |
28 - (id)initWithContents:(content::WebContents*)contents; | 34 // |enableEmbeddedFullscreen| is true, the WebContents view will automatically |
| 35 // be swapped with a fullscreen render widget owned by the current WebContents. |
| 36 - (id)initWithContents:(content::WebContents*)contents |
| 37 andAutoEmbedFullscreen:(BOOL)enableEmbeddedFullscreen; |
29 | 38 |
30 // Call when the tab contents is about to be replaced with the currently | 39 // Call when the tab contents is about to be replaced with the currently |
31 // selected tab contents to do not trigger unnecessary content relayout. | 40 // selected tab contents to do not trigger unnecessary content relayout. |
32 - (void)ensureContentsSizeDoesNotChange; | 41 - (void)ensureContentsSizeDoesNotChange; |
33 | 42 |
34 // Call when the tab view is properly sized and the render widget host view | 43 // Call when the tab view is properly sized and the render widget host view |
35 // should be put into the view hierarchy. | 44 // should be put into the view hierarchy. |
36 - (void)ensureContentsVisible; | 45 - (void)ensureContentsVisible; |
37 | 46 |
38 // Call to change the underlying web contents object. View is not changed, | 47 // Call to change the underlying web contents object. View is not changed, |
39 // call |-ensureContentsVisible| to display the |newContents|'s render widget | 48 // call |-ensureContentsVisible| to display the |newContents|'s render widget |
40 // host view. | 49 // host view. |
41 - (void)changeWebContents:(content::WebContents*)newContents; | 50 - (void)changeWebContents:(content::WebContents*)newContents; |
42 | 51 |
43 // Called when the tab contents is the currently selected tab and is about to be | 52 // Called when the tab contents is the currently selected tab and is about to be |
44 // removed from the view hierarchy. | 53 // removed from the view hierarchy. |
45 - (void)willBecomeUnselectedTab; | 54 - (void)willBecomeUnselectedTab; |
46 | 55 |
47 // Called when the tab contents is about to be put into the view hierarchy as | 56 // Called when the tab contents is about to be put into the view hierarchy as |
48 // the selected tab. Handles things such as ensuring the toolbar is correctly | 57 // the selected tab. Handles things such as ensuring the toolbar is correctly |
49 // enabled. | 58 // enabled. |
50 - (void)willBecomeSelectedTab; | 59 - (void)willBecomeSelectedTab; |
51 | 60 |
52 // Called when the tab contents is updated in some non-descript way (the | 61 // Called when the tab contents is updated in some non-descript way (the |
53 // notification from the model isn't specific). |updatedContents| could reflect | 62 // notification from the model isn't specific). |updatedContents| could reflect |
54 // an entirely new tab contents object. | 63 // an entirely new tab contents object. |
55 - (void)tabDidChange:(content::WebContents*)updatedContents; | 64 - (void)tabDidChange:(content::WebContents*)updatedContents; |
56 | 65 |
| 66 // Called to switch the container's subview to the WebContents-owned fullscreen |
| 67 // widget or back to WebContentsView's widget. |
| 68 - (void)toggleFullscreenWidget:(BOOL)enterFullscreen; |
| 69 |
57 @end | 70 @end |
58 | 71 |
59 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ | 72 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
OLD | NEW |