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 #import "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.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/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Open the URL of the given history item in the current tab. | 42 // Open the URL of the given history item in the current tab. |
43 - (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node { | 43 - (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node { |
44 // If this item can be restored using TabRestoreService, do so. Otherwise, | 44 // If this item can be restored using TabRestoreService, do so. Otherwise, |
45 // just load the URL. | 45 // just load the URL. |
46 sessions::TabRestoreService* service = | 46 sessions::TabRestoreService* service = |
47 TabRestoreServiceFactory::GetForProfile(bridge_->profile()); | 47 TabRestoreServiceFactory::GetForProfile(bridge_->profile()); |
48 if (node->session_id && service) { | 48 if (node->session_id && service) { |
49 Browser* browser = chrome::FindTabbedBrowser(bridge_->profile(), false); | 49 Browser* browser = chrome::FindTabbedBrowser(bridge_->profile(), false); |
50 BrowserLiveTabContext* context = | 50 BrowserLiveTabContext* context = |
51 browser ? browser->live_tab_context() : NULL; | 51 browser ? browser->live_tab_context() : NULL; |
52 service->RestoreEntryById(context, node->session_id, UNKNOWN); | 52 service->RestoreEntryById(context, node->session_id, |
| 53 WindowOpenDisposition::UNKNOWN); |
53 } else { | 54 } else { |
54 DCHECK(node->url.is_valid()); | 55 DCHECK(node->url.is_valid()); |
55 WindowOpenDisposition disposition = | 56 WindowOpenDisposition disposition = |
56 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 57 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
57 chrome::NavigateParams params(bridge_->profile(), node->url, | 58 chrome::NavigateParams params(bridge_->profile(), node->url, |
58 ui::PAGE_TRANSITION_AUTO_BOOKMARK); | 59 ui::PAGE_TRANSITION_AUTO_BOOKMARK); |
59 params.disposition = disposition; | 60 params.disposition = disposition; |
60 chrome::Navigate(¶ms); | 61 chrome::Navigate(¶ms); |
61 } | 62 } |
62 } | 63 } |
63 | 64 |
64 - (IBAction)openHistoryMenuItem:(id)sender { | 65 - (IBAction)openHistoryMenuItem:(id)sender { |
65 const HistoryMenuBridge::HistoryItem* item = | 66 const HistoryMenuBridge::HistoryItem* item = |
66 bridge_->HistoryItemForMenuItem(sender); | 67 bridge_->HistoryItemForMenuItem(sender); |
67 [self openURLForItem:item]; | 68 [self openURLForItem:item]; |
68 } | 69 } |
69 | 70 |
70 @end // HistoryMenuCocoaController | 71 @end // HistoryMenuCocoaController |
OLD | NEW |