| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 // A class acting as the Objective-C window controller for a window that has | 8 // A class acting as the Objective-C window controller for a window that has |
| 9 // tabs which can be dragged around. Tabs can be re-arranged within the same | 9 // tabs which can be dragged around. Tabs can be re-arranged within the same |
| 10 // window or dragged into other TabWindowController windows. This class doesn't | 10 // window or dragged into other TabWindowController windows. This class doesn't |
| 11 // know anything about the actual tab implementation or model, as that is fairly | 11 // know anything about the actual tab implementation or model, as that is fairly |
| 12 // application-specific. It only provides an API to be overridden by subclasses | 12 // application-specific. It only provides an API to be overridden by subclasses |
| 13 // to fill in the details. | 13 // to fill in the details. |
| 14 | 14 |
| 15 #import <Cocoa/Cocoa.h> | 15 #import <Cocoa/Cocoa.h> |
| 16 | 16 |
| 17 #include "base/mac/scoped_nsobject.h" | 17 #include "base/mac/scoped_nsobject.h" |
| 18 | 18 |
| 19 @class FastResizeView; | 19 @class FastResizeView; |
| 20 @class FocusTracker; | 20 @class FocusTracker; |
| 21 @class TabStripView; | 21 @class TabStripView; |
| 22 @class TabView; | 22 @class TabView; |
| 23 | 23 |
| 24 @interface TabWindowController : NSWindowController<NSWindowDelegate> { | 24 @interface TabWindowController : NSWindowController<NSWindowDelegate> { |
| 25 @private | 25 @private |
| 26 // Wrapper view around web content, and the developer tools view. | |
| 27 base::scoped_nsobject<FastResizeView> tabContentArea_; | 26 base::scoped_nsobject<FastResizeView> tabContentArea_; |
| 28 | |
| 29 // The tab strip overlaps the titlebar of the window. | |
| 30 base::scoped_nsobject<TabStripView> tabStripView_; | 27 base::scoped_nsobject<TabStripView> tabStripView_; |
| 31 | 28 |
| 32 // In OSX 10.10+, all views must be added to the NSWindow's contentView. Some | |
| 33 // views (like the tab strip and the profile icon) are placed on top of the | |
| 34 // title bar and require special treatment. All other views should be added | |
| 35 // as subviews of chromeContentView_. This allows tab dragging and fullscreen | |
| 36 // logic to easily move the views that don't need special treatment. | |
| 37 base::scoped_nsobject<NSView> chromeContentView_; | |
| 38 | |
| 39 // The child window used during dragging to achieve the opacity tricks. | 29 // The child window used during dragging to achieve the opacity tricks. |
| 40 NSWindow* overlayWindow_; | 30 NSWindow* overlayWindow_; |
| 41 | 31 |
| 42 // The contentView of the original window that is moved (for the duration | 32 // The contentView of the original window that is moved (for the duration |
| 43 // of the drag) to the |overlayWindow_|. | 33 // of the drag) to the |overlayWindow_|. |
| 44 NSView* originalContentView_; // weak | 34 NSView* originalContentView_; // weak |
| 45 | 35 |
| 46 base::scoped_nsobject<FocusTracker> focusBeforeOverlay_; | 36 base::scoped_nsobject<FocusTracker> focusBeforeOverlay_; |
| 47 BOOL closeDeferred_; // If YES, call performClose: in removeOverlay:. | 37 BOOL closeDeferred_; // If YES, call performClose: in removeOverlay:. |
| 48 } | 38 } |
| 49 @property(readonly, nonatomic) TabStripView* tabStripView; | 39 @property(readonly, nonatomic) TabStripView* tabStripView; |
| 50 @property(readonly, nonatomic) FastResizeView* tabContentArea; | 40 @property(readonly, nonatomic) FastResizeView* tabContentArea; |
| 51 @property(readonly, nonatomic) NSView* chromeContentView; | |
| 52 | 41 |
| 53 // This is the designated initializer for this class. | 42 // This is the designated initializer for this class. |
| 54 - (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip; | 43 - (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip; |
| 55 | 44 |
| 56 // Used during tab dragging to turn on/off the overlay window when a tab | 45 // Used during tab dragging to turn on/off the overlay window when a tab |
| 57 // is torn off. If -deferPerformClose (below) is used, -removeOverlay will | 46 // is torn off. If -deferPerformClose (below) is used, -removeOverlay will |
| 58 // cause the controller to be autoreleased before returning. | 47 // cause the controller to be autoreleased before returning. |
| 59 - (void)showOverlay; | 48 - (void)showOverlay; |
| 60 - (void)removeOverlay; | 49 - (void)removeOverlay; |
| 61 - (NSWindow*)overlayWindow; | 50 - (NSWindow*)overlayWindow; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // Tells the tab strip to forget about this tab in preparation for it being | 147 // Tells the tab strip to forget about this tab in preparation for it being |
| 159 // put into a different tab strip, such as during a drop on another window. | 148 // put into a different tab strip, such as during a drop on another window. |
| 160 - (void)detachTabView:(NSView*)view; | 149 - (void)detachTabView:(NSView*)view; |
| 161 | 150 |
| 162 // Called when the size of the window content area has changed. Override to | 151 // Called when the size of the window content area has changed. Override to |
| 163 // position specific views. Base class implementation does nothing. | 152 // position specific views. Base class implementation does nothing. |
| 164 - (void)layoutSubviews; | 153 - (void)layoutSubviews; |
| 165 @end | 154 @end |
| 166 | 155 |
| 167 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ | 156 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ |
| OLD | NEW |