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_STRIP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
6 #define CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #import "chrome/browser/cocoa/tab_controller_target.h" | 10 #import "chrome/browser/cocoa/tab_controller_target.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // When a new tab is created, we create a TabController which manages loading | 29 // When a new tab is created, we create a TabController which manages loading |
30 // the contents, including toolbar, from a separate nib file. This controller | 30 // the contents, including toolbar, from a separate nib file. This controller |
31 // then handles replacing the contentView of the window. As tabs are switched, | 31 // then handles replacing the contentView of the window. As tabs are switched, |
32 // the single child of the contentView is swapped around to hold the contents | 32 // the single child of the contentView is swapped around to hold the contents |
33 // (toolbar and all) representing that tab. | 33 // (toolbar and all) representing that tab. |
34 | 34 |
35 @interface TabStripController : NSObject <TabControllerTarget> { | 35 @interface TabStripController : NSObject <TabControllerTarget> { |
36 @private | 36 @private |
37 TabContents* currentTab_; // weak, tab for which we're showing state | 37 TabContents* currentTab_; // weak, tab for which we're showing state |
38 TabStripView* tabView_; // weak | 38 TabStripView* tabView_; // weak |
| 39 NSView* switchView_; // weak |
39 NSButton* newTabButton_; // weak, obtained from the nib. | 40 NSButton* newTabButton_; // weak, obtained from the nib. |
40 TabStripModelObserverBridge* bridge_; | 41 TabStripModelObserverBridge* bridge_; |
41 TabStripModel* tabModel_; // weak | 42 TabStripModel* tabModel_; // weak |
42 ToolbarModel* toolbarModel_; // weak, one per browser | |
43 BookmarkModel* bookmarkModel_; // weak, one per profile (= one per Browser*) | 43 BookmarkModel* bookmarkModel_; // weak, one per profile (= one per Browser*) |
44 CommandUpdater* commands_; // weak, may be nil | 44 CommandUpdater* commands_; // weak, may be nil |
45 // access to the TabContentsControllers (which own the parent view | 45 // access to the TabContentsControllers (which own the parent view |
46 // for the toolbar and associated tab contents) given an index. This needs | 46 // for the toolbar and associated tab contents) given an index. This needs |
47 // to be kept in the same order as the tab strip's model as we will be | 47 // to be kept in the same order as the tab strip's model as we will be |
48 // using its index from the TabStripModelObserver calls. | 48 // using its index from the TabStripModelObserver calls. |
49 NSMutableArray* tabContentsArray_; | 49 NSMutableArray* tabContentsArray_; |
50 // an array of TabControllers which manage the actual tab views. As above, | 50 // an array of TabControllers which manage the actual tab views. As above, |
51 // this is kept in the same order as the tab strip model. | 51 // this is kept in the same order as the tab strip model. |
52 NSMutableArray* tabArray_; | 52 NSMutableArray* tabArray_; |
53 | 53 |
54 // Controller for bookmark bar state, shared among all TabContents. | 54 // Controller for bookmark bar state, shared among all TabContents. |
55 BookmarkBarStateController* bookmarkBarStateController_; | 55 BookmarkBarStateController* bookmarkBarStateController_; |
56 } | 56 } |
57 | 57 |
58 // Initialize the controller with a view and browser that contains | 58 // Initialize the controller with a view and browser that contains |
59 // everything else we'll need. | 59 // everything else we'll need. |switchView| is the view whose contents get |
| 60 // "switched" every time the user switches tabs. The children of this view |
| 61 // will be released, so if you want them to stay around, make sure |
| 62 // you have retained them. |
60 - (id)initWithView:(TabStripView*)view | 63 - (id)initWithView:(TabStripView*)view |
| 64 switchView:(NSView*)switchView |
61 browser:(Browser*)browser; | 65 browser:(Browser*)browser; |
62 | 66 |
63 // Get the C++ bridge object representing the location bar for the current tab. | |
64 - (LocationBar*)locationBar; | |
65 | |
66 // Updates the toolbar (and transitively the location bar) with the states of | |
67 // the specified |tab|. If |shouldRestore| is true, we're switching | |
68 // (back?) to this tab and should restore any previous location bar state | |
69 // (such as user editing) as well. | |
70 - (void)updateToolbarWithContents:(TabContents*)tab | |
71 shouldRestoreState:(BOOL)shouldRestore; | |
72 | |
73 // Sets whether or not the current page in the frontmost tab is bookmarked. | |
74 - (void)setStarredState:(BOOL)isStarred; | |
75 | |
76 // Return the rect, in WebKit coordinates (flipped), of the window's grow box | 67 // Return the rect, in WebKit coordinates (flipped), of the window's grow box |
77 // in the coordinate system of the content area of the currently selected tab. | 68 // in the coordinate system of the content area of the currently selected tab. |
78 - (NSRect)selectedTabGrowBoxRect; | 69 - (NSRect)selectedTabGrowBoxRect; |
79 | 70 |
80 // Called to tell the selected tab to update its loading state. | |
81 - (void)setIsLoading:(BOOL)isLoading; | |
82 | |
83 // Make the location bar the first responder, if possible. | |
84 - (void)focusLocationBar; | |
85 | |
86 // Return a boolean (ObjC BOOL, not C++ bool) to say if the bookmark | 71 // Return a boolean (ObjC BOOL, not C++ bool) to say if the bookmark |
87 // bar is visible. | 72 // bar is visible. |
88 - (BOOL)isBookmarkBarVisible; | 73 - (BOOL)isBookmarkBarVisible; |
89 | 74 |
90 // Turn on or off the bookmark bar for *ALL* tabs. | 75 // Turn on or off the bookmark bar for *ALL* tabs. |
91 - (void)toggleBookmarkBar; | 76 - (void)toggleBookmarkBar; |
92 | 77 |
93 // Given a tab view in the strip, return its index. Returns -1 if not present. | 78 // Given a tab view in the strip, return its index. Returns -1 if not present. |
94 - (NSInteger)indexForTabView:(NSView*)view; | 79 - (NSInteger)indexForTabView:(NSView*)view; |
95 | 80 |
96 @end | 81 @end |
97 | 82 |
98 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ | 83 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
OLD | NEW |