| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CONTROLLER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <Cocoa/Cocoa.h> | |
| 10 | |
| 11 #include "base/scoped_ptr.h" | |
| 12 | |
| 13 class TabContents; | |
| 14 class TabContentsNotificationBridge; | |
| 15 @class TabContentsController; | |
| 16 | |
| 17 // The interface for the tab contents view controller's delegate. | |
| 18 | |
| 19 @protocol TabContentsControllerDelegate | |
| 20 | |
| 21 // Tells the delegate when the tab contents view's frame is about to change. | |
| 22 - (void)tabContentsViewFrameWillChange:(TabContentsController*)source | |
| 23 frameRect:(NSRect)frameRect; | |
| 24 | |
| 25 @end | |
| 26 | |
| 27 // A class that controls the TabContents view. It manages displaying the | |
| 28 // native view for a given TabContents. | |
| 29 // Note that just creating the class does not display the view. We defer | |
| 30 // inserting it until the box is the correct size to avoid multiple resize | |
| 31 // messages to the renderer. You must call |-ensureContentsVisible| to display | |
| 32 // the render widget host view. | |
| 33 | |
| 34 @interface TabContentsController : NSViewController { | |
| 35 @private | |
| 36 TabContents* contents_; // weak | |
| 37 // Delegate to be notified about size changes. | |
| 38 id<TabContentsControllerDelegate> delegate_; // weak | |
| 39 scoped_ptr<TabContentsNotificationBridge> tabContentsBridge_; | |
| 40 } | |
| 41 @property(readonly, nonatomic) TabContents* tabContents; | |
| 42 | |
| 43 - (id)initWithContents:(TabContents*)contents | |
| 44 delegate:(id<TabContentsControllerDelegate>)delegate; | |
| 45 | |
| 46 // Call when the tab contents is about to be replaced with the currently | |
| 47 // selected tab contents to do not trigger unnecessary content relayout. | |
| 48 - (void)ensureContentsSizeDoesNotChange; | |
| 49 | |
| 50 // Call when the tab view is properly sized and the render widget host view | |
| 51 // should be put into the view hierarchy. | |
| 52 - (void)ensureContentsVisible; | |
| 53 | |
| 54 // Call to change the underlying tab contents object. View is not changed, | |
| 55 // call |-ensureContentsVisible| to display the |newContents|'s render widget | |
| 56 // host view. | |
| 57 - (void)changeTabContents:(TabContents*)newContents; | |
| 58 | |
| 59 // Called when the tab contents is the currently selected tab and is about to be | |
| 60 // removed from the view hierarchy. | |
| 61 - (void)willBecomeUnselectedTab; | |
| 62 | |
| 63 // Called when the tab contents is about to be put into the view hierarchy as | |
| 64 // the selected tab. Handles things such as ensuring the toolbar is correctly | |
| 65 // enabled. | |
| 66 - (void)willBecomeSelectedTab; | |
| 67 | |
| 68 // Called when the tab contents is updated in some non-descript way (the | |
| 69 // notification from the model isn't specific). |updatedContents| could reflect | |
| 70 // an entirely new tab contents object. | |
| 71 - (void)tabDidChange:(TabContents*)updatedContents; | |
| 72 | |
| 73 @end | |
| 74 | |
| 75 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CONTROLLER_H_ | |
| OLD | NEW |