summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_bar_controller.mm
diff options
context:
space:
mode:
authormunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 22:29:20 +0000
committermunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 22:29:20 +0000
commitb3c33d463366d2725ec4d669b98dc468a751c541 (patch)
treed8496a8ae8fc73ed71b93d67c055e9f1bba4fcc7 /chrome/browser/cocoa/bookmark_bar_controller.mm
parent7b91dfd0bce7b4f864d9654e8bd0a9f93683cec0 (diff)
downloadchromium_src-b3c33d463366d2725ec4d669b98dc468a751c541.zip
chromium_src-b3c33d463366d2725ec4d669b98dc468a751c541.tar.gz
chromium_src-b3c33d463366d2725ec4d669b98dc468a751c541.tar.bz2
Make bookmark model public interface use const BookmarkNode* instead of
BookmarkNode*. This helps in making the BookmarkNode class setters public also without worrying about someone inadvertently changing BookmarkNode properties directly for bookmark model bookmarks. Change all the call sites to reflect this. BUG=none TEST=none Review URL: http://codereview.chromium.org/146116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_controller.mm')
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.mm27
1 files changed, 13 insertions, 14 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm
index ad92820..e3a4bed 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller.mm
@@ -143,15 +143,14 @@ const CGFloat kBookmarkHorizontalPadding = 8.0;
// TODO(jrg): add an openBookmarkInBackground() for ctrl-click which
// has a different disposition.
- (void)openBookmark:(id)sender {
- BookmarkNode* node = static_cast<BookmarkNode*>([[[sender cell]
- representedObject]
- pointerValue]);
+ const BookmarkNode* node = static_cast<const BookmarkNode*>(
+ [[[sender cell]representedObject]pointerValue]);
DCHECK(node);
[delegate_ openBookmarkURL:node->GetURL() disposition:CURRENT_TAB];
}
// Return an autoreleased NSCell suitable for a bookmark button.
-- (NSCell *)cellForBookmarkNode:(BookmarkNode*)node frame:(NSRect)frame {
+- (NSCell *)cellForBookmarkNode:(const BookmarkNode*)node frame:(NSRect)frame {
NSString* title = base::SysWideToNSString(node->GetTitle());
NSButtonCell *cell = [[[BookmarkButtonCell alloc] initTextCell:nil]
autorelease];
@@ -212,9 +211,9 @@ const CGFloat kBookmarkHorizontalPadding = 8.0;
// TODO(jrg): write a "build bar" so there is a nice spot for things
// like the contextual menu which is invoked when not over a
// bookmark. On Safari that menu has a "new folder" option.
-- (void)addNodesToBar:(BookmarkNode*)node {
+- (void)addNodesToBar:(const BookmarkNode*)node {
for (int i = 0; i < node->GetChildCount(); i++) {
- BookmarkNode* child = node->GetChild(i);
+ const BookmarkNode* child = node->GetChild(i);
NSRect frame = [self frameForBookmarkAtIndex:i];
NSButton* button = [[[NSButton alloc] initWithFrame:frame]
@@ -255,7 +254,7 @@ const CGFloat kBookmarkHorizontalPadding = 8.0;
if ((barIsVisible_ == NO) || !model->IsLoaded())
return;
// Else brute force nuke and build.
- BookmarkNode* node = model->GetBookmarkBarNode();
+ const BookmarkNode* node = model->GetBookmarkBarNode();
[self clearBookmarkBar];
[self addNodesToBar:node];
}
@@ -266,32 +265,32 @@ const CGFloat kBookmarkHorizontalPadding = 8.0;
// TODO(jrg): for now this is brute force.
- (void)nodeMoved:(BookmarkModel*)model
- oldParent:(BookmarkNode*)oldParent oldIndex:(int)oldIndex
- newParent:(BookmarkNode*)newParent newIndex:(int)newIndex {
+ oldParent:(const BookmarkNode*)oldParent oldIndex:(int)oldIndex
+ newParent:(const BookmarkNode*)newParent newIndex:(int)newIndex {
[self loaded:model];
}
// TODO(jrg): for now this is brute force.
- (void)nodeAdded:(BookmarkModel*)model
- parent:(BookmarkNode*)oldParent index:(int)index {
+ parent:(const BookmarkNode*)oldParent index:(int)index {
[self loaded:model];
}
// TODO(jrg): for now this is brute force.
- (void)nodeChanged:(BookmarkModel*)model
- node:(BookmarkNode*)node {
+ node:(const BookmarkNode*)node {
[self loaded:model];
}
// TODO(jrg): linear searching is bad.
// Need a BookmarkNode-->NSCell mapping.
- (void)nodeFavIconLoaded:(BookmarkModel*)model
- node:(BookmarkNode*)node {
+ node:(const BookmarkNode*)node {
NSArray* views = [bookmarkBarView_ subviews];
for (NSButton* button in views) {
NSButtonCell* cell = [button cell];
void* pointer = [[cell representedObject] pointerValue];
- BookmarkNode* cellnode = static_cast<BookmarkNode*>(pointer);
+ const BookmarkNode* cellnode = static_cast<const BookmarkNode*>(pointer);
if (cellnode == node) {
NSImage* image = gfx::SkBitmapToNSImage(bookmarkModel_->GetFavIcon(node));
if (image) {
@@ -305,7 +304,7 @@ const CGFloat kBookmarkHorizontalPadding = 8.0;
// TODO(jrg): for now this is brute force.
- (void)nodeChildrenReordered:(BookmarkModel*)model
- node:(BookmarkNode*)node {
+ node:(const BookmarkNode*)node {
[self loaded:model];
}