| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" | 7 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" |
| 8 | 8 |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 IDS_BOOMARK_BAR_OPEN_INCOGNITO, | 268 IDS_BOOMARK_BAR_OPEN_INCOGNITO, |
| 269 node, menu, enabled); | 269 node, menu, enabled); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 void BookmarkMenuBridge::AddItemToMenu(int command_id, | 273 void BookmarkMenuBridge::AddItemToMenu(int command_id, |
| 274 int message_id, | 274 int message_id, |
| 275 const BookmarkNode* node, | 275 const BookmarkNode* node, |
| 276 NSMenu* menu, | 276 NSMenu* menu, |
| 277 bool enabled) { | 277 bool enabled) { |
| 278 NSString* title = l10n_util::GetNSString(message_id); | 278 NSString* title = l10n_util::GetNSStringWithFixup(message_id); |
| 279 SEL action; | 279 SEL action; |
| 280 if (!enabled) { | 280 if (!enabled) { |
| 281 // A nil action makes a menu item appear disabled. NSMenuItem setEnabled | 281 // A nil action makes a menu item appear disabled. NSMenuItem setEnabled |
| 282 // will not reflect the disabled state until the item title is set again. | 282 // will not reflect the disabled state until the item title is set again. |
| 283 action = nil; | 283 action = nil; |
| 284 } else if (command_id == IDC_BOOKMARK_BAR_OPEN_ALL) { | 284 } else if (command_id == IDC_BOOKMARK_BAR_OPEN_ALL) { |
| 285 action = @selector(openAllBookmarks:); | 285 action = @selector(openAllBookmarks:); |
| 286 } else if (command_id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW) { | 286 } else if (command_id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW) { |
| 287 action = @selector(openAllBookmarksNewWindow:); | 287 action = @selector(openAllBookmarksNewWindow:); |
| 288 } else { | 288 } else { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 324 |
| 325 NSMenuItem* BookmarkMenuBridge::MenuItemForNode(const BookmarkNode* node) { | 325 NSMenuItem* BookmarkMenuBridge::MenuItemForNode(const BookmarkNode* node) { |
| 326 if (!node) | 326 if (!node) |
| 327 return nil; | 327 return nil; |
| 328 std::map<const BookmarkNode*, NSMenuItem*>::iterator it = | 328 std::map<const BookmarkNode*, NSMenuItem*>::iterator it = |
| 329 bookmark_nodes_.find(node); | 329 bookmark_nodes_.find(node); |
| 330 if (it == bookmark_nodes_.end()) | 330 if (it == bookmark_nodes_.end()) |
| 331 return nil; | 331 return nil; |
| 332 return it->second; | 332 return it->second; |
| 333 } | 333 } |
| OLD | NEW |