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_|. Note that just | 15 // native view for a given TabContents and optionally its docked devtools in |
16 // creating the class does not display the view in |contentsBox_|. We defer | 16 // |contentsContainer_|. |
17 // inserting it until the box is the correct size to avoid multiple resize | 17 // Note that just creating the class does not display the view in |
18 // messages to the renderer. You must call |-ensureContentsVisible| to display | 18 // |contentsContainer_|. We defer inserting it until the box is the correct size |
19 // the render widget host view. | 19 // to avoid multiple resize messages to the renderer. You must call |
| 20 // |-ensureContentsVisible| to display the render widget host view. |
20 | 21 |
21 @interface TabContentsController : NSViewController { | 22 @interface TabContentsController : NSViewController { |
22 @private | 23 @private |
23 TabContentsCommandObserver* observer_; // nil if |commands_| is nil | 24 TabContentsCommandObserver* observer_; // nil if |commands_| is nil |
24 TabContents* contents_; // weak | 25 TabContents* contents_; // weak |
25 | 26 |
26 IBOutlet NSBox* contentsBox_; | 27 IBOutlet NSSplitView* contentsContainer_; |
27 } | 28 } |
28 | 29 |
29 // Create the contents of a tab represented by |contents| and loaded from the | 30 // Create the contents of a tab represented by |contents| and loaded from the |
30 // nib given by |name|. | 31 // nib given by |name|. |
31 - (id)initWithNibName:(NSString*)name | 32 - (id)initWithNibName:(NSString*)name |
32 contents:(TabContents*)contents; | 33 contents:(TabContents*)contents; |
33 | 34 |
34 // Called when the tab contents is the currently selected tab and is about to be | 35 // Called when the tab contents is the currently selected tab and is about to be |
35 // removed from the view hierarchy. | 36 // removed from the view hierarchy. |
36 - (void)willBecomeUnselectedTab; | 37 - (void)willBecomeUnselectedTab; |
37 | 38 |
38 // Called when the tab contents is about to be put into the view hierarchy as | 39 // Called when the tab contents is about to be put into the view hierarchy as |
39 // the selected tab. Handles things such as ensuring the toolbar is correctly | 40 // the selected tab. Handles things such as ensuring the toolbar is correctly |
40 // enabled. | 41 // enabled. |
41 - (void)willBecomeSelectedTab; | 42 - (void)willBecomeSelectedTab; |
42 | 43 |
43 // Call when the tab view is properly sized and the render widget host view | 44 // Call when the tab view is properly sized and the render widget host view |
44 // should be put into the view hierarchy. | 45 // should be put into the view hierarchy. |
45 - (void)ensureContentsVisible; | 46 - (void)ensureContentsVisible; |
46 | 47 |
47 // Called when the tab contents is updated in some non-descript way (the | 48 // Called when the tab contents is updated in some non-descript way (the |
48 // notification from the model isn't specific). |updatedContents| could reflect | 49 // notification from the model isn't specific). |updatedContents| could reflect |
49 // an entirely new tab contents object. | 50 // an entirely new tab contents object. |
50 - (void)tabDidChange:(TabContents*)updatedContents; | 51 - (void)tabDidChange:(TabContents*)updatedContents; |
51 | 52 |
| 53 // Shows |devToolsContents| in a split view, or removes the bottom view in the |
| 54 // split viewif |devToolsContents| is NULL. |
| 55 // TODO(thakis): Either move this to tab_window or move infobar handling to here |
| 56 // too -- http://crbug.com/31633 . |
| 57 - (void)showDevToolsContents:(TabContents*)devToolsContents; |
| 58 |
| 59 // Returns the height required by devtools and divider, or 0 if no devtools are |
| 60 // docked to the tab. |
| 61 - (CGFloat)devToolsHeight; |
52 @end | 62 @end |
53 | 63 |
54 #endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ | 64 #endif // CHROME_BROWSER_COCOA_TAB_CONTENTS_CONTROLLER_H_ |
OLD | NEW |