Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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_COCOA_TAB_CONTENTS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <Cocoa/Cocoa.h> | 9 #include <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 #include "base/scoped_ptr.h" | |
| 12 | |
| 11 class TabContents; | 13 class TabContents; |
| 14 class TabContentsNotificationBridge; | |
| 15 @class TabContentsViewController; | |
| 12 | 16 |
| 13 // A class that controls the web contents of a tab. It manages displaying the | 17 // The interface for the tab contents view controller's delegate. |
| 18 | |
| 19 @protocol TabContentsViewControllerDelegate | |
| 20 | |
| 21 // Tells the delegate when the tab contents view's frame is about to change. | |
| 22 - (void)tabContentsViewFrameWillChange:(TabContentsViewController*)source | |
| 23 frameRect:(NSRect)frameRect; | |
| 24 | |
| 25 @end | |
| 26 | |
| 27 // A class that controls the TabContents view. It manages displaying the | |
| 14 // native view for a given TabContents. | 28 // native view for a given TabContents. |
| 15 // Note that just creating the class does not display the view. We defer | 29 // Note that just creating the class does not display the view. We defer |
| 16 // inserting it until the box is the correct size to avoid multiple resize | 30 // inserting it until the box is the correct size to avoid multiple resize |
| 17 // messages to the renderer. You must call |-ensureContentsVisible| to display | 31 // messages to the renderer. You must call |-ensureContentsVisible| to display |
| 18 // the render widget host view. | 32 // the render widget host view. |
| 19 | 33 |
| 20 @interface TabContentsController : NSViewController { | 34 @interface TabContentsViewController : NSViewController { |
|
rohitrao (ping after 24h)
2010/11/04 23:13:48
Why did you rename this class? We generally don't
Aleksey Shlyapnikov
2010/11/05 00:45:11
There's a class named TabContentsController and it
rohitrao (ping after 24h)
2010/11/12 18:45:19
Do you think there's value in splitting off a base
Aleksey Shlyapnikov
2010/11/13 01:37:11
There's some logic in TabContentsController which
| |
| 21 @private | 35 @private |
| 22 TabContents* contents_; // weak | 36 TabContents* contents_; // weak |
| 37 // Delegate to be notified about size changes. | |
| 38 id<TabContentsViewControllerDelegate> delegate_; // weak | |
| 39 scoped_ptr<TabContentsNotificationBridge> tabContentsBridge_; | |
| 23 } | 40 } |
| 24 @property(readonly, nonatomic) TabContents* tabContents; | 41 @property(readonly, nonatomic) TabContents* tabContents; |
| 25 | 42 |
| 26 // Create the contents of a tab represented by |contents|. | 43 - (id)initWithContents:(TabContents*)contents |
| 27 - (id)initWithContents:(TabContents*)contents; | 44 delegate:(id<TabContentsViewControllerDelegate>)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 @end | |
| 60 | |
| 61 // A class that controls the web contents of a tab. | |
| 62 | |
| 63 @interface TabContentsController : TabContentsViewController { | |
| 64 } | |
| 28 | 65 |
| 29 // Called when the tab contents is the currently selected tab and is about to be | 66 // Called when the tab contents is the currently selected tab and is about to be |
| 30 // removed from the view hierarchy. | 67 // removed from the view hierarchy. |
| 31 - (void)willBecomeUnselectedTab; | 68 - (void)willBecomeUnselectedTab; |
| 32 | 69 |
| 33 // Called when the tab contents is about to be put into the view hierarchy as | 70 // Called when the tab contents is about to be put into the view hierarchy as |
| 34 // the selected tab. Handles things such as ensuring the toolbar is correctly | 71 // the selected tab. Handles things such as ensuring the toolbar is correctly |
| 35 // enabled. | 72 // enabled. |
| 36 - (void)willBecomeSelectedTab; | 73 - (void)willBecomeSelectedTab; |
| 37 | 74 |
| 38 // Call when the tab contents is about to be replaced with the currently | |
| 39 // selected tab contents to do not trigger unnecessary content relayout. | |
| 40 - (void)ensureContentsSizeDoesNotChange; | |
| 41 | |
| 42 // Call when the tab view is properly sized and the render widget host view | |
| 43 // should be put into the view hierarchy. | |
| 44 - (void)ensureContentsVisible; | |
| 45 | |
| 46 // Called when the tab contents is updated in some non-descript way (the | 75 // Called when the tab contents is updated in some non-descript way (the |
| 47 // notification from the model isn't specific). |updatedContents| could reflect | 76 // notification from the model isn't specific). |updatedContents| could reflect |
| 48 // an entirely new tab contents object. | 77 // an entirely new tab contents object. |
| 49 - (void)tabDidChange:(TabContents*)updatedContents; | 78 - (void)tabDidChange:(TabContents*)updatedContents; |
| 50 | 79 |
| 51 @end | 80 @end |
| 52 | 81 |
| 53 #endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ | 82 #endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ |
| OLD | NEW |