| 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 // When |fullscreenObserver_| not-NULL, TabContentsController monitors for |
| 29 // and auto-embeds fullscreen widgets as a subview. |
| 30 scoped_ptr<FullscreenObserver> fullscreenObserver_; |
| 31 // Set to true while TabContentsController is embedding a fullscreen widget |
| 32 // view as a subview instead of the normal WebContentsView render view. |
| 33 BOOL isEmbeddingFullscreenWidget_; |
| 24 } | 34 } |
| 25 @property(readonly, nonatomic) content::WebContents* webContents; | 35 @property(readonly, nonatomic) content::WebContents* webContents; |
| 26 | 36 |
| 27 // Create the contents of a tab represented by |contents|. | 37 // Create the contents of a tab represented by |contents|. When |
| 28 - (id)initWithContents:(content::WebContents*)contents; | 38 // |enableEmbeddedFullscreen| is true, the WebContents view will automatically |
| 39 // be swapped with a fullscreen render widget owned by the current WebContents. |
| 40 - (id)initWithContents:(content::WebContents*)contents |
| 41 andAutoEmbedFullscreen:(BOOL)enableEmbeddedFullscreen; |
| 29 | 42 |
| 30 // Call when the tab contents is about to be replaced with the currently | 43 // Call when the tab contents is about to be replaced with the currently |
| 31 // selected tab contents to do not trigger unnecessary content relayout. | 44 // selected tab contents to do not trigger unnecessary content relayout. |
| 32 - (void)ensureContentsSizeDoesNotChange; | 45 - (void)ensureContentsSizeDoesNotChange; |
| 33 | 46 |
| 34 // Call when the tab view is properly sized and the render widget host view | 47 // Call when the tab view is properly sized and the render widget host view |
| 35 // should be put into the view hierarchy. | 48 // should be put into the view hierarchy. |
| 36 - (void)ensureContentsVisible; | 49 - (void)ensureContentsVisible; |
| 37 | 50 |
| 38 // Call to change the underlying web contents object. View is not changed, | 51 // Call to change the underlying web contents object. View is not changed, |
| 39 // call |-ensureContentsVisible| to display the |newContents|'s render widget | 52 // call |-ensureContentsVisible| to display the |newContents|'s render widget |
| 40 // host view. | 53 // host view. |
| 41 - (void)changeWebContents:(content::WebContents*)newContents; | 54 - (void)changeWebContents:(content::WebContents*)newContents; |
| 42 | 55 |
| 43 // Called when the tab contents is the currently selected tab and is about to be | 56 // Called when the tab contents is the currently selected tab and is about to be |
| 44 // removed from the view hierarchy. | 57 // removed from the view hierarchy. |
| 45 - (void)willBecomeUnselectedTab; | 58 - (void)willBecomeUnselectedTab; |
| 46 | 59 |
| 47 // Called when the tab contents is about to be put into the view hierarchy as | 60 // 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 | 61 // the selected tab. Handles things such as ensuring the toolbar is correctly |
| 49 // enabled. | 62 // enabled. |
| 50 - (void)willBecomeSelectedTab; | 63 - (void)willBecomeSelectedTab; |
| 51 | 64 |
| 52 // Called when the tab contents is updated in some non-descript way (the | 65 // Called when the tab contents is updated in some non-descript way (the |
| 53 // notification from the model isn't specific). |updatedContents| could reflect | 66 // notification from the model isn't specific). |updatedContents| could reflect |
| 54 // an entirely new tab contents object. | 67 // an entirely new tab contents object. |
| 55 - (void)tabDidChange:(content::WebContents*)updatedContents; | 68 - (void)tabDidChange:(content::WebContents*)updatedContents; |
| 56 | 69 |
| 70 // Called to switch the container's subview to the WebContents-owned fullscreen |
| 71 // widget or back to WebContentsView's widget. |
| 72 - (void)toggleFullscreenWidget:(BOOL)enterFullscreen; |
| 73 |
| 57 @end | 74 @end |
| 58 | 75 |
| 59 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ | 76 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_TAB_CONTENTS_CONTROLLER_H_ |
| OLD | NEW |