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. | |
26 base::scoped_nsobject<FastResizeView> tabContentArea_; | 27 base::scoped_nsobject<FastResizeView> tabContentArea_; |
27 base::scoped_nsobject<NSView> tabStripBackgroundView_; | 28 base::scoped_nsobject<NSView> tabStripBackgroundView_; |
29 | |
30 // The tab strip overlaps the titlebar of the window. | |
28 base::scoped_nsobject<TabStripView> tabStripView_; | 31 base::scoped_nsobject<TabStripView> tabStripView_; |
29 | 32 |
33 // No views should be added directly to the root view. Views that overlap | |
34 // the title bar should be added to the window's contentView. All other views | |
35 // should be added to chromeContentView_. This allows tab dragging and | |
36 // fullscreen logic to easily move the views that don't need special | |
37 // treatment. | |
38 base::scoped_nsobject<NSView> chromeContentView_; | |
39 | |
30 // The child window used during dragging to achieve the opacity tricks. | 40 // The child window used during dragging to achieve the opacity tricks. |
31 NSWindow* overlayWindow_; | 41 NSWindow* overlayWindow_; |
32 | 42 |
33 // The contentView of the original window that is moved (for the duration | 43 // The contentView of the original window that is moved (for the duration |
34 // of the drag) to the |overlayWindow_|. | 44 // of the drag) to the |overlayWindow_|. |
35 NSView* originalContentView_; // weak | 45 NSView* originalContentView_; // weak |
36 | 46 |
37 base::scoped_nsobject<FocusTracker> focusBeforeOverlay_; | 47 base::scoped_nsobject<FocusTracker> focusBeforeOverlay_; |
38 BOOL closeDeferred_; // If YES, call performClose: in removeOverlay:. | 48 BOOL closeDeferred_; // If YES, call performClose: in removeOverlay:. |
39 } | 49 } |
40 @property(readonly, nonatomic) NSView* tabStripBackgroundView; | 50 @property(readonly, nonatomic) NSView* tabStripBackgroundView; |
41 @property(readonly, nonatomic) TabStripView* tabStripView; | 51 @property(readonly, nonatomic) TabStripView* tabStripView; |
42 @property(readonly, nonatomic) FastResizeView* tabContentArea; | 52 @property(readonly, nonatomic) FastResizeView* tabContentArea; |
53 @property(readonly, nonatomic) NSView* chromeContentView; | |
43 | 54 |
44 // This is the designated initializer for this class. | 55 // This is the designated initializer for this class. |
45 - (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip; | 56 - (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip; |
46 | 57 |
47 // Used during tab dragging to turn on/off the overlay window when a tab | 58 // Used during tab dragging to turn on/off the overlay window when a tab |
48 // is torn off. If -deferPerformClose (below) is used, -removeOverlay will | 59 // is torn off. If -deferPerformClose (below) is used, -removeOverlay will |
49 // cause the controller to be autoreleased before returning. | 60 // cause the controller to be autoreleased before returning. |
50 - (void)showOverlay; | 61 - (void)showOverlay; |
51 - (void)removeOverlay; | 62 - (void)removeOverlay; |
52 - (NSWindow*)overlayWindow; | 63 - (NSWindow*)overlayWindow; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 // does not mess with the NSThemeFrame. Chrome must manually enforce these | 161 // does not mess with the NSThemeFrame. Chrome must manually enforce these |
151 // constraints. | 162 // constraints. |
152 // | 163 // |
153 // Immediately after creation of the window, or after the window's content view | 164 // Immediately after creation of the window, or after the window's content view |
154 // is changed, the content view must be moved to the back. | 165 // is changed, the content view must be moved to the back. |
155 - (void)moveContentViewToBack:(NSView*)contentView; | 166 - (void)moveContentViewToBack:(NSView*)contentView; |
156 | 167 |
157 // The tab strip should always be inserted directly above the content view. | 168 // The tab strip should always be inserted directly above the content view. |
158 - (void)insertTabStripView:(NSView*)tabStripView intoWindow:(NSWindow*)window; | 169 - (void)insertTabStripView:(NSView*)tabStripView intoWindow:(NSWindow*)window; |
159 | 170 |
171 // The tab strip background view should always be inserted as the back-most | |
172 // subview of the root view. It cannot be a subview of the contentView, as that | |
173 // would cause it to become layer backed, which would cause it to draw on top | |
174 // of non-layer backed content like the window controls. | |
175 - (void)insertTabStripBackgroundViewIntoWindow:(NSWindow*)window; | |
Andre
2014/10/09 23:15:48
Make this private, since the external caller is no
erikchen
2014/10/10 00:47:45
Done.
| |
176 | |
160 @end | 177 @end |
161 | 178 |
162 @interface TabWindowController(ProtectedMethods) | 179 @interface TabWindowController(ProtectedMethods) |
163 // Tells the tab strip to forget about this tab in preparation for it being | 180 // Tells the tab strip to forget about this tab in preparation for it being |
164 // put into a different tab strip, such as during a drop on another window. | 181 // put into a different tab strip, such as during a drop on another window. |
165 - (void)detachTabView:(NSView*)view; | 182 - (void)detachTabView:(NSView*)view; |
166 | 183 |
167 // Called when the size of the window content area has changed. Override to | 184 // Called when the size of the window content area has changed. Override to |
168 // position specific views. Base class implementation does nothing. | 185 // position specific views. Base class implementation does nothing. |
169 - (void)layoutSubviews; | 186 - (void)layoutSubviews; |
170 @end | 187 @end |
171 | 188 |
172 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ | 189 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ |
OLD | NEW |