Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm

Issue 1894903003: Mac: Fix SDK 10.11 Compile errors after clang roll in r387792 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mock BaseBubbleController Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/app/chrome_command_ids.h" // IDC_HISTORY_MENU 8 #include "chrome/app/chrome_command_ids.h" // IDC_HISTORY_MENU
8 #import "chrome/browser/app_controller_mac.h" 9 #import "chrome/browser/app_controller_mac.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/tab_restore_service_factory.h" 11 #include "chrome/browser/sessions/tab_restore_service_factory.h"
11 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
13 #include "chrome/browser/ui/browser_live_tab_context.h" 14 #include "chrome/browser/ui/browser_live_tab_context.h"
14 #include "chrome/browser/ui/browser_navigator.h" 15 #include "chrome/browser/ui/browser_navigator.h"
15 #include "chrome/browser/ui/browser_navigator_params.h" 16 #include "chrome/browser/ui/browser_navigator_params.h"
16 #include "components/history/core/browser/history_service.h" 17 #include "components/history/core/browser/history_service.h"
17 #include "components/history/core/browser/history_types.h" 18 #include "components/history/core/browser/history_types.h"
18 #include "components/sessions/core/tab_restore_service.h" 19 #include "components/sessions/core/tab_restore_service.h"
19 #import "ui/base/cocoa/cocoa_base_utils.h" 20 #import "ui/base/cocoa/cocoa_base_utils.h"
20 #include "ui/base/window_open_disposition.h" 21 #include "ui/base/window_open_disposition.h"
21 22
22 using content::OpenURLParams; 23 using content::OpenURLParams;
23 using content::Referrer; 24 using content::Referrer;
24 25
25 @implementation HistoryMenuCocoaController 26 @implementation HistoryMenuCocoaController
26 27
27 - (id)initWithBridge:(HistoryMenuBridge*)bridge { 28 - (id)initWithBridge:(HistoryMenuBridge*)bridge {
28 if ((self = [super init])) { 29 if ((self = [super init])) {
29 bridge_ = bridge; 30 bridge_ = bridge;
30 DCHECK(bridge_); 31 DCHECK(bridge_);
31 } 32 }
32 return self; 33 return self;
33 } 34 }
34 35
35 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { 36 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem {
36 AppController* controller = [NSApp delegate]; 37 AppController* controller =
38 base::mac::ObjCCastStrict<AppController>([NSApp delegate]);
37 return ![controller keyWindowIsModal]; 39 return ![controller keyWindowIsModal];
38 } 40 }
39 41
40 // 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.
41 - (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node { 43 - (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node {
42 // If this item can be restored using TabRestoreService, do so. Otherwise, 44 // If this item can be restored using TabRestoreService, do so. Otherwise,
43 // just load the URL. 45 // just load the URL.
44 sessions::TabRestoreService* service = 46 sessions::TabRestoreService* service =
45 TabRestoreServiceFactory::GetForProfile(bridge_->profile()); 47 TabRestoreServiceFactory::GetForProfile(bridge_->profile());
46 if (node->session_id && service) { 48 if (node->session_id && service) {
(...skipping 12 matching lines...) Expand all
59 } 61 }
60 } 62 }
61 63
62 - (IBAction)openHistoryMenuItem:(id)sender { 64 - (IBAction)openHistoryMenuItem:(id)sender {
63 const HistoryMenuBridge::HistoryItem* item = 65 const HistoryMenuBridge::HistoryItem* item =
64 bridge_->HistoryItemForMenuItem(sender); 66 bridge_->HistoryItemForMenuItem(sender);
65 [self openURLForItem:item]; 67 [self openURLForItem:item];
66 } 68 }
67 69
68 @end // HistoryMenuCocoaController 70 @end // HistoryMenuCocoaController
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/chrome_event_processing_window.mm ('k') | chrome/browser/ui/cocoa/info_bubble_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698