| 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 class CommandUpdater; | 10 class CommandUpdater; |
| 11 class LocationBar; | 11 class LocationBar; |
| 12 @class TabStripView; | 12 @class TabStripView; |
| 13 class TabStripBridge; | 13 class TabStripBridge; |
| 14 class TabStripModel; | 14 class TabStripModel; |
| 15 class TabContents; | 15 class TabContents; |
| 16 class ToolbarModel; | 16 class ToolbarModel; |
| 17 | 17 |
| 18 // A class that handles managing the tab strip in a browser window. It uses | 18 // A class that handles managing the tab strip in a browser window. It uses |
| 19 // a supporting C++ bridge object to register for notifications from the | 19 // a supporting C++ bridge object to register for notifications from the |
| 20 // TabStripModel. The Obj-C part of this class handles drag and drop and all | 20 // TabStripModel. The Obj-C part of this class handles drag and drop and all |
| 21 // the other Cocoa-y aspects. | 21 // the other Cocoa-y aspects. |
| 22 // | 22 // |
| 23 // When a new tab is created, it loads the contents, including | 23 // When a new tab is created, we create a TabController which manages loading |
| 24 // toolbar, from a separate nib file and replaces the contentView of the | 24 // the contents, including toolbar, from a separate nib file. This controller |
| 25 // window. As tabs are switched, the single child of the contentView is | 25 // then handles replacing the contentView of the window. As tabs are switched, |
| 26 // swapped around to hold the contents (toolbar and all) representing that tab. | 26 // the single child of the contentView is swapped around to hold the contents |
| 27 // (toolbar and all) representing that tab. |
| 27 | 28 |
| 28 @interface TabStripController : NSObject { | 29 @interface TabStripController : NSObject { |
| 29 @private | 30 @private |
| 30 TabContents* currentTab_; // weak, tab for which we're showing state | 31 TabContents* currentTab_; // weak, tab for which we're showing state |
| 31 TabStripView* tabView_; // weak | 32 TabStripView* tabView_; // weak |
| 32 NSButton* newTabButton_; | 33 NSButton* newTabButton_; |
| 33 TabStripBridge* bridge_; | 34 TabStripBridge* bridge_; |
| 34 TabStripModel* tabModel_; // weak | 35 TabStripModel* tabModel_; // weak |
| 35 ToolbarModel* toolbarModel_; // weak, one per browser | 36 ToolbarModel* toolbarModel_; // weak, one per browser |
| 36 CommandUpdater* commands_; // weak, may be nil | 37 CommandUpdater* commands_; // weak, may be nil |
| 37 // access to the TabContentsControllers (which own the parent view | 38 // access to the TabContentsControllers (which own the parent view |
| 38 // for the toolbar and associated tab contents) given an index. This needs | 39 // for the toolbar and associated tab contents) given an index. This needs |
| 39 // to be kept in the same order as the tab strip's model as we will be | 40 // to be kept in the same order as the tab strip's model as we will be |
| 40 // using its index from the TabStripModelObserver calls. | 41 // using its index from the TabStripModelObserver calls. |
| 41 NSMutableArray* tabControllerArray_; | 42 NSMutableArray* tabContentsArray_; |
| 43 // an array of TabControllers which manage the actual tab views. As above, |
| 44 // this is kept in the same order as the tab strip model. |
| 45 NSMutableArray* tabArray_; |
| 42 } | 46 } |
| 43 | 47 |
| 44 // Initialize the controller with a view, model, and command updater for | 48 // Initialize the controller with a view, model, and command updater for |
| 45 // tracking what's enabled and disabled. |commands| may be nil if no updating | 49 // tracking what's enabled and disabled. |commands| may be nil if no updating |
| 46 // is desired. | 50 // is desired. |
| 47 - (id)initWithView:(TabStripView*)view | 51 - (id)initWithView:(TabStripView*)view |
| 48 tabModel:(TabStripModel*)tabModel | 52 tabModel:(TabStripModel*)tabModel |
| 49 toolbarModel:(ToolbarModel*)toolbarModel | 53 toolbarModel:(ToolbarModel*)toolbarModel |
| 50 commands:(CommandUpdater*)commands; | 54 commands:(CommandUpdater*)commands; |
| 51 | 55 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 68 | 72 |
| 69 // Called to tell the selected tab to update its loading state. | 73 // Called to tell the selected tab to update its loading state. |
| 70 - (void)setIsLoading:(BOOL)isLoading; | 74 - (void)setIsLoading:(BOOL)isLoading; |
| 71 | 75 |
| 72 // Make the location bar the first responder, if possible. | 76 // Make the location bar the first responder, if possible. |
| 73 - (void)focusLocationBar; | 77 - (void)focusLocationBar; |
| 74 | 78 |
| 75 @end | 79 @end |
| 76 | 80 |
| 77 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ | 81 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
| OLD | NEW |