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

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

Issue 3113028: Remove wstrings from bookmarks, part 8. (Closed)
Patch Set: Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/nsimage_cache_mac.h" 9 #include "base/nsimage_cache_mac.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #import "chrome/browser/app_controller_mac.h" 11 #import "chrome/browser/app_controller_mac.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 if (set_title) { 215 if (set_title) {
216 NSString* title = [BookmarkMenuCocoaController menuTitleForNode:node]; 216 NSString* title = [BookmarkMenuCocoaController menuTitleForNode:node];
217 [item setTitle:title]; 217 [item setTitle:title];
218 } 218 }
219 [item setTarget:controller_]; 219 [item setTarget:controller_];
220 [item setAction:@selector(openBookmarkMenuItem:)]; 220 [item setAction:@selector(openBookmarkMenuItem:)];
221 [item setTag:node->id()]; 221 [item setTag:node->id()];
222 // Add a tooltip 222 // Add a tooltip
223 std::string url_string = node->GetURL().possibly_invalid_spec(); 223 std::string url_string = node->GetURL().possibly_invalid_spec();
224 NSString* tooltip = [NSString stringWithFormat:@"%@\n%s", 224 NSString* tooltip = [NSString stringWithFormat:@"%@\n%s",
225 base::SysWideToNSString(node->GetTitle()), 225 base::SysUTF16ToNSString(node->GetTitleAsString16()),
226 url_string.c_str()]; 226 url_string.c_str()];
227 [item setToolTip:tooltip]; 227 [item setToolTip:tooltip];
228 228
229 // Check to see if we have a favicon. 229 // Check to see if we have a favicon.
230 NSImage* favicon = nil; 230 NSImage* favicon = nil;
231 BookmarkModel* model = GetBookmarkModel(); 231 BookmarkModel* model = GetBookmarkModel();
232 if (model) { 232 if (model) {
233 const SkBitmap& bitmap = model->GetFavIcon(node); 233 const SkBitmap& bitmap = model->GetFavIcon(node);
234 if (!bitmap.isNull()) 234 if (!bitmap.isNull())
235 favicon = gfx::SkBitmapToNSImage(bitmap); 235 favicon = gfx::SkBitmapToNSImage(bitmap);
236 } 236 }
237 // Either we do not have a loaded favicon or the conversion from SkBitmap 237 // Either we do not have a loaded favicon or the conversion from SkBitmap
238 // failed. Use the default site image instead. 238 // failed. Use the default site image instead.
239 if (!favicon) 239 if (!favicon)
240 favicon = nsimage_cache::ImageNamed(@"nav.pdf"); 240 favicon = nsimage_cache::ImageNamed(@"nav.pdf");
241 [item setImage:favicon]; 241 [item setImage:favicon];
242 } 242 }
243 243
244 NSMenuItem* BookmarkMenuBridge::MenuItemForNode(const BookmarkNode* node) { 244 NSMenuItem* BookmarkMenuBridge::MenuItemForNode(const BookmarkNode* node) {
245 if (!node) 245 if (!node)
246 return nil; 246 return nil;
247 std::map<const BookmarkNode*, NSMenuItem*>::iterator it = 247 std::map<const BookmarkNode*, NSMenuItem*>::iterator it =
248 bookmark_nodes_.find(node); 248 bookmark_nodes_.find(node);
249 if (it == bookmark_nodes_.end()) 249 if (it == bookmark_nodes_.end())
250 return nil; 250 return nil;
251 return it->second; 251 return it->second;
252 } 252 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_folder_target.mm ('k') | chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698