| 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 #include <map> | 9 #include <map> |
| 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 #include "chrome/browser/cocoa/bookmark_bar_bridge.h" | 13 #include "chrome/browser/cocoa/bookmark_bar_bridge.h" |
| 14 #include "webkit/glue/window_open_disposition.h" | 14 #include "webkit/glue/window_open_disposition.h" |
| 15 | 15 |
| 16 @class BookmarkBarStateController; | 16 @class BookmarkBarStateController; |
| 17 class BookmarkModel; | 17 class BookmarkModel; |
| 18 class BookmarkNode; | 18 class BookmarkNode; |
| 19 @class BookmarkBarView; | 19 @class BookmarkBarView; |
| 20 class GURL; | 20 class GURL; |
| 21 @class MenuButton; |
| 21 class Profile; | 22 class Profile; |
| 22 class PrefService; | 23 class PrefService; |
| 23 @protocol ViewResizer; | 24 @protocol ViewResizer; |
| 24 | 25 |
| 25 // The interface for an object which can open URLs for a bookmark. | 26 // The interface for an object which can open URLs for a bookmark. |
| 26 @protocol BookmarkURLOpener | 27 @protocol BookmarkURLOpener |
| 27 - (void)openBookmarkURL:(const GURL&)url | 28 - (void)openBookmarkURL:(const GURL&)url |
| 28 disposition:(WindowOpenDisposition)disposition; | 29 disposition:(WindowOpenDisposition)disposition; |
| 29 @end | 30 @end |
| 30 | 31 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 61 // BookmarkModelObserver) | 62 // BookmarkModelObserver) |
| 62 scoped_ptr<BookmarkBarBridge> bridge_; | 63 scoped_ptr<BookmarkBarBridge> bridge_; |
| 63 | 64 |
| 64 // Delegate that can resize us. | 65 // Delegate that can resize us. |
| 65 id<ViewResizer> resizeDelegate_; // weak | 66 id<ViewResizer> resizeDelegate_; // weak |
| 66 | 67 |
| 67 // Delegate that can open URLs for us. | 68 // Delegate that can open URLs for us. |
| 68 id<BookmarkURLOpener> urlDelegate_; // weak | 69 id<BookmarkURLOpener> urlDelegate_; // weak |
| 69 | 70 |
| 70 IBOutlet NSView* buttonView_; | 71 IBOutlet NSView* buttonView_; |
| 71 IBOutlet NSButton* offTheSideButton_; | 72 IBOutlet MenuButton* offTheSideButton_; |
| 72 IBOutlet NSMenu* buttonContextMenu_; | 73 IBOutlet NSMenu* buttonContextMenu_; |
| 73 } | 74 } |
| 74 | 75 |
| 75 // Initializes the bookmark bar controller with the given browser | 76 // Initializes the bookmark bar controller with the given browser |
| 76 // profile and delegates. | 77 // profile and delegates. |
| 77 - (id)initWithProfile:(Profile*)profile | 78 - (id)initWithProfile:(Profile*)profile |
| 78 initialWidth:(float)initialWidth | 79 initialWidth:(float)initialWidth |
| 79 resizeDelegate:(id<ViewResizer>)resizeDelegate | 80 resizeDelegate:(id<ViewResizer>)resizeDelegate |
| 80 urlDelegate:(id<BookmarkURLOpener>)urlDelegate; | 81 urlDelegate:(id<BookmarkURLOpener>)urlDelegate; |
| 81 | 82 |
| 82 // Tell the bar to show itself if needed (e.g. if the kShowBookmarkBar | 83 // Tell the bar to show itself if needed (e.g. if the kShowBookmarkBar |
| 83 // is set). Called once after the controller is first created. | 84 // is set). Called once after the controller is first created. |
| 84 - (void)showIfNeeded; | 85 - (void)showIfNeeded; |
| 85 | 86 |
| 86 // Returns whether or not the bookmark bar is visible. | 87 // Returns whether or not the bookmark bar is visible. |
| 87 - (BOOL)isBookmarkBarVisible; | 88 - (BOOL)isBookmarkBarVisible; |
| 88 | 89 |
| 89 // Toggle the state of the bookmark bar. | 90 // Toggle the state of the bookmark bar. |
| 90 - (void)toggleBookmarkBar; | 91 - (void)toggleBookmarkBar; |
| 91 | 92 |
| 92 // Turn on or off the bookmark bar and prevent or reallow its | 93 // Turn on or off the bookmark bar and prevent or reallow its |
| 93 // appearance. On disable, toggle off if shown. On enable, show only | 94 // appearance. On disable, toggle off if shown. On enable, show only |
| 94 // if needed. For fullscreen mode. | 95 // if needed. For fullscreen mode. |
| 95 - (void)setBookmarkBarEnabled:(BOOL)enabled; | 96 - (void)setBookmarkBarEnabled:(BOOL)enabled; |
| 96 | 97 |
| 97 // Actions for manipulating bookmarks. | 98 // Actions for manipulating bookmarks. |
| 98 // From a button, ... | 99 // From a button, ... |
| 99 - (IBAction)openBookmark:(id)sender; | 100 - (IBAction)openBookmark:(id)sender; |
| 100 - (IBAction)openFolderMenuFromButton:(id)sender; | 101 - (IBAction)openFolderMenuFromButton:(id)sender; |
| 101 - (IBAction)openOffTheSideMenuFromButton:(id)sender; | |
| 102 // From a context menu over the button, ... | 102 // From a context menu over the button, ... |
| 103 - (IBAction)openBookmarkInNewForegroundTab:(id)sender; | 103 - (IBAction)openBookmarkInNewForegroundTab:(id)sender; |
| 104 - (IBAction)openBookmarkInNewWindow:(id)sender; | 104 - (IBAction)openBookmarkInNewWindow:(id)sender; |
| 105 - (IBAction)openBookmarkInIncognitoWindow:(id)sender; | 105 - (IBAction)openBookmarkInIncognitoWindow:(id)sender; |
| 106 - (IBAction)editBookmark:(id)sender; | 106 - (IBAction)editBookmark:(id)sender; |
| 107 - (IBAction)deleteBookmark:(id)sender; | 107 - (IBAction)deleteBookmark:(id)sender; |
| 108 // From a context menu over the bar, ... | 108 // From a context menu over the bar, ... |
| 109 - (IBAction)openAllBookmarks:(id)sender; | 109 - (IBAction)openAllBookmarks:(id)sender; |
| 110 // Or from a context menu over either the bar or a button. | 110 // Or from a context menu over either the bar or a button. |
| 111 - (IBAction)addPage:(id)sender; | 111 - (IBAction)addPage:(id)sender; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 141 - (void)clearBookmarkBar; | 141 - (void)clearBookmarkBar; |
| 142 - (NSView*)buttonView; | 142 - (NSView*)buttonView; |
| 143 - (NSArray*)buttons; | 143 - (NSArray*)buttons; |
| 144 - (NSRect)frameForBookmarkButtonFromCell:(NSCell*)cell xOffset:(int*)xOffset; | 144 - (NSRect)frameForBookmarkButtonFromCell:(NSCell*)cell xOffset:(int*)xOffset; |
| 145 - (void)checkForBookmarkButtonGrowth:(NSButton*)button; | 145 - (void)checkForBookmarkButtonGrowth:(NSButton*)button; |
| 146 - (void)frameDidChange; | 146 - (void)frameDidChange; |
| 147 - (BOOL)offTheSideButtonIsHidden; | 147 - (BOOL)offTheSideButtonIsHidden; |
| 148 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node; | 148 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node; |
| 149 - (int64)nodeIdFromMenuTag:(int32)tag; | 149 - (int64)nodeIdFromMenuTag:(int32)tag; |
| 150 - (int32)menuTagFromNodeId:(int64)menuid; | 150 - (int32)menuTagFromNodeId:(int64)menuid; |
| 151 - (void)buildOffTheSideMenu; |
| 152 - (NSMenu*)offTheSideMenu; |
| 151 @end | 153 @end |
| 152 | 154 |
| 153 #endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ | 155 #endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ |
| OLD | NEW |