summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_bar_controller.h
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-08 17:43:01 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-08 17:43:01 +0000
commitf940976145eb807c85eef2d14c38ace469773a60 (patch)
treeaa0e0b35e67c375a2d8e1c124c8225d3ae3b6b56 /chrome/browser/cocoa/bookmark_bar_controller.h
parent70ac49883a4e9b48a875110ff342feb1a8724813 (diff)
downloadchromium_src-f940976145eb807c85eef2d14c38ace469773a60.zip
chromium_src-f940976145eb807c85eef2d14c38ace469773a60.tar.gz
chromium_src-f940976145eb807c85eef2d14c38ace469773a60.tar.bz2
Bookmark bar, now with buttons.
Much of this CL is refactoring; it's not as large as it looks. (Do I always claim that? It's really true this time.) Review URL: http://codereview.chromium.org/115150 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_controller.h')
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.h59
1 files changed, 51 insertions, 8 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.h b/chrome/browser/cocoa/bookmark_bar_controller.h
index eea3f0c..ca9dc0f 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.h
+++ b/chrome/browser/cocoa/bookmark_bar_controller.h
@@ -8,15 +8,24 @@
#import <Cocoa/Cocoa.h>
#include "base/scoped_nsobject.h"
+#include "chrome/browser/cocoa/bookmark_bar_bridge.h"
+#include "webkit/glue/window_open_disposition.h"
@class BookmarkBarStateController;
class BookmarkModel;
+class BookmarkNode;
+@class BookmarkBarView;
class Profile;
-@class ToolbarView;
+
+// The interface for an object which can open URLs for a bookmark.
+@protocol BookmarkURLOpener
+- (void)openBookmarkURL:(const GURL&)url
+ disposition:(WindowOpenDisposition)disposition;
+@end
+
// A controller for the bookmark bar in the browser window. Handles showing
// and hiding based on the preference in the given profile.
-
@interface BookmarkBarController : NSObject {
@private
BookmarkModel* bookmarkModel_; // weak; part of the profile owned by the
@@ -25,17 +34,32 @@ class Profile;
// Currently these two are always the same, but they mean slightly
// different things. contentAreaHasOffset_ is an implementation
// detail of bookmark bar visibility.
- BOOL contentAreaHasOffset_;
+ BOOL contentViewHasOffset_;
BOOL barIsVisible_;
- // TODO(jrg): write a BookmarkView
- IBOutlet ToolbarView* /* BookmarkView* */ bookmarkView_;
- IBOutlet NSView* contentArea_;
+ // The view of the bookmark bar itself.
+ // Not made into a scoped_nsobject since I may move it into a nib.
+ // (See TODO in initWithProfile: in bookmark_bar_controller.mm).
+ IBOutlet BookmarkBarView* bookmarkBarView_;
+
+ // The tab content area for the window (where the web goes)
+ IBOutlet NSView* contentView_;
+
+ // Bridge from Chrome-style C++ notifications (e.g. derived from
+ // BookmarkModelObserver)
+ scoped_ptr<BookmarkBarBridge> bridge_;
+
+ // Delegate which can open URLs for us.
+ id<BookmarkURLOpener> delegate_; // weak
}
-// Initializes the controller with the given browser profile and content view.
+// Initializes the controller with the given browser profile and
+// content view. We use |content| as a parent view for the bookmark
+// bar view and for geometry management. |delegate| is used for
+// opening URLs.
- (id)initWithProfile:(Profile*)profile
- contentArea:(NSView*)content;
+ contentView:(NSView*)content
+ delegate:(id<BookmarkURLOpener>)delegate;
// Resizes the bookmark bar based on the state of the content area.
- (void)resizeBookmarkBar;
@@ -48,6 +72,25 @@ class Profile;
@end
+// Redirects from BookmarkBarBridge, the C++ object which glues us to
+// the rest of Chromium. Internal to BookmarkBarController.
+@interface BookmarkBarController(BridgeRedirect)
+- (void)loaded:(BookmarkModel*)model;
+- (void)beingDeleted:(BookmarkModel*)model;
+- (void)nodeMoved:(BookmarkModel*)model
+ oldParent:(BookmarkNode*)oldParent oldIndex:(int)oldIndex
+ newParent:(BookmarkNode*)newParent newIndex:(int)newIndex;
+- (void)nodeAdded:(BookmarkModel*)model
+ parent:(BookmarkNode*)oldParent index:(int)index;
+- (void)nodeChanged:(BookmarkModel*)model
+ node:(BookmarkNode*)node;
+- (void)nodeFavIconLoaded:(BookmarkModel*)model
+ node:(BookmarkNode*)node;
+- (void)nodeChildrenReordered:(BookmarkModel*)model
+ node:(BookmarkNode*)node;
+@end
+
+
// These APIs should only be used by unit tests, in place of "friend" classes.
@interface BookmarkBarController(TestingAPI)
// Access to the bookmark bar's view represented by this controller.