| OLD | NEW |
| 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 "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h" | 5 #import "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
| 8 #include "chrome/app/chrome_command_ids.h" // IDC_HISTORY_MENU | 8 #include "chrome/app/chrome_command_ids.h" // IDC_HISTORY_MENU |
| 9 #import "chrome/browser/app_controller_mac.h" | 9 #import "chrome/browser/app_controller_mac.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 - (id)initWithBridge:(HistoryMenuBridge*)bridge { | 27 - (id)initWithBridge:(HistoryMenuBridge*)bridge { |
| 28 if ((self = [super init])) { | 28 if ((self = [super init])) { |
| 29 bridge_ = bridge; | 29 bridge_ = bridge; |
| 30 DCHECK(bridge_); | 30 DCHECK(bridge_); |
| 31 } | 31 } |
| 32 return self; | 32 return self; |
| 33 } | 33 } |
| 34 | 34 |
| 35 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { | 35 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { |
| 36 AppController* controller = [NSApp delegate]; | 36 AppController* controller = [NSApp delegate]; |
| 37 return [controller keyWindowIsNotModal]; | 37 return ![controller keyWindowIsModal]; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Open the URL of the given history item in the current tab. | 40 // Open the URL of the given history item in the current tab. |
| 41 - (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node { | 41 - (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node { |
| 42 Browser* browser = | 42 Browser* browser = |
| 43 chrome::FindOrCreateTabbedBrowser(bridge_->profile(), | 43 chrome::FindOrCreateTabbedBrowser(bridge_->profile(), |
| 44 chrome::HOST_DESKTOP_TYPE_NATIVE); | 44 chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 45 WindowOpenDisposition disposition = | 45 WindowOpenDisposition disposition = |
| 46 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 46 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
| 47 | 47 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 - (IBAction)openHistoryMenuItem:(id)sender { | 64 - (IBAction)openHistoryMenuItem:(id)sender { |
| 65 const HistoryMenuBridge::HistoryItem* item = | 65 const HistoryMenuBridge::HistoryItem* item = |
| 66 bridge_->HistoryItemForMenuItem(sender); | 66 bridge_->HistoryItemForMenuItem(sender); |
| 67 [self openURLForItem:item]; | 67 [self openURLForItem:item]; |
| 68 } | 68 } |
| 69 | 69 |
| 70 @end // HistoryMenuCocoaController | 70 @end // HistoryMenuCocoaController |
| OLD | NEW |