Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/cocoa/tab_strip_controller.h

Issue 159780: Add support for constrained windows on os x, based on Avi's GTMWindowSheetController. (Closed)
Patch Set: Merge with ToT Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #import "chrome/browser/cocoa/tab_controller_target.h" 12 #import "chrome/browser/cocoa/tab_controller_target.h"
13 #import "third_party/GTM/AppKit/GTMWindowSheetController.h"
13 14
14 @class TabView; 15 @class TabView;
15 @class TabStripView; 16 @class TabStripView;
16 17
17 class Browser; 18 class Browser;
19 class ConstrainedWindowMac;
18 class TabStripModelObserverBridge; 20 class TabStripModelObserverBridge;
19 class TabStripModel; 21 class TabStripModel;
20 class TabContents; 22 class TabContents;
21 class ToolbarModel; 23 class ToolbarModel;
22 24
23 // A class that handles managing the tab strip in a browser window. It uses 25 // A class that handles managing the tab strip in a browser window. It uses
24 // a supporting C++ bridge object to register for notifications from the 26 // a supporting C++ bridge object to register for notifications from the
25 // TabStripModel. The Obj-C part of this class handles drag and drop and all 27 // TabStripModel. The Obj-C part of this class handles drag and drop and all
26 // the other Cocoa-y aspects. 28 // the other Cocoa-y aspects.
27 // 29 //
28 // When a new tab is created, we create a TabController which manages loading 30 // When a new tab is created, we create a TabController which manages loading
29 // the contents, including toolbar, from a separate nib file. This controller 31 // the contents, including toolbar, from a separate nib file. This controller
30 // 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,
31 // 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
32 // (toolbar and all) representing that tab. 34 // (toolbar and all) representing that tab.
33 35
34 @interface TabStripController : NSObject <TabControllerTarget> { 36 @interface TabStripController :
37 NSObject<TabControllerTarget,
38 GTMWindowSheetControllerDelegate> {
35 @private 39 @private
36 TabContents* currentTab_; // weak, tab for which we're showing state 40 TabContents* currentTab_; // weak, tab for which we're showing state
37 TabStripView* tabView_; // weak 41 TabStripView* tabView_; // weak
38 NSView* switchView_; // weak 42 NSView* switchView_; // weak
39 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags 43 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags
40 NSButton* newTabButton_; // weak, obtained from the nib. 44 NSButton* newTabButton_; // weak, obtained from the nib.
41 scoped_ptr<TabStripModelObserverBridge> bridge_; 45 scoped_ptr<TabStripModelObserverBridge> bridge_;
42 Browser* browser_; // weak 46 Browser* browser_; // weak
43 TabStripModel* tabModel_; // weak 47 TabStripModel* tabModel_; // weak
44 // access to the TabContentsControllers (which own the parent view 48 // access to the TabContentsControllers (which own the parent view
(...skipping 25 matching lines...) Expand all
70 // 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
71 // when the mouse leaves the tab strip. It's installed when the user clicks 75 // when the mouse leaves the tab strip. It's installed when the user clicks
72 // the close box of a tab and is removed when they move the mouse outside 76 // the close box of a tab and is removed when they move the mouse outside
73 // of the strip. When they do, we resize the tabs to use all available 77 // of the strip. When they do, we resize the tabs to use all available
74 // space. 78 // space.
75 scoped_nsobject<NSTrackingArea> closeTabTrackingArea_; 79 scoped_nsobject<NSTrackingArea> closeTabTrackingArea_;
76 80
77 // Array of subviews which are permanent (and which should never be removed), 81 // Array of subviews which are permanent (and which should never be removed),
78 // such as the new-tab button, but *not* the tabs themselves. 82 // such as the new-tab button, but *not* the tabs themselves.
79 scoped_nsobject<NSMutableArray> permanentSubviews_; 83 scoped_nsobject<NSMutableArray> permanentSubviews_;
84
85 // Manages per-tab sheets.
86 scoped_nsobject<GTMWindowSheetController> sheetController_;
80 } 87 }
81 88
82 // Initialize the controller with a view and browser that contains 89 // Initialize the controller with a view and browser that contains
83 // everything else we'll need. |switchView| is the view whose contents get 90 // everything else we'll need. |switchView| is the view whose contents get
84 // "switched" every time the user switches tabs. The children of this view 91 // "switched" every time the user switches tabs. The children of this view
85 // will be released, so if you want them to stay around, make sure 92 // will be released, so if you want them to stay around, make sure
86 // you have retained them. 93 // you have retained them.
87 - (id)initWithView:(TabStripView*)view 94 - (id)initWithView:(TabStripView*)view
88 switchView:(NSView*)switchView 95 switchView:(NSView*)switchView
89 browser:(Browser*)browser; 96 browser:(Browser*)browser;
(...skipping 30 matching lines...) Expand all
120 - (void)showNewTabButton:(BOOL)show; 127 - (void)showNewTabButton:(BOOL)show;
121 128
122 // Force the tabs to rearrange themselves to reflect the current model. 129 // Force the tabs to rearrange themselves to reflect the current model.
123 - (void)layoutTabs; 130 - (void)layoutTabs;
124 131
125 // The user changed the theme. 132 // The user changed the theme.
126 - (void)userChangedTheme; 133 - (void)userChangedTheme;
127 134
128 // Default height for tabs. 135 // Default height for tabs.
129 + (CGFloat)defaultTabHeight; 136 + (CGFloat)defaultTabHeight;
137
138 // Returns the (lazily created) window sheet controller of this window. Used
139 // for the per-tab sheets.
140 - (GTMWindowSheetController*)sheetController;
141
142 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window;
143 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window;
144
130 @end 145 @end
131 146
132 // Notification sent when the number of tabs changes. The object will be this 147 // Notification sent when the number of tabs changes. The object will be this
133 // controller. 148 // controller.
134 extern NSString* const kTabStripNumberOfTabsChanged; 149 extern NSString* const kTabStripNumberOfTabsChanged;
135 150
136 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ 151 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698