| 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 "chrome/app/chrome_dll_resource.h" // IDC_HISTORY_MENU | 5 #include "chrome/app/chrome_dll_resource.h" // IDC_* |
| 6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
| 7 #import "chrome/browser/cocoa/history_menu_cocoa_controller.h" | 7 #import "chrome/browser/cocoa/history_menu_cocoa_controller.h" |
| 8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/cocoa/event_utils.h" | 10 #include "chrome/browser/cocoa/event_utils.h" |
| 11 #include "chrome/browser/history/history.h" | 11 #include "chrome/browser/history/history.h" |
| 12 #include "chrome/browser/history/history_types.h" | 12 #include "chrome/browser/history/history_types.h" |
| 13 #include "chrome/browser/tab_contents/tab_contents.h" | 13 #include "chrome/browser/tab_contents/tab_contents.h" |
| 14 #include "webkit/glue/window_open_disposition.h" | 14 #include "webkit/glue/window_open_disposition.h" |
| 15 | 15 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 return (*results)[index]; | 52 return (*results)[index]; |
| 53 } | 53 } |
| 54 | 54 |
| 55 - (IBAction)openHistoryMenuItem:(id)sender { | 55 - (IBAction)openHistoryMenuItem:(id)sender { |
| 56 NSInteger tag = [sender tag]; | 56 NSInteger tag = [sender tag]; |
| 57 HistoryMenuBridge::HistoryItem item = [self itemForTag:tag]; | 57 HistoryMenuBridge::HistoryItem item = [self itemForTag:tag]; |
| 58 DCHECK(item.url.is_valid()); | 58 DCHECK(item.url.is_valid()); |
| 59 [self openURLForItem:item]; | 59 [self openURLForItem:item]; |
| 60 } | 60 } |
| 61 | 61 |
| 62 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { |
| 63 if (Browser* browser = BrowserList::GetLastActive()) { |
| 64 return browser->command_updater()->IsCommandEnabled( |
| 65 IDC_HISTORY_MENU_CONTENTS) ? YES : NO; |
| 66 } |
| 67 // Enable history items when there's no browser window. |
| 68 return YES; |
| 69 } |
| 70 |
| 62 @end // HistoryMenuCocoaController | 71 @end // HistoryMenuCocoaController |
| OLD | NEW |