Chromium Code Reviews| 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/chrome_browser_application_mac.h" | 5 #import "chrome/browser/chrome_browser_application_mac.h" |
| 6 | 6 |
| 7 #include <objc/objc-exception.h> | 7 #include <objc/objc-exception.h> |
| 8 | 8 |
| 9 #import "base/auto_reset.h" | 9 #import "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 AppController* appController = static_cast<AppController*>([NSApp delegate]); | 259 AppController* appController = static_cast<AppController*>([NSApp delegate]); |
| 260 [appController tryToTerminateApplication:self]; | 260 [appController tryToTerminateApplication:self]; |
| 261 // Return, don't exit. The application is responsible for exiting on its own. | 261 // Return, don't exit. The application is responsible for exiting on its own. |
| 262 } | 262 } |
| 263 | 263 |
| 264 - (void)cancelTerminate:(id)sender { | 264 - (void)cancelTerminate:(id)sender { |
| 265 AppController* appController = static_cast<AppController*>([NSApp delegate]); | 265 AppController* appController = static_cast<AppController*>([NSApp delegate]); |
| 266 [appController stopTryingToTerminateApplication:self]; | 266 [appController stopTryingToTerminateApplication:self]; |
| 267 } | 267 } |
| 268 | 268 |
| 269 // The event |mask| has historically been declared as an NSUInteger | |
| 270 // (unsigned long). Starting in the 10.12 SDK, the mask type changed to | |
| 271 // NSEventMask (unsigned long long) if __LP64__ and NSUInteger otherwise. | |
| 272 // These types are incompatible, which creates an issue for suppporting | |
| 273 // both 10.10/10.11 and 10.12 SDKs. Work around it using the #if below. | |
| 274 - (NSEvent*)nextEventMatchingMask: | |
| 275 #if !defined(MAC_OS_X_VERSION_10_12) || \ | |
|
Mark Mentovai
2016/10/19 23:01:39
#include <AvailabilityMacros.h>
Robert Sesek
2016/10/19 23:22:12
Done.
| |
| 276 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 | |
|
Mark Mentovai
2016/10/19 23:01:39
Match what the SDK does by working __LP64__ into t
Robert Sesek
2016/10/19 23:22:12
That would be exciting. Done.
| |
| 277 (NSUInteger)mask | |
| 278 #else | |
| 279 (NSEventMask)mask | |
| 280 #endif | |
| 281 untilDate:(NSDate*)expiration | |
| 282 inMode:(NSString*)mode | |
| 283 dequeue:(BOOL)dequeue { | |
| 284 __block NSEvent* event = nil; | |
| 285 base::mac::CallWithEHFrame(^{ | |
| 286 event = [super nextEventMatchingMask:mask | |
| 287 untilDate:expiration | |
| 288 inMode:mode | |
| 289 dequeue:dequeue]; | |
| 290 }); | |
| 291 return event; | |
| 292 } | |
| 293 | |
| 269 - (BOOL)sendAction:(SEL)anAction to:(id)aTarget from:(id)sender { | 294 - (BOOL)sendAction:(SEL)anAction to:(id)aTarget from:(id)sender { |
| 270 // The Dock menu contains an automagic section where you can select | 295 // The Dock menu contains an automagic section where you can select |
| 271 // amongst open windows. If a window is closed via JavaScript while | 296 // amongst open windows. If a window is closed via JavaScript while |
| 272 // the menu is up, the menu item for that window continues to exist. | 297 // the menu is up, the menu item for that window continues to exist. |
| 273 // When a window is selected this method is called with the | 298 // When a window is selected this method is called with the |
| 274 // now-freed window as |aTarget|. Short-circuit the call if | 299 // now-freed window as |aTarget|. Short-circuit the call if |
| 275 // |aTarget| is not a valid window. | 300 // |aTarget| is not a valid window. |
| 276 if (anAction == @selector(_selectWindow:)) { | 301 if (anAction == @selector(_selectWindow:)) { |
| 277 // Not using -[NSArray containsObject:] because |aTarget| may be a | 302 // Not using -[NSArray containsObject:] because |aTarget| may be a |
| 278 // freed object. | 303 // freed object. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 - (void)_cycleWindowsReversed:(BOOL)arg1 { | 387 - (void)_cycleWindowsReversed:(BOOL)arg1 { |
| 363 base::AutoReset<BOOL> pin(&cyclingWindows_, YES); | 388 base::AutoReset<BOOL> pin(&cyclingWindows_, YES); |
| 364 [super _cycleWindowsReversed:arg1]; | 389 [super _cycleWindowsReversed:arg1]; |
| 365 } | 390 } |
| 366 | 391 |
| 367 - (BOOL)isCyclingWindows { | 392 - (BOOL)isCyclingWindows { |
| 368 return cyclingWindows_; | 393 return cyclingWindows_; |
| 369 } | 394 } |
| 370 | 395 |
| 371 @end | 396 @end |
| OLD | NEW |