| 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 <deque> | 10 #include <deque> |
| 11 #include <map> | 11 #include <map> |
| 12 | 12 |
| 13 #include "base/scoped_nsobject.h" | 13 #include "base/scoped_nsobject.h" |
| 14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #import "chrome/browser/cocoa/tab_controller_target.h" | 15 #import "chrome/browser/cocoa/tab_controller_target.h" |
| 16 #import "chrome/browser/cocoa/url_drop_target.h" |
| 16 #import "third_party/GTM/AppKit/GTMWindowSheetController.h" | 17 #import "third_party/GTM/AppKit/GTMWindowSheetController.h" |
| 17 | 18 |
| 18 @class TabView; | 19 @class TabView; |
| 19 @class TabStripView; | 20 @class TabStripView; |
| 20 | 21 |
| 21 class Browser; | 22 class Browser; |
| 22 class ConstrainedWindowMac; | 23 class ConstrainedWindowMac; |
| 23 class TabStripModelObserverBridge; | 24 class TabStripModelObserverBridge; |
| 24 class TabStripModel; | 25 class TabStripModel; |
| 25 class TabContents; | 26 class TabContents; |
| 26 class ToolbarModel; | 27 class ToolbarModel; |
| 27 | 28 |
| 28 // A class that handles managing the tab strip in a browser window. It uses | 29 // A class that handles managing the tab strip in a browser window. It uses |
| 29 // a supporting C++ bridge object to register for notifications from the | 30 // a supporting C++ bridge object to register for notifications from the |
| 30 // TabStripModel. The Obj-C part of this class handles drag and drop and all | 31 // TabStripModel. The Obj-C part of this class handles drag and drop and all |
| 31 // the other Cocoa-y aspects. | 32 // the other Cocoa-y aspects. |
| 32 // | 33 // |
| 33 // When a new tab is created, we create a TabController which manages loading | 34 // When a new tab is created, we create a TabController which manages loading |
| 34 // the contents, including toolbar, from a separate nib file. This controller | 35 // the contents, including toolbar, from a separate nib file. This controller |
| 35 // then handles replacing the contentView of the window. As tabs are switched, | 36 // then handles replacing the contentView of the window. As tabs are switched, |
| 36 // the single child of the contentView is swapped around to hold the contents | 37 // the single child of the contentView is swapped around to hold the contents |
| 37 // (toolbar and all) representing that tab. | 38 // (toolbar and all) representing that tab. |
| 38 | 39 |
| 39 @interface TabStripController : | 40 @interface TabStripController : |
| 40 NSObject<TabControllerTarget, | 41 NSObject<TabControllerTarget, |
| 42 URLDropTargetController, |
| 41 GTMWindowSheetControllerDelegate> { | 43 GTMWindowSheetControllerDelegate> { |
| 42 @private | 44 @private |
| 43 TabContents* currentTab_; // weak, tab for which we're showing state | 45 TabContents* currentTab_; // weak, tab for which we're showing state |
| 44 scoped_nsobject<TabStripView> tabStripView_; | 46 scoped_nsobject<TabStripView> tabStripView_; |
| 45 NSView* switchView_; // weak | 47 NSView* switchView_; // weak |
| 46 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags | 48 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags |
| 47 NSButton* newTabButton_; // weak, obtained from the nib. | 49 NSButton* newTabButton_; // weak, obtained from the nib. |
| 48 | 50 |
| 49 // Tracks the newTabButton_ for rollovers. | 51 // Tracks the newTabButton_ for rollovers. |
| 50 scoped_nsobject<NSTrackingArea> newTabTrackingArea_; | 52 scoped_nsobject<NSTrackingArea> newTabTrackingArea_; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // closure. | 172 // closure. |
| 171 - (BOOL)inRapidClosureMode; | 173 - (BOOL)inRapidClosureMode; |
| 172 | 174 |
| 173 // Returns YES if the user is allowed to drag tabs on the strip at this moment. | 175 // Returns YES if the user is allowed to drag tabs on the strip at this moment. |
| 174 // For example, this returns NO if there are any pending tab close animtations. | 176 // For example, this returns NO if there are any pending tab close animtations. |
| 175 - (BOOL)tabDraggingAllowed; | 177 - (BOOL)tabDraggingAllowed; |
| 176 | 178 |
| 177 // Default height for tabs. | 179 // Default height for tabs. |
| 178 + (CGFloat)defaultTabHeight; | 180 + (CGFloat)defaultTabHeight; |
| 179 | 181 |
| 180 // Effectively an implementation of the |URLDropTargetWindowController| | |
| 181 // protocol, which the |BrowserWindowController| just reflects to us. This | |
| 182 // needed for dropping URLs on the tab strip. | |
| 183 - (void)dropURLs:(NSArray*)urls at:(NSPoint)location; | |
| 184 - (void)indicateDropURLsAt:(NSPoint)location; | |
| 185 - (void)hideDropURLsIndicator; | |
| 186 | |
| 187 // Returns the (lazily created) window sheet controller of this window. Used | 182 // Returns the (lazily created) window sheet controller of this window. Used |
| 188 // for the per-tab sheets. | 183 // for the per-tab sheets. |
| 189 - (GTMWindowSheetController*)sheetController; | 184 - (GTMWindowSheetController*)sheetController; |
| 190 | 185 |
| 191 // See comments in browser_window_controller.h for documentation about these | 186 // See comments in browser_window_controller.h for documentation about these |
| 192 // functions. | 187 // functions. |
| 193 - (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window; | 188 - (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window; |
| 194 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; | 189 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; |
| 195 | 190 |
| 196 @end | 191 @end |
| 197 | 192 |
| 198 // Notification sent when the number of tabs changes. The object will be this | 193 // Notification sent when the number of tabs changes. The object will be this |
| 199 // controller. | 194 // controller. |
| 200 extern NSString* const kTabStripNumberOfTabsChanged; | 195 extern NSString* const kTabStripNumberOfTabsChanged; |
| 201 | 196 |
| 202 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ | 197 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
| OLD | NEW |