| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 #include "base/scoped_nsobject.h" | 11 #include "base/scoped_nsobject.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #import "chrome/browser/cocoa/tab_contents_controller.h" |
| 13 #import "chrome/browser/cocoa/tab_controller_target.h" | 14 #import "chrome/browser/cocoa/tab_controller_target.h" |
| 14 #import "chrome/browser/cocoa/url_drop_target.h" | 15 #import "chrome/browser/cocoa/url_drop_target.h" |
| 15 #import "third_party/GTM/AppKit/GTMWindowSheetController.h" | 16 #import "third_party/GTM/AppKit/GTMWindowSheetController.h" |
| 16 | 17 |
| 17 @class NewTabButton; | 18 @class NewTabButton; |
| 18 @class TabContentsController; | 19 @class TabContentsController; |
| 19 @class TabView; | 20 @class TabView; |
| 20 @class TabStripView; | 21 @class TabStripView; |
| 21 | 22 |
| 22 class Browser; | 23 class Browser; |
| 23 class ConstrainedWindowMac; | 24 class ConstrainedWindowMac; |
| 24 class TabStripModelObserverBridge; | 25 class TabStripModelObserverBridge; |
| 25 class TabStripModel; | 26 class TabStripModel; |
| 26 class TabContents; | 27 class TabContents; |
| 27 class ToolbarModel; | 28 class ToolbarModel; |
| 28 | 29 |
| 29 // The interface for the tab strip controller's delegate. Currently, the | 30 // The interface for the tab strip controller's delegate. |
| 30 // delegate is the BWC and is responsible for subviews layout and forwarding | 31 // Delegating TabStripModelObserverBridge's events (in lieu of directly |
| 31 // these events to InfoBarContainerController. | 32 // subscribing to TabStripModelObserverBridge events, as TabStripController |
| 32 // Delegating TabStripModelObserverBridge's events (in lieu of subscrining | 33 // does) is necessary to guarantee a proper order of subviews layout updates, |
| 33 // BWC and InfoBarContainerController to TabStripModelObserverBridge events) | |
| 34 // is necessary to guarantee a proper order of subviews layout updates, | |
| 35 // otherwise it might trigger unnesessary content relayout, UI flickering etc. | 34 // otherwise it might trigger unnesessary content relayout, UI flickering etc. |
| 36 @protocol TabStripControllerDelegate | 35 @protocol TabStripControllerDelegate |
| 37 | 36 |
| 38 // Stripped down version of TabStripModelObserverBridge:selectTabWithContents. | 37 // Stripped down version of TabStripModelObserverBridge:selectTabWithContents. |
| 39 - (void)onSelectTabWithContents:(TabContents*)contents; | 38 - (void)onSelectTabWithContents:(TabContents*)contents; |
| 40 | 39 |
| 41 // Stripped down version of TabStripModelObserverBridge:tabReplacedWithContents. | 40 // Stripped down version of TabStripModelObserverBridge:tabReplacedWithContents. |
| 42 - (void)onReplaceTabWithContents:(TabContents*)contents; | 41 - (void)onReplaceTabWithContents:(TabContents*)contents; |
| 43 | 42 |
| 44 // Stripped down version of TabStripModelObserverBridge:tabChangedWithContents. | 43 // Stripped down version of TabStripModelObserverBridge:tabChangedWithContents. |
| 45 - (void)onSelectedTabChange:(TabStripModelObserver::TabChangeType)change; | 44 - (void)onSelectedTabChange:(TabStripModelObserver::TabChangeType)change; |
| 46 | 45 |
| 47 // Stripped down version of TabStripModelObserverBridge:tabDetachedWithContents. | 46 // Stripped down version of TabStripModelObserverBridge:tabDetachedWithContents. |
| 48 - (void)onTabDetachedWithContents:(TabContents*)contents; | 47 - (void)onTabDetachedWithContents:(TabContents*)contents; |
| 49 | 48 |
| 50 @end | 49 @end |
| 51 | 50 |
| 52 // A class that handles managing the tab strip in a browser window. It uses | 51 // A class that handles managing the tab strip in a browser window. It uses |
| 53 // a supporting C++ bridge object to register for notifications from the | 52 // a supporting C++ bridge object to register for notifications from the |
| 54 // TabStripModel. The Obj-C part of this class handles drag and drop and all | 53 // TabStripModel. The Obj-C part of this class handles drag and drop and all |
| 55 // the other Cocoa-y aspects. | 54 // the other Cocoa-y aspects. |
| 56 // | 55 // |
| 57 // For a full description of the design, see | 56 // For a full description of the design, see |
| 58 // http://www.chromium.org/developers/design-documents/tab-strip-mac | 57 // http://www.chromium.org/developers/design-documents/tab-strip-mac |
| 59 @interface TabStripController : | 58 @interface TabStripController : |
| 60 NSObject<TabControllerTarget, | 59 NSObject<TabControllerTarget, |
| 61 URLDropTargetController, | 60 URLDropTargetController, |
| 62 GTMWindowSheetControllerDelegate> { | 61 GTMWindowSheetControllerDelegate, |
| 62 TabContentsControllerDelegate> { |
| 63 @protected | 63 @protected |
| 64 // YES if tabs are to be laid out vertically instead of horizontally. | 64 // YES if tabs are to be laid out vertically instead of horizontally. |
| 65 BOOL verticalLayout_; | 65 BOOL verticalLayout_; |
| 66 | 66 |
| 67 @private | 67 @private |
| 68 scoped_nsobject<TabStripView> tabStripView_; | 68 scoped_nsobject<TabStripView> tabStripView_; |
| 69 NSView* switchView_; // weak | 69 NSView* switchView_; // weak |
| 70 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags | 70 scoped_nsobject<NSView> dragBlockingView_; // avoid bad window server drags |
| 71 NewTabButton* newTabButton_; // weak, obtained from the nib. | 71 NewTabButton* newTabButton_; // weak, obtained from the nib. |
| 72 | 72 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window; | 250 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window; |
| 251 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; | 251 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; |
| 252 | 252 |
| 253 @end | 253 @end |
| 254 | 254 |
| 255 // Notification sent when the number of tabs changes. The object will be this | 255 // Notification sent when the number of tabs changes. The object will be this |
| 256 // controller. | 256 // controller. |
| 257 extern NSString* const kTabStripNumberOfTabsChanged; | 257 extern NSString* const kTabStripNumberOfTabsChanged; |
| 258 | 258 |
| 259 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ | 259 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
| OLD | NEW |