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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm

Issue 10662041: mac: Remove nav.pdf in favor of IDR_DEFAULT_FAVICON. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import <AppKit/AppKit.h> 5 #import <AppKit/AppKit.h>
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #import "chrome/browser/app_controller_mac.h" 9 #import "chrome/browser/app_controller_mac.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/ui/browser_list.h" 13 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" 14 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "grit/theme_resources_standard.h" 17 #include "grit/theme_resources_standard.h"
18 #include "grit/ui_resources_standard.h"
18 #include "skia/ext/skia_utils_mac.h" 19 #include "skia/ext/skia_utils_mac.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
22 #include "ui/gfx/mac/nsimage_cache.h" 23 #include "ui/gfx/mac/nsimage_cache.h"
23 24
24 BookmarkMenuBridge::BookmarkMenuBridge(Profile* profile, NSMenu* menu) 25 BookmarkMenuBridge::BookmarkMenuBridge(Profile* profile, NSMenu* menu)
25 : menuIsValid_(false), 26 : menuIsValid_(false),
26 profile_(profile), 27 profile_(profile),
27 controller_([[BookmarkMenuCocoaController alloc] initWithBridge:this 28 controller_([[BookmarkMenuCocoaController alloc] initWithBridge:this
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // Check to see if we have a favicon. 305 // Check to see if we have a favicon.
305 NSImage* favicon = nil; 306 NSImage* favicon = nil;
306 BookmarkModel* model = GetBookmarkModel(); 307 BookmarkModel* model = GetBookmarkModel();
307 if (model) { 308 if (model) {
308 const SkBitmap& bitmap = model->GetFavicon(node); 309 const SkBitmap& bitmap = model->GetFavicon(node);
309 if (!bitmap.isNull()) 310 if (!bitmap.isNull())
310 favicon = gfx::SkBitmapToNSImage(bitmap); 311 favicon = gfx::SkBitmapToNSImage(bitmap);
311 } 312 }
312 // Either we do not have a loaded favicon or the conversion from SkBitmap 313 // Either we do not have a loaded favicon or the conversion from SkBitmap
313 // failed. Use the default site image instead. 314 // failed. Use the default site image instead.
314 if (!favicon) 315 if (!favicon) {
315 favicon = gfx::GetCachedImageWithName(@"nav.pdf"); 316 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
317 favicon = rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON);
318 }
316 [item setImage:favicon]; 319 [item setImage:favicon];
317 } 320 }
318 321
319 NSMenuItem* BookmarkMenuBridge::MenuItemForNode(const BookmarkNode* node) { 322 NSMenuItem* BookmarkMenuBridge::MenuItemForNode(const BookmarkNode* node) {
320 if (!node) 323 if (!node)
321 return nil; 324 return nil;
322 std::map<const BookmarkNode*, NSMenuItem*>::iterator it = 325 std::map<const BookmarkNode*, NSMenuItem*>::iterator it =
323 bookmark_nodes_.find(node); 326 bookmark_nodes_.find(node);
324 if (it == bookmark_nodes_.end()) 327 if (it == bookmark_nodes_.end())
325 return nil; 328 return nil;
326 return it->second; 329 return it->second;
327 } 330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698