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

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

Issue 260012: Use more images from the pak files... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
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 "base/mac_util.h" 7 #include "base/mac_util.h"
7 #include "base/nsimage_cache_mac.h" 8 #include "base/nsimage_cache_mac.h"
8 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_editor.h" 10 #include "chrome/browser/bookmarks/bookmark_editor.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 11 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/browser.h" 12 #include "chrome/browser/browser.h"
12 #include "chrome/browser/browser_list.h" 13 #include "chrome/browser/browser_list.h"
13 #import "chrome/browser/cocoa/bookmark_bar_bridge.h" 14 #import "chrome/browser/cocoa/bookmark_bar_bridge.h"
14 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 15 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
15 #import "chrome/browser/cocoa/bookmark_bar_view.h" 16 #import "chrome/browser/cocoa/bookmark_bar_view.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 bundle:mac_util::MainAppBundle()])) { 77 bundle:mac_util::MainAppBundle()])) {
77 browser_ = browser; 78 browser_ = browser;
78 initialWidth_ = initialWidth; 79 initialWidth_ = initialWidth;
79 bookmarkModel_ = browser_->profile()->GetBookmarkModel(); 80 bookmarkModel_ = browser_->profile()->GetBookmarkModel();
80 buttons_.reset([[NSMutableArray alloc] init]); 81 buttons_.reset([[NSMutableArray alloc] init]);
81 compressDelegate_ = compressDelegate; 82 compressDelegate_ = compressDelegate;
82 resizeDelegate_ = resizeDelegate; 83 resizeDelegate_ = resizeDelegate;
83 urlDelegate_ = urlDelegate; 84 urlDelegate_ = urlDelegate;
84 tabObserver_.reset( 85 tabObserver_.reset(
85 new TabStripModelObserverBridge(browser_->tabstrip_model(), self)); 86 new TabStripModelObserverBridge(browser_->tabstrip_model(), self));
87
88 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
89 folderImage_.reset([rb.GetNSImageNamed(IDR_BOOKMARK_BAR_FOLDER) retain]);
86 } 90 }
87 return self; 91 return self;
88 } 92 }
89 93
90 - (void)dealloc { 94 - (void)dealloc {
91 bridge_.reset(NULL); 95 bridge_.reset(NULL);
92 [[NSNotificationCenter defaultCenter] removeObserver:self]; 96 [[NSNotificationCenter defaultCenter] removeObserver:self];
93 [super dealloc]; 97 [super dealloc];
94 } 98 }
95 99
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // TODO(jrg): move much of the cell config into the BookmarkButtonCell class. 510 // TODO(jrg): move much of the cell config into the BookmarkButtonCell class.
507 - (NSCell*)cellForBookmarkNode:(const BookmarkNode*)node { 511 - (NSCell*)cellForBookmarkNode:(const BookmarkNode*)node {
508 NSString* title = base::SysWideToNSString(node->GetTitle()); 512 NSString* title = base::SysWideToNSString(node->GetTitle());
509 NSButtonCell *cell = [[[BookmarkButtonCell alloc] initTextCell:nil] 513 NSButtonCell *cell = [[[BookmarkButtonCell alloc] initTextCell:nil]
510 autorelease]; 514 autorelease];
511 DCHECK(cell); 515 DCHECK(cell);
512 [cell setRepresentedObject:[NSValue valueWithPointer:node]]; 516 [cell setRepresentedObject:[NSValue valueWithPointer:node]];
513 517
514 NSImage* image = NULL; 518 NSImage* image = NULL;
515 if (node->is_folder()) { 519 if (node->is_folder()) {
516 image = nsimage_cache::ImageNamed(@"bookmark_bar_folder.png"); 520 image = folderImage_;
517 } else { 521 } else {
518 const SkBitmap& favicon = bookmarkModel_->GetFavIcon(node); 522 const SkBitmap& favicon = bookmarkModel_->GetFavIcon(node);
519 if (!favicon.isNull()) { 523 if (!favicon.isNull()) {
520 image = gfx::SkBitmapToNSImage(favicon); 524 image = gfx::SkBitmapToNSImage(favicon);
521 } 525 }
522 } 526 }
523 if (image) { 527 if (image) {
524 [cell setImage:image]; 528 [cell setImage:image];
525 [cell setImagePosition:NSImageLeft]; 529 [cell setImagePosition:NSImageLeft];
526 } 530 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 723
720 - (void)setUrlDelegate:(id<BookmarkURLOpener>)urlDelegate { 724 - (void)setUrlDelegate:(id<BookmarkURLOpener>)urlDelegate {
721 urlDelegate_ = urlDelegate; 725 urlDelegate_ = urlDelegate;
722 } 726 }
723 727
724 - (NSArray*)buttons { 728 - (NSArray*)buttons {
725 return buttons_.get(); 729 return buttons_.get();
726 } 730 }
727 731
728 @end 732 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.h ('k') | chrome/browser/cocoa/download_item_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698