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 TabContentsController; |
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 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 |
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 TabContentsController : NSViewController { |
21 @private | 35 @private |
22 TabContents* contents_; // weak | 36 TabContents* contents_; // weak |
| 37 // Delegate to be notified about size changes. |
| 38 id<TabContentsControllerDelegate> 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<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; |
28 | 58 |
29 // Called when the tab contents is the currently selected tab and is about to be | 59 // Called when the tab contents is the currently selected tab and is about to be |
30 // removed from the view hierarchy. | 60 // removed from the view hierarchy. |
31 - (void)willBecomeUnselectedTab; | 61 - (void)willBecomeUnselectedTab; |
32 | 62 |
33 // Called when the tab contents is about to be put into the view hierarchy as | 63 // 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 | 64 // the selected tab. Handles things such as ensuring the toolbar is correctly |
35 // enabled. | 65 // enabled. |
36 - (void)willBecomeSelectedTab; | 66 - (void)willBecomeSelectedTab; |
37 | 67 |
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 | 68 // Called when the tab contents is updated in some non-descript way (the |
47 // notification from the model isn't specific). |updatedContents| could reflect | 69 // notification from the model isn't specific). |updatedContents| could reflect |
48 // an entirely new tab contents object. | 70 // an entirely new tab contents object. |
49 - (void)tabDidChange:(TabContents*)updatedContents; | 71 - (void)tabDidChange:(TabContents*)updatedContents; |
50 | 72 |
51 @end | 73 @end |
52 | 74 |
53 #endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ | 75 #endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ |
OLD | NEW |