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

Side by Side Diff: chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.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 #include "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h" 5 #include "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/bundle_locations.h" 11 #include "base/mac/bundle_locations.h"
12 #include "base/mac/foundation_util.h" 12 #include "base/mac/foundation_util.h"
13 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
14 #include "base/mac/scoped_nsautorelease_pool.h" 14 #include "base/mac/scoped_nsautorelease_pool.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 #include "chrome/app/chrome_command_ids.h" // IDC_* 16 #include "chrome/app/chrome_command_ids.h" // IDC_*
17 #import "chrome/browser/app_controller_mac.h"
17 #include "chrome/browser/chrome_browser_application_mac.h" 18 #include "chrome/browser/chrome_browser_application_mac.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 20 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
20 #import "chrome/browser/ui/cocoa/panels/mouse_drag_controller.h" 21 #import "chrome/browser/ui/cocoa/panels/mouse_drag_controller.h"
21 #import "chrome/browser/ui/cocoa/panels/panel_cocoa.h" 22 #import "chrome/browser/ui/cocoa/panels/panel_cocoa.h"
22 #import "chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.h" 23 #import "chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.h"
23 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h" 24 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h"
24 #import "chrome/browser/ui/cocoa/sprite_view.h" 25 #import "chrome/browser/ui/cocoa/sprite_view.h"
25 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h" 26 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h"
26 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 27 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // items we care about have been set with the |-commandDispatch:| 332 // items we care about have been set with the |-commandDispatch:|
332 // action and a target of FirstResponder in IB. 333 // action and a target of FirstResponder in IB.
333 // Delegate to the NSApp delegate if Panel does not care about the command or 334 // Delegate to the NSApp delegate if Panel does not care about the command or
334 // shortcut, to make sure the global items in Chrome main app menu still work. 335 // shortcut, to make sure the global items in Chrome main app menu still work.
335 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { 336 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
336 if ([item action] == @selector(commandDispatch:)) { 337 if ([item action] == @selector(commandDispatch:)) {
337 NSInteger tag = [item tag]; 338 NSInteger tag = [item tag];
338 CommandUpdater* command_updater = windowShim_->panel()->command_updater(); 339 CommandUpdater* command_updater = windowShim_->panel()->command_updater();
339 if (command_updater->SupportsCommand(tag)) 340 if (command_updater->SupportsCommand(tag))
340 return command_updater->IsCommandEnabled(tag); 341 return command_updater->IsCommandEnabled(tag);
341 else 342
342 return [[NSApp delegate] validateUserInterfaceItem:item]; 343 AppController* appController =
344 base::mac::ObjCCastStrict<AppController>([NSApp delegate]);
345 return [appController validateUserInterfaceItem:item];
343 } 346 }
344 return NO; 347 return NO;
345 } 348 }
346 349
347 // Called when the user picks a menu or toolbar item when this window is key. 350 // Called when the user picks a menu or toolbar item when this window is key.
348 // Calls through to the panel object to execute the command or delegates up. 351 // Calls through to the panel object to execute the command or delegates up.
349 - (void)commandDispatch:(id)sender { 352 - (void)commandDispatch:(id)sender {
350 DCHECK(sender); 353 DCHECK(sender);
351 NSInteger tag = [sender tag]; 354 NSInteger tag = [sender tag];
352 CommandUpdater* command_updater = windowShim_->panel()->command_updater(); 355 CommandUpdater* command_updater = windowShim_->panel()->command_updater();
353 if (command_updater->SupportsCommand(tag)) 356 if (command_updater->SupportsCommand(tag)) {
354 windowShim_->panel()->ExecuteCommandIfEnabled(tag); 357 windowShim_->panel()->ExecuteCommandIfEnabled(tag);
355 else 358 } else {
356 [[NSApp delegate] commandDispatch:sender]; 359 AppController* appController =
360 base::mac::ObjCCastStrict<AppController>([NSApp delegate]);
361 [appController commandDispatch:sender];
362 }
357 } 363 }
358 364
359 // Handler for the custom Close button. 365 // Handler for the custom Close button.
360 - (void)closePanel { 366 - (void)closePanel {
361 windowShim_->panel()->Close(); 367 windowShim_->panel()->Close();
362 } 368 }
363 369
364 // Handler for the custom Minimize button. 370 // Handler for the custom Minimize button.
365 - (void)minimizeButtonClicked:(int)modifierFlags { 371 - (void)minimizeButtonClicked:(int)modifierFlags {
366 Panel* panel = windowShim_->panel(); 372 Panel* panel = windowShim_->panel();
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 if (![window canBecomeKeyWindow]) 946 if (![window canBecomeKeyWindow])
941 continue; 947 continue;
942 948
943 [window makeKeyWindow]; 949 [window makeKeyWindow];
944 } 950 }
945 return; 951 return;
946 } 952 }
947 } 953 }
948 954
949 @end 955 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/info_bubble_window_unittest.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698