Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_controller.h

Issue 159286: Added menus for bookmark bar folders. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/nibs/BookmarkBar.xib ('k') | chrome/browser/cocoa/bookmark_bar_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 BookmarkModel* bookmarkModel_; // weak; part of the profile owned by the 33 BookmarkModel* bookmarkModel_; // weak; part of the profile owned by the
34 // top-level Browser object. 34 // top-level Browser object.
35 35
36 // Currently these two are always the same when not in fullscreen 36 // Currently these two are always the same when not in fullscreen
37 // mode, but they mean slightly different things. 37 // mode, but they mean slightly different things.
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 // BookmarkNodes have a 64bit id. NSMenuItems have a 32bit tag used
44 // to represent the bookmark node they refer to. This map provides
45 // a mapping from one to the other, so we can properly identify the
46 // node from the item. When adding items in, we start with seedId_.
47 int32 seedId_;
48 std::map<int32,int64> menuTagMap_;
49
43 // Our bookmark buttons, ordered from L-->R. 50 // Our bookmark buttons, ordered from L-->R.
44 scoped_nsobject<NSMutableArray> buttons_; 51 scoped_nsobject<NSMutableArray> buttons_;
45 52
46 // If the bar is disabled, we hide it and ignore show/hide commands. 53 // If the bar is disabled, we hide it and ignore show/hide commands.
47 // Set when using fullscreen mode. 54 // Set when using fullscreen mode.
48 BOOL barIsEnabled_; 55 BOOL barIsEnabled_;
49 56
50 NSView* parentView_; // weak; our parent view 57 NSView* parentView_; // weak; our parent view
51 NSView* webContentView_; // weak; where the web goes 58 NSView* webContentView_; // weak; where the web goes
52 NSView* infoBarsView_; // weak; where the infobars go 59 NSView* infoBarsView_; // weak; where the infobars go
53 60
54 // Bridge from Chrome-style C++ notifications (e.g. derived from 61 // Bridge from Chrome-style C++ notifications (e.g. derived from
55 // BookmarkModelObserver) 62 // BookmarkModelObserver)
56 scoped_ptr<BookmarkBarBridge> bridge_; 63 scoped_ptr<BookmarkBarBridge> bridge_;
57 64
58 // Delegate which can open URLs for us. 65 // Delegate which can open URLs for us.
59 id<BookmarkURLOpener> delegate_; // weak 66 id<BookmarkURLOpener> delegate_; // weak
60 67
68 IBOutlet NSView* buttonView_;
69 IBOutlet NSButton* offTheSideButton_;
61 IBOutlet NSMenu* buttonContextMenu_; 70 IBOutlet NSMenu* buttonContextMenu_;
62 } 71 }
63 72
64 // Initializes the bookmark bar controller with the given browser 73 // Initializes the bookmark bar controller with the given browser
65 // profile, parent view (the toolbar), web content view, and delegate. 74 // profile, parent view (the toolbar), web content view, and delegate.
66 // |delegate| is used for opening URLs. 75 // |delegate| is used for opening URLs.
67 // TODO(rohitrao, jrg): The bookmark bar shouldn't know about the 76 // TODO(rohitrao, jrg): The bookmark bar shouldn't know about the
68 // infoBarsView or the webContentView. 77 // infoBarsView or the webContentView.
69 - (id)initWithProfile:(Profile*)profile 78 - (id)initWithProfile:(Profile*)profile
70 parentView:(NSView*)parentView 79 parentView:(NSView*)parentView
71 webContentView:(NSView*)webContentView 80 webContentView:(NSView*)webContentView
72 infoBarsView:(NSView*)infoBarsView 81 infoBarsView:(NSView*)infoBarsView
73 delegate:(id<BookmarkURLOpener>)delegate; 82 delegate:(id<BookmarkURLOpener>)delegate;
74 83
75 // Returns whether or not the bookmark bar is visible. 84 // Returns whether or not the bookmark bar is visible.
76 - (BOOL)isBookmarkBarVisible; 85 - (BOOL)isBookmarkBarVisible;
77 86
78 // Toggle the state of the bookmark bar. 87 // Toggle the state of the bookmark bar.
79 - (void)toggleBookmarkBar; 88 - (void)toggleBookmarkBar;
80 89
81 // Turn on or off the bookmark bar and prevent or reallow its 90 // Turn on or off the bookmark bar and prevent or reallow its
82 // appearance. On disable, toggle off if shown. On enable, show only 91 // appearance. On disable, toggle off if shown. On enable, show only
83 // if needed. For fullscreen mode. 92 // if needed. For fullscreen mode.
84 - (void)setBookmarkBarEnabled:(BOOL)enabled; 93 - (void)setBookmarkBarEnabled:(BOOL)enabled;
85 94
86 // Actions for manipulating bookmarks. 95 // Actions for manipulating bookmarks.
87 // From a button, ... 96 // From a button, ...
88 - (IBAction)openBookmark:(id)sender; 97 - (IBAction)openBookmark:(id)sender;
98 - (IBAction)openFolderMenuFromButton:(id)sender;
99 - (IBAction)openOffTheSideMenuFromButton:(id)sender;
89 // From a context menu over the button, ... 100 // From a context menu over the button, ...
90 - (IBAction)openBookmarkInNewForegroundTab:(id)sender; 101 - (IBAction)openBookmarkInNewForegroundTab:(id)sender;
91 - (IBAction)openBookmarkInNewWindow:(id)sender; 102 - (IBAction)openBookmarkInNewWindow:(id)sender;
92 - (IBAction)openBookmarkInIncognitoWindow:(id)sender; 103 - (IBAction)openBookmarkInIncognitoWindow:(id)sender;
93 - (IBAction)editBookmark:(id)sender; 104 - (IBAction)editBookmark:(id)sender;
94 - (IBAction)deleteBookmark:(id)sender; 105 - (IBAction)deleteBookmark:(id)sender;
95 // From a context menu over the bar, ... 106 // From a context menu over the bar, ...
96 - (IBAction)openAllBookmarks:(id)sender; 107 - (IBAction)openAllBookmarks:(id)sender;
97 // Or from a context menu over either the bar or a button. 108 // Or from a context menu over either the bar or a button.
98 - (IBAction)addPage:(id)sender; 109 - (IBAction)addPage:(id)sender;
99 - (IBAction)addOrRenameFolder:(id)sender; 110 - (IBAction)addOrRenameFolder:(id)sender;
100 111
101
102 @end 112 @end
103 113
104 // Redirects from BookmarkBarBridge, the C++ object which glues us to 114 // Redirects from BookmarkBarBridge, the C++ object which glues us to
105 // the rest of Chromium. Internal to BookmarkBarController. 115 // the rest of Chromium. Internal to BookmarkBarController.
106 @interface BookmarkBarController(BridgeRedirect) 116 @interface BookmarkBarController(BridgeRedirect)
107 - (void)loaded:(BookmarkModel*)model; 117 - (void)loaded:(BookmarkModel*)model;
108 - (void)beingDeleted:(BookmarkModel*)model; 118 - (void)beingDeleted:(BookmarkModel*)model;
109 - (void)nodeMoved:(BookmarkModel*)model 119 - (void)nodeMoved:(BookmarkModel*)model
110 oldParent:(const BookmarkNode*)oldParent oldIndex:(int)oldIndex 120 oldParent:(const BookmarkNode*)oldParent oldIndex:(int)oldIndex
111 newParent:(const BookmarkNode*)newParent newIndex:(int)newIndex; 121 newParent:(const BookmarkNode*)newParent newIndex:(int)newIndex;
112 - (void)nodeAdded:(BookmarkModel*)model 122 - (void)nodeAdded:(BookmarkModel*)model
113 parent:(const BookmarkNode*)oldParent index:(int)index; 123 parent:(const BookmarkNode*)oldParent index:(int)index;
114 - (void)nodeRemoved:(BookmarkModel*)model 124 - (void)nodeRemoved:(BookmarkModel*)model
115 parent:(const BookmarkNode*)oldParent index:(int)index; 125 parent:(const BookmarkNode*)oldParent index:(int)index;
116 - (void)nodeChanged:(BookmarkModel*)model 126 - (void)nodeChanged:(BookmarkModel*)model
117 node:(const BookmarkNode*)node; 127 node:(const BookmarkNode*)node;
118 - (void)nodeFavIconLoaded:(BookmarkModel*)model 128 - (void)nodeFavIconLoaded:(BookmarkModel*)model
119 node:(const BookmarkNode*)node; 129 node:(const BookmarkNode*)node;
120 - (void)nodeChildrenReordered:(BookmarkModel*)model 130 - (void)nodeChildrenReordered:(BookmarkModel*)model
121 node:(const BookmarkNode*)node; 131 node:(const BookmarkNode*)node;
122 @end 132 @end
123 133
124 134
125 // These APIs should only be used by unit tests (or used internally). 135 // These APIs should only be used by unit tests (or used internally).
126 @interface BookmarkBarController(TestingAPI) 136 @interface BookmarkBarController(InternalOrTestingAPI)
127 // Set the delegate for a unit test. 137 // Set the delegate for a unit test.
128 - (void)setDelegate:(id<BookmarkURLOpener>)delegate; 138 - (void)setDelegate:(id<BookmarkURLOpener>)delegate;
129 - (void)clearBookmarkBar; 139 - (void)clearBookmarkBar;
140 - (NSView*)buttonView;
130 - (NSArray*)buttons; 141 - (NSArray*)buttons;
131 - (NSRect)frameForBookmarkButtonFromCell:(NSCell*)cell xOffset:(int*)xOffset; 142 - (NSRect)frameForBookmarkButtonFromCell:(NSCell*)cell xOffset:(int*)xOffset;
132 - (void)checkForBookmarkButtonGrowth:(NSButton*)button; 143 - (void)checkForBookmarkButtonGrowth:(NSButton*)button;
144 - (void)frameDidChange;
145 - (BOOL)offTheSideButtonIsEnabled;
146 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node;
147 - (int64)nodeIdFromMenuTag:(int32)tag;
148 - (int32)menuTagFromNodeId:(int64)menuid;
133 @end 149 @end
134 150
135 #endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ 151 #endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/app/nibs/BookmarkBar.xib ('k') | chrome/browser/cocoa/bookmark_bar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698