| OLD | NEW |
| 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/gfx/text_elider.h" | 5 #include "app/gfx/text_elider.h" |
| 6 #include "base/sys_string_conversions.h" | 6 #include "base/sys_string_conversions.h" |
| 7 #include "chrome/app/chrome_dll_resource.h" // IDC_* |
| 7 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 8 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/browser_list.h" |
| 9 #import "chrome/browser/cocoa/bookmark_menu_bridge.h" | 11 #import "chrome/browser/cocoa/bookmark_menu_bridge.h" |
| 10 #import "chrome/browser/cocoa/bookmark_menu_cocoa_controller.h" | 12 #import "chrome/browser/cocoa/bookmark_menu_cocoa_controller.h" |
| 11 #include "chrome/browser/cocoa/event_utils.h" | 13 #include "chrome/browser/cocoa/event_utils.h" |
| 12 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
| 14 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| 17 | 19 |
| 18 // Menus more than this many pixels wide will get trimmed | 20 // Menus more than this many pixels wide will get trimmed |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 NSInteger tag = [sender tag]; | 64 NSInteger tag = [sender tag]; |
| 63 int identifier = tag; | 65 int identifier = tag; |
| 64 const BookmarkNode* node = [self nodeForIdentifier:identifier]; | 66 const BookmarkNode* node = [self nodeForIdentifier:identifier]; |
| 65 DCHECK(node); | 67 DCHECK(node); |
| 66 if (!node) | 68 if (!node) |
| 67 return; // shouldn't be reached | 69 return; // shouldn't be reached |
| 68 | 70 |
| 69 [self openURLForNode:node]; | 71 [self openURLForNode:node]; |
| 70 } | 72 } |
| 71 | 73 |
| 74 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { |
| 75 if (Browser* browser = BrowserList::GetLastActive()) { |
| 76 return browser->command_updater()->IsCommandEnabled( |
| 77 IDC_BOOKMARK_MENU_CONTENTS) ? YES : NO; |
| 78 } |
| 79 // Enable bookmarks when there's no browser window. |
| 80 return YES; |
| 81 } |
| 82 |
| 72 @end // BookmarkMenuCocoaController | 83 @end // BookmarkMenuCocoaController |
| 73 | |
| OLD | NEW |