| 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 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // the contents, including toolbar, from a separate nib file. This controller | 31 // the contents, including toolbar, from a separate nib file. This controller |
| 32 // then handles replacing the contentView of the window. As tabs are switched, | 32 // then handles replacing the contentView of the window. As tabs are switched, |
| 33 // the single child of the contentView is swapped around to hold the contents | 33 // the single child of the contentView is swapped around to hold the contents |
| 34 // (toolbar and all) representing that tab. | 34 // (toolbar and all) representing that tab. |
| 35 | 35 |
| 36 @interface TabStripController : | 36 @interface TabStripController : |
| 37 NSObject<TabControllerTarget, | 37 NSObject<TabControllerTarget, |
| 38 GTMWindowSheetControllerDelegate> { | 38 GTMWindowSheetControllerDelegate> { |
| 39 @private | 39 @private |
| 40 TabContents* currentTab_; // weak, tab for which we're showing state | 40 TabContents* currentTab_; // weak, tab for which we're showing state |
| 41 TabStripView* tabView_; // weak | 41 scoped_nsobject<TabStripView> tabView_; // strong |
| 42 NSView* switchView_; // weak | 42 NSView* switchView_; // weak |
| 43 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags | 43 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags |
| 44 NSButton* newTabButton_; // weak, obtained from the nib. | 44 NSButton* newTabButton_; // weak, obtained from the nib. |
| 45 scoped_ptr<TabStripModelObserverBridge> bridge_; | 45 scoped_ptr<TabStripModelObserverBridge> bridge_; |
| 46 Browser* browser_; // weak | 46 Browser* browser_; // weak |
| 47 TabStripModel* tabModel_; // weak | 47 TabStripModel* tabModel_; // weak |
| 48 // access to the TabContentsControllers (which own the parent view | 48 // access to the TabContentsControllers (which own the parent view |
| 49 // for the toolbar and associated tab contents) given an index. This needs | 49 // for the toolbar and associated tab contents) given an index. This needs |
| 50 // to be kept in the same order as the tab strip's model as we will be | 50 // to be kept in the same order as the tab strip's model as we will be |
| 51 // using its index from the TabStripModelObserver calls. | 51 // using its index from the TabStripModelObserver calls. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 65 NSRect newTabTargetFrame_; | 65 NSRect newTabTargetFrame_; |
| 66 // If YES, do not show the new tab button during layout. | 66 // If YES, do not show the new tab button during layout. |
| 67 BOOL forceNewTabButtonHidden_; | 67 BOOL forceNewTabButtonHidden_; |
| 68 | 68 |
| 69 // Width available for resizing the tabs (doesn't include the new tab | 69 // Width available for resizing the tabs (doesn't include the new tab |
| 70 // button). Used to restrict the available width when closing many tabs at | 70 // button). Used to restrict the available width when closing many tabs at |
| 71 // once to prevent them from resizing to fit the full width. If the entire | 71 // once to prevent them from resizing to fit the full width. If the entire |
| 72 // width should be used, this will have a value of |kUseFullAvailableWidth|. | 72 // width should be used, this will have a value of |kUseFullAvailableWidth|. |
| 73 float availableResizeWidth_; | 73 float availableResizeWidth_; |
| 74 // A tracking area that's the size of the tab strip used to be notified | 74 // A tracking area that's the size of the tab strip used to be notified |
| 75 // when the mouse leaves the tab strip. It's installed when the user clicks | 75 // when the mouse moves in the tab strip |
| 76 // the close box of a tab and is removed when they move the mouse outside | 76 scoped_nsobject<NSTrackingArea> trackingArea_; |
| 77 // of the strip. When they do, we resize the tabs to use all available | 77 TabView* hoveredTab_; // weak. Tab that the mouse is hovering over |
| 78 // space. | |
| 79 scoped_nsobject<NSTrackingArea> closeTabTrackingArea_; | |
| 80 | 78 |
| 81 // Array of subviews which are permanent (and which should never be removed), | 79 // Array of subviews which are permanent (and which should never be removed), |
| 82 // such as the new-tab button, but *not* the tabs themselves. | 80 // such as the new-tab button, but *not* the tabs themselves. |
| 83 scoped_nsobject<NSMutableArray> permanentSubviews_; | 81 scoped_nsobject<NSMutableArray> permanentSubviews_; |
| 84 | 82 |
| 85 // Manages per-tab sheets. | 83 // Manages per-tab sheets. |
| 86 scoped_nsobject<GTMWindowSheetController> sheetController_; | 84 scoped_nsobject<GTMWindowSheetController> sheetController_; |
| 87 } | 85 } |
| 88 | 86 |
| 89 // Initialize the controller with a view and browser that contains | 87 // Initialize the controller with a view and browser that contains |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 frame:(NSRect)frame | 120 frame:(NSRect)frame |
| 123 yStretchiness:(CGFloat)yStretchiness; | 121 yStretchiness:(CGFloat)yStretchiness; |
| 124 | 122 |
| 125 // Show or hide the new tab button. The button is hidden immediately, but | 123 // Show or hide the new tab button. The button is hidden immediately, but |
| 126 // waits until the next call to |-layoutTabs| to show it again. | 124 // waits until the next call to |-layoutTabs| to show it again. |
| 127 - (void)showNewTabButton:(BOOL)show; | 125 - (void)showNewTabButton:(BOOL)show; |
| 128 | 126 |
| 129 // Force the tabs to rearrange themselves to reflect the current model. | 127 // Force the tabs to rearrange themselves to reflect the current model. |
| 130 - (void)layoutTabs; | 128 - (void)layoutTabs; |
| 131 | 129 |
| 132 // The user changed the theme. | 130 // The user changed the theme, or theme state changed. |
| 133 - (void)userChangedTheme; | 131 - (void)applyTheme; |
| 134 | 132 |
| 135 // Default height for tabs. | 133 // Default height for tabs. |
| 136 + (CGFloat)defaultTabHeight; | 134 + (CGFloat)defaultTabHeight; |
| 137 | 135 |
| 138 // Returns the (lazily created) window sheet controller of this window. Used | 136 // Returns the (lazily created) window sheet controller of this window. Used |
| 139 // for the per-tab sheets. | 137 // for the per-tab sheets. |
| 140 - (GTMWindowSheetController*)sheetController; | 138 - (GTMWindowSheetController*)sheetController; |
| 141 | 139 |
| 142 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window; | 140 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window; |
| 143 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; | 141 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; |
| 144 | 142 |
| 145 @end | 143 @end |
| 146 | 144 |
| 147 // Notification sent when the number of tabs changes. The object will be this | 145 // Notification sent when the number of tabs changes. The object will be this |
| 148 // controller. | 146 // controller. |
| 149 extern NSString* const kTabStripNumberOfTabsChanged; | 147 extern NSString* const kTabStripNumberOfTabsChanged; |
| 150 | 148 |
| 151 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ | 149 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
| OLD | NEW |