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

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

Issue 384039: Mac: Use native folder icons for the bookmark bar. (Closed)
Patch Set: GRRRRRRRRAAAAAAAAAHHHHH Created 11 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | 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 #include "app/l10n_util_mac.h" 5 #include "app/l10n_util_mac.h"
6 #include "app/resource_bundle.h" 6 #include "app/resource_bundle.h"
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/scoped_nsautorelease_pool.h" 8 #include "base/scoped_nsautorelease_pool.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_editor.h" 10 #include "chrome/browser/bookmarks/bookmark_editor.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 @end 61 @end
62 62
63 @implementation BookmarkBarController 63 @implementation BookmarkBarController
64 64
65 - (void)folderImageLoaded:(NSImage*)folderImage { 65 - (void)folderImageLoaded:(NSImage*)folderImage {
66 // The image loading thread retained |folderImage| already. 66 // The image loading thread retained |folderImage| already.
67 folderImage_.reset(folderImage); 67 folderImage_.reset(folderImage);
68 68
69 for (NSObject* item in itemsPendingBookmarkIcon_.get()) { 69 for (NSObject* item in itemsPendingBookmarkIcon_.get()) {
70 DCHECK([item respondsToSelector:@selector(setImage:)]); 70 DCHECK([item respondsToSelector:@selector(setImage:)]);
71 if ([item respondsToSelector:@selector(setImage:)]) { 71 if ([item retainCount] > 1 &&
72 [item respondsToSelector:@selector(setImage:)]) {
72 // |item| is not really of type |NSCell*|, but some type that responds to 73 // |item| is not really of type |NSCell*|, but some type that responds to
73 // |setImage:| is required to shut up a compiler warning. 74 // |setImage:| is required to shut up a compiler warning.
74 [(NSCell*)item setImage:folderImage_]; 75 [(NSCell*)item setImage:folderImage_];
75 } 76 }
76 } 77 }
77 itemsPendingBookmarkIcon_.reset(nil); 78 itemsPendingBookmarkIcon_.reset(nil);
78 } 79 }
79 80
80 - (void)loadFolderImage:(NSObject*)ignored { 81 - (void)loadFolderImage:(NSObject*)ignored {
81 base::ScopedNSAutoreleasePool pool; 82 base::ScopedNSAutoreleasePool pool;
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 } 944 }
944 945
945 const SkBitmap& favIcon = bookmarkModel_->GetFavIcon(node); 946 const SkBitmap& favIcon = bookmarkModel_->GetFavIcon(node);
946 if (!favIcon.isNull()) 947 if (!favIcon.isNull())
947 return gfx::SkBitmapToNSImage(favIcon); 948 return gfx::SkBitmapToNSImage(favIcon);
948 949
949 return defaultImage_; 950 return defaultImage_;
950 } 951 }
951 952
952 @end 953 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698