OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_STRIP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 #include "base/memory/scoped_nsobject.h" | 11 #include "base/memory/scoped_nsobject.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | 13 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
14 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" | 14 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" |
15 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 15 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
16 #include "chrome/browser/ui/tabs/hover_tab_selector.h" | 16 #include "chrome/browser/ui/tabs/hover_tab_selector.h" |
17 #import "third_party/GTM/AppKit/GTMWindowSheetController.h" | 17 #import "third_party/GTM/AppKit/GTMWindowSheetController.h" |
18 | 18 |
19 @class CrTrackingArea; | 19 @class CrTrackingArea; |
20 @class NewTabButton; | 20 @class NewTabButton; |
21 @class ProfileMenuButton; | |
22 @class TabContentsController; | 21 @class TabContentsController; |
23 @class TabView; | 22 @class TabView; |
24 @class TabStripDragController; | 23 @class TabStripDragController; |
25 @class TabStripView; | 24 @class TabStripView; |
26 | 25 |
27 class Browser; | 26 class Browser; |
28 class ConstrainedWindowMac; | 27 class ConstrainedWindowMac; |
29 class TabStripModelObserverBridge; | 28 class TabStripModelObserverBridge; |
30 class TabStripModel; | 29 class TabStripModel; |
31 class TabContents; | 30 class TabContents; |
32 class ToolbarModel; | 31 class ToolbarModel; |
33 | 32 |
34 namespace TabStripControllerInternal { | |
35 class NotificationBridge; | |
36 } // namespace TabStripControllerInternal | |
37 | |
38 // The interface for the tab strip controller's delegate. | 33 // The interface for the tab strip controller's delegate. |
39 // Delegating TabStripModelObserverBridge's events (in lieu of directly | 34 // Delegating TabStripModelObserverBridge's events (in lieu of directly |
40 // subscribing to TabStripModelObserverBridge events, as TabStripController | 35 // subscribing to TabStripModelObserverBridge events, as TabStripController |
41 // does) is necessary to guarantee a proper order of subviews layout updates, | 36 // does) is necessary to guarantee a proper order of subviews layout updates, |
42 // otherwise it might trigger unnesessary content relayout, UI flickering etc. | 37 // otherwise it might trigger unnesessary content relayout, UI flickering etc. |
43 @protocol TabStripControllerDelegate | 38 @protocol TabStripControllerDelegate |
44 | 39 |
45 // Stripped down version of TabStripModelObserverBridge:selectTabWithContents. | 40 // Stripped down version of TabStripModelObserverBridge:selectTabWithContents. |
46 - (void)onActivateTabWithContents:(TabContents*)contents; | 41 - (void)onActivateTabWithContents:(TabContents*)contents; |
47 | 42 |
(...skipping 23 matching lines...) Expand all Loading... |
71 TabContentsControllerDelegate> { | 66 TabContentsControllerDelegate> { |
72 @protected | 67 @protected |
73 // YES if tabs are to be laid out vertically instead of horizontally. | 68 // YES if tabs are to be laid out vertically instead of horizontally. |
74 BOOL verticalLayout_; | 69 BOOL verticalLayout_; |
75 | 70 |
76 @private | 71 @private |
77 scoped_nsobject<TabStripView> tabStripView_; | 72 scoped_nsobject<TabStripView> tabStripView_; |
78 NSView* switchView_; // weak | 73 NSView* switchView_; // weak |
79 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags | 74 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags |
80 NewTabButton* newTabButton_; // weak, obtained from the nib. | 75 NewTabButton* newTabButton_; // weak, obtained from the nib. |
81 ProfileMenuButton* profileMenuButton_; // weak, obtained from the nib. | |
82 BOOL hasUpdatedProfileMenuButtonXOffset_; | |
83 | 76 |
84 // The controller that manages all the interactions of dragging tabs. | 77 // The controller that manages all the interactions of dragging tabs. |
85 scoped_nsobject<TabStripDragController> dragController_; | 78 scoped_nsobject<TabStripDragController> dragController_; |
86 | 79 |
87 // Tracks the newTabButton_ for rollovers. | 80 // Tracks the newTabButton_ for rollovers. |
88 scoped_nsobject<CrTrackingArea> newTabTrackingArea_; | 81 scoped_nsobject<CrTrackingArea> newTabTrackingArea_; |
89 scoped_ptr<TabStripModelObserverBridge> bridge_; | 82 scoped_ptr<TabStripModelObserverBridge> bridge_; |
90 Browser* browser_; // weak | 83 Browser* browser_; // weak |
91 TabStripModel* tabStripModel_; // weak | 84 TabStripModel* tabStripModel_; // weak |
92 // Delegate that is informed about tab state changes. | 85 // Delegate that is informed about tab state changes. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // The amount by which to indent the tabs on the left (to make room for the | 143 // The amount by which to indent the tabs on the left (to make room for the |
151 // red/yellow/green buttons). | 144 // red/yellow/green buttons). |
152 CGFloat indentForControls_; | 145 CGFloat indentForControls_; |
153 | 146 |
154 // Manages per-tab sheets. | 147 // Manages per-tab sheets. |
155 scoped_nsobject<GTMWindowSheetController> sheetController_; | 148 scoped_nsobject<GTMWindowSheetController> sheetController_; |
156 | 149 |
157 // Is the mouse currently inside the strip; | 150 // Is the mouse currently inside the strip; |
158 BOOL mouseInside_; | 151 BOOL mouseInside_; |
159 | 152 |
160 // Used for monitoring the profile name pref. | |
161 scoped_ptr<TabStripControllerInternal::NotificationBridge> | |
162 notificationBridge_; | |
163 | |
164 // Helper for performing tab selection as a result of dragging over a tab. | 153 // Helper for performing tab selection as a result of dragging over a tab. |
165 scoped_ptr<HoverTabSelector> hoverTabSelector_; | 154 scoped_ptr<HoverTabSelector> hoverTabSelector_; |
166 } | 155 } |
167 | 156 |
168 @property(nonatomic) CGFloat indentForControls; | 157 @property(nonatomic) CGFloat indentForControls; |
169 | 158 |
170 // Initialize the controller with a view and browser that contains | 159 // Initialize the controller with a view and browser that contains |
171 // everything else we'll need. |switchView| is the view whose contents get | 160 // everything else we'll need. |switchView| is the view whose contents get |
172 // "switched" every time the user switches tabs. The children of this view | 161 // "switched" every time the user switches tabs. The children of this view |
173 // will be released, so if you want them to stay around, make sure | 162 // will be released, so if you want them to stay around, make sure |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window; | 263 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window; |
275 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; | 264 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; |
276 | 265 |
277 @end | 266 @end |
278 | 267 |
279 // Notification sent when the number of tabs changes. The object will be this | 268 // Notification sent when the number of tabs changes. The object will be this |
280 // controller. | 269 // controller. |
281 extern NSString* const kTabStripNumberOfTabsChanged; | 270 extern NSString* const kTabStripNumberOfTabsChanged; |
282 | 271 |
283 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ | 272 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ |
OLD | NEW |