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 | 7 |
8 #include <Cocoa/Cocoa.h> | 8 #include <Cocoa/Cocoa.h> |
9 | 9 |
10 class TabContents; | 10 class TabContents; |
11 class TabContentsCommandObserver; | 11 class TabContentsCommandObserver; |
12 class TabStripModel; | 12 class TabStripModel; |
13 | 13 |
14 // A class that controls the web contents of a tab. It manages displaying the | 14 // A class that controls the web contents of a tab. It manages displaying the |
15 // native view for a given TabContents in |contentsBox_|. | 15 // native view for a given TabContents in |contentsBox_|. Note that just |
| 16 // creating the class does not display the view in |contentsBox_|. We defer |
| 17 // inserting it until the box is the correct size to avoid multiple resize |
| 18 // messages to the renderer. You must call |-ensureContentsVisible| to display |
| 19 // the render widget host view. |
16 | 20 |
17 @interface TabContentsController : NSViewController { | 21 @interface TabContentsController : NSViewController { |
18 @private | 22 @private |
19 TabContentsCommandObserver* observer_; // nil if |commands_| is nil | 23 TabContentsCommandObserver* observer_; // nil if |commands_| is nil |
20 TabContents* contents_; // weak | 24 TabContents* contents_; // weak |
21 | 25 |
22 IBOutlet NSBox* contentsBox_; | 26 IBOutlet NSBox* contentsBox_; |
23 } | 27 } |
24 | 28 |
25 // Create the contents of a tab represented by |contents| and loaded from the | 29 // Create the contents of a tab represented by |contents| and loaded from the |
26 // nib given by |name|. | 30 // nib given by |name|. |
27 - (id)initWithNibName:(NSString*)name | 31 - (id)initWithNibName:(NSString*)name |
28 contents:(TabContents*)contents; | 32 contents:(TabContents*)contents; |
29 | 33 |
30 // Called when the tab contents is about to be put into the view hierarchy as | 34 // Called when the tab contents is about to be put into the view hierarchy as |
31 // the selected tab. Handles things such as ensuring the toolbar is correctly | 35 // the selected tab. Handles things such as ensuring the toolbar is correctly |
32 // enabled. | 36 // enabled. |
33 - (void)willBecomeSelectedTab; | 37 - (void)willBecomeSelectedTab; |
34 | 38 |
| 39 // Call when the tab view is properly sized and the render widget host view |
| 40 // should be put into the view hierarchy. |
| 41 - (void)ensureContentsVisible; |
| 42 |
35 // Called when the tab contents is updated in some non-descript way (the | 43 // Called when the tab contents is updated in some non-descript way (the |
36 // notification from the model isn't specific). |updatedContents| could reflect | 44 // notification from the model isn't specific). |updatedContents| could reflect |
37 // an entirely new tab contents object. | 45 // an entirely new tab contents object. |
38 - (void)tabDidChange:(TabContents*)updatedContents; | 46 - (void)tabDidChange:(TabContents*)updatedContents; |
39 | 47 |
40 @end | 48 @end |
41 | 49 |
42 #endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ | 50 #endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ |
OLD | NEW |