| 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_BOOKMARK_BAR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // contentAreaHasOffset_ is an implementation detail of bookmark bar | 38 // contentAreaHasOffset_ is an implementation detail of bookmark bar |
| 39 // show state. | 39 // show state. |
| 40 BOOL contentViewHasOffset_; | 40 BOOL contentViewHasOffset_; |
| 41 BOOL barShouldBeShown_; | 41 BOOL barShouldBeShown_; |
| 42 | 42 |
| 43 // If the bar is disabled, we hide it and ignore show/hide commands. | 43 // If the bar is disabled, we hide it and ignore show/hide commands. |
| 44 // Set when using fullscreen mode. | 44 // Set when using fullscreen mode. |
| 45 BOOL barIsEnabled_; | 45 BOOL barIsEnabled_; |
| 46 | 46 |
| 47 // The view of the bookmark bar itself. | 47 // The view of the bookmark bar itself. |
| 48 // Not made into a scoped_nsobject since I may move it into a nib. | 48 // Owned by the toolbar view, its parent view. |
| 49 // (See TODO in initWithProfile: in bookmark_bar_controller.mm). | 49 BookmarkBarView* bookmarkBarView_; // weak |
| 50 IBOutlet BookmarkBarView* bookmarkBarView_; | |
| 51 | 50 |
| 52 // The tab content area for the window (where the web goes) | 51 NSView* webContentView_; // weak; where the web goes |
| 53 IBOutlet NSView* contentView_; | |
| 54 | 52 |
| 55 // Bridge from Chrome-style C++ notifications (e.g. derived from | 53 // Bridge from Chrome-style C++ notifications (e.g. derived from |
| 56 // BookmarkModelObserver) | 54 // BookmarkModelObserver) |
| 57 scoped_ptr<BookmarkBarBridge> bridge_; | 55 scoped_ptr<BookmarkBarBridge> bridge_; |
| 58 | 56 |
| 59 // Delegate which can open URLs for us. | 57 // Delegate which can open URLs for us. |
| 60 id<BookmarkURLOpener> delegate_; // weak | 58 id<BookmarkURLOpener> delegate_; // weak |
| 61 } | 59 } |
| 62 | 60 |
| 63 // Initializes the controller with the given browser profile and | 61 // Initializes the controller with the given browser profile and |
| 64 // content view. We use |content| as a parent view for the bookmark | 62 // content view. We use |webContentView| as the view for the bookmark |
| 65 // bar view and for geometry management. |delegate| is used for | 63 // bar view and for geometry management. |delegate| is used for |
| 66 // opening URLs. | 64 // opening URLs. |view| is expected to be hidden. |
| 67 - (id)initWithProfile:(Profile*)profile | 65 - (id)initWithProfile:(Profile*)profile |
| 68 contentView:(NSView*)content | 66 view:(BookmarkBarView*)view |
| 67 webContentView:(NSView*)webContentView |
| 69 delegate:(id<BookmarkURLOpener>)delegate; | 68 delegate:(id<BookmarkURLOpener>)delegate; |
| 70 | 69 |
| 71 // Resizes the bookmark bar based on the state of the content area. | |
| 72 - (void)resizeBookmarkBar; | |
| 73 | |
| 74 // Returns whether or not the bookmark bar is visible. | 70 // Returns whether or not the bookmark bar is visible. |
| 75 - (BOOL)isBookmarkBarVisible; | 71 - (BOOL)isBookmarkBarVisible; |
| 76 | 72 |
| 77 // Toggle the state of the bookmark bar. | 73 // Toggle the state of the bookmark bar. |
| 78 - (void)toggleBookmarkBar; | 74 - (void)toggleBookmarkBar; |
| 79 | 75 |
| 80 // Turn on or off the bookmark bar and prevent or reallow its | 76 // Turn on or off the bookmark bar and prevent or reallow its |
| 81 // appearance. On disable, toggle off if shown. On enable, show only | 77 // appearance. On disable, toggle off if shown. On enable, show only |
| 82 // if needed. For fullscreen mode. | 78 // if needed. For fullscreen mode. |
| 83 - (void)setBookmarkBarEnabled:(BOOL)enabled; | 79 - (void)setBookmarkBarEnabled:(BOOL)enabled; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 96 parent:(const BookmarkNode*)oldParent index:(int)index; | 92 parent:(const BookmarkNode*)oldParent index:(int)index; |
| 97 - (void)nodeChanged:(BookmarkModel*)model | 93 - (void)nodeChanged:(BookmarkModel*)model |
| 98 node:(const BookmarkNode*)node; | 94 node:(const BookmarkNode*)node; |
| 99 - (void)nodeFavIconLoaded:(BookmarkModel*)model | 95 - (void)nodeFavIconLoaded:(BookmarkModel*)model |
| 100 node:(const BookmarkNode*)node; | 96 node:(const BookmarkNode*)node; |
| 101 - (void)nodeChildrenReordered:(BookmarkModel*)model | 97 - (void)nodeChildrenReordered:(BookmarkModel*)model |
| 102 node:(const BookmarkNode*)node; | 98 node:(const BookmarkNode*)node; |
| 103 @end | 99 @end |
| 104 | 100 |
| 105 | 101 |
| 106 // These APIs should only be used by unit tests, in place of "friend" classes. | 102 // These APIs should only be used by unit tests (or used internally). |
| 107 @interface BookmarkBarController(TestingAPI) | 103 @interface BookmarkBarController(TestingAPI) |
| 108 // Access to the bookmark bar's view represented by this controller. | 104 // Access to the bookmark bar's view represented by this controller. |
| 109 - (NSView*)view; | 105 - (NSView*)view; |
| 106 // Set the delegate for a unit test. |
| 107 - (void)setDelegate:(id<BookmarkURLOpener>)delegate; |
| 108 // Action for our bookmark buttons. |
| 109 - (void)openBookmark:(id)sender; |
| 110 @end | 110 @end |
| 111 | 111 |
| 112 #endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ | 112 #endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ |
| OLD | NEW |