| 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_COTNENTS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TAB_COTNENTS_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_TAB_COTNENTS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_TAB_COTNENTS_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <Cocoa/Cocoa.h> | 8 #include <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 @class BookmarkView; |
| 11 @class GrowBoxView; |
| 12 @class ToolbarView; |
| 13 |
| 14 class BookmarkModel; |
| 10 class CommandUpdater; | 15 class CommandUpdater; |
| 11 @class GrowBoxView; | |
| 12 class LocationBar; | 16 class LocationBar; |
| 13 class TabContents; | 17 class TabContents; |
| 14 class TabContentsCommandObserver; | 18 class TabContentsCommandObserver; |
| 15 class TabStripModel; | 19 class TabStripModel; |
| 16 class ToolbarModel; | 20 class ToolbarModel; |
| 17 | 21 |
| 18 // A class that controls the contents of a tab, including the toolbar and | 22 // A class that controls the contents of a tab, including the toolbar and |
| 19 // web area. | 23 // web area. |
| 20 | 24 |
| 21 // TODO(pinkerton): Cole and I went back and forth about whether or not each | 25 // TODO(pinkerton): Cole and I went back and forth about whether or not each |
| 22 // tab should have its own copy of the toolbar. Right now, we decided to leave | 26 // tab should have its own copy of the toolbar. Right now, we decided to leave |
| 23 // it like this as he expects it will make it easier for him to implement | 27 // it like this as he expects it will make it easier for him to implement |
| 24 // tab dragging and tear-off into new windows. It's also not very expensive. | 28 // tab dragging and tear-off into new windows. It's also not very expensive. |
| 25 // As we hook things up, we'll see if this imposes other restrictions (such | 29 // As we hook things up, we'll see if this imposes other restrictions (such |
| 26 // as command-handling or dispatch) that will require us to change the view | 30 // as command-handling or dispatch) that will require us to change the view |
| 27 // layout. | 31 // layout. |
| 32 // TODO(jrg): Following on to pink's comments... each tab does in fact |
| 33 // have its own ToolbarView. Similarly, each also has its own |
| 34 // BookmarkView. That makes things marginally more expensive. |
| 28 | 35 |
| 29 @interface TabContentsController : NSViewController { | 36 @interface TabContentsController : NSViewController { |
| 30 @private | 37 @private |
| 31 CommandUpdater* commands_; // weak, may be nil | 38 CommandUpdater* commands_; // weak, may be nil |
| 32 TabContentsCommandObserver* observer_; // nil if |commands_| is nil | 39 TabContentsCommandObserver* observer_; // nil if |commands_| is nil |
| 33 LocationBar* locationBarBridge_; | 40 LocationBar* locationBarBridge_; |
| 34 TabContents* contents_; // weak | 41 TabContents* contents_; // weak |
| 42 |
| 35 ToolbarModel* toolbarModel_; // weak, one per window | 43 ToolbarModel* toolbarModel_; // weak, one per window |
| 44 IBOutlet ToolbarView* toolbarView_; |
| 45 |
| 46 BookmarkModel* bookmarkModel_; // weak; one per window |
| 47 |
| 48 // TODO(jrg): write a BookmarkView |
| 49 IBOutlet ToolbarView* /* BookmarkView* */ bookmarkView_; |
| 50 |
| 36 IBOutlet NSButton* backButton_; | 51 IBOutlet NSButton* backButton_; |
| 37 IBOutlet NSButton* forwardButton_; | 52 IBOutlet NSButton* forwardButton_; |
| 38 IBOutlet NSButton* reloadButton_; | 53 IBOutlet NSButton* reloadButton_; |
| 39 IBOutlet NSButton* starButton_; | 54 IBOutlet NSButton* starButton_; |
| 40 IBOutlet NSButton* goButton_; | 55 IBOutlet NSButton* goButton_; |
| 41 IBOutlet NSTextField* locationBar_; | 56 IBOutlet NSTextField* locationBar_; |
| 42 IBOutlet NSBox* contentsBox_; | 57 IBOutlet NSBox* contentsBox_; |
| 43 IBOutlet GrowBoxView* growBox_; | 58 IBOutlet GrowBoxView* growBox_; |
| 59 |
| 60 // The contents box will have an offset if shrunk to make room for |
| 61 // the bookmark bar. |
| 62 BOOL contentsBoxHasOffset_; |
| 44 } | 63 } |
| 45 | 64 |
| 46 // Create the contents of a tab represented by |contents| and loaded from the | 65 // Create the contents of a tab represented by |contents| and loaded from the |
| 47 // nib given by |name|. |commands| allows tracking of what's enabled and | 66 // nib given by |name|. |commands| allows tracking of what's enabled and |
| 48 // disabled. It may be nil if no updating is desired. | 67 // disabled. It may be nil if no updating is desired. |
| 49 - (id)initWithNibName:(NSString*)name | 68 - (id)initWithNibName:(NSString*)name |
| 50 bundle:(NSBundle*)bundle | 69 bundle:(NSBundle*)bundle |
| 51 contents:(TabContents*)contents | 70 contents:(TabContents*)contents |
| 52 commands:(CommandUpdater*)commands | 71 commands:(CommandUpdater*)commands |
| 53 toolbarModel:(ToolbarModel*)toolbarModel; | 72 toolbarModel:(ToolbarModel*)toolbarModel |
| 73 bookmarkModel:(BookmarkModel*)bookmarkModel; |
| 54 | 74 |
| 55 // Take this view (toolbar and web contents) full screen | 75 // Take this view (toolbar and web contents) full screen |
| 56 - (IBAction)fullScreen:(id)sender; | 76 - (IBAction)fullScreen:(id)sender; |
| 57 | 77 |
| 58 // Get the C++ bridge object representing the location bar for this tab. | 78 // Get the C++ bridge object representing the location bar for this tab. |
| 59 - (LocationBar*)locationBar; | 79 - (LocationBar*)locationBar; |
| 60 | 80 |
| 61 // Called when the tab contents is about to be put into the view hierarchy as | 81 // Called when the tab contents is about to be put into the view hierarchy as |
| 62 // the selected tab. Handles things such as ensuring the toolbar is correctly | 82 // the selected tab. Handles things such as ensuring the toolbar is correctly |
| 63 // enabled. | 83 // enabled. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 79 // in the coordinate system of the content area of this tab. | 99 // in the coordinate system of the content area of this tab. |
| 80 - (NSRect)growBoxRect; | 100 - (NSRect)growBoxRect; |
| 81 | 101 |
| 82 // Called to update the loading state. Handles updating the go/stop button | 102 // Called to update the loading state. Handles updating the go/stop button |
| 83 // state. | 103 // state. |
| 84 - (void)setIsLoading:(BOOL)isLoading; | 104 - (void)setIsLoading:(BOOL)isLoading; |
| 85 | 105 |
| 86 // Make the location bar the first responder, if possible. | 106 // Make the location bar the first responder, if possible. |
| 87 - (void)focusLocationBar; | 107 - (void)focusLocationBar; |
| 88 | 108 |
| 109 // Change the visibility state of the bookmark bar. |
| 110 - (void)toggleBookmarkBar:(BOOL)enable; |
| 111 |
| 89 @end | 112 @end |
| 90 | 113 |
| 91 #endif // CHROME_BROWSER_COCOA_TAB_COTNENTS_CONTROLLER_H_ | 114 #endif // CHROME_BROWSER_COCOA_TAB_COTNENTS_CONTROLLER_H_ |
| OLD | NEW |