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

Side by Side Diff: chrome/browser/chrome_browser_application_mac.mm

Issue 1233983004: Remove base/mac/scoped_nsexception_enabler.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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/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"
11 #include "base/debug/crash_logging.h" 11 #include "base/debug/crash_logging.h"
12 #include "base/debug/stack_trace.h" 12 #include "base/debug/stack_trace.h"
13 #import "base/logging.h" 13 #import "base/logging.h"
14 #include "base/mac/call_with_eh_frame.h" 14 #include "base/mac/call_with_eh_frame.h"
15 #import "base/mac/scoped_nsexception_enabler.h"
16 #import "base/mac/scoped_nsobject.h" 15 #import "base/mac/scoped_nsobject.h"
17 #import "base/mac/scoped_objc_class_swizzler.h" 16 #import "base/mac/scoped_objc_class_swizzler.h"
18 #import "base/metrics/histogram.h" 17 #import "base/metrics/histogram.h"
19 #include "base/profiler/scoped_tracker.h" 18 #include "base/profiler/scoped_tracker.h"
20 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
21 #import "base/strings/sys_string_conversions.h" 20 #import "base/strings/sys_string_conversions.h"
22 #import "chrome/browser/app_controller_mac.h" 21 #import "chrome/browser/app_controller_mac.h"
23 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 22 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
24 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/crash_keys.h" 24 #include "chrome/common/crash_keys.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } else if ([sender isKindOfClass:[NSMenuItem class]]) { 312 } else if ([sender isKindOfClass:[NSMenuItem class]]) {
314 tag = [sender tag]; 313 tag = [sender tag];
315 } 314 }
316 315
317 NSString* actionString = NSStringFromSelector(anAction); 316 NSString* actionString = NSStringFromSelector(anAction);
318 std::string value = base::StringPrintf("%s tag %ld sending %s to %p", 317 std::string value = base::StringPrintf("%s tag %ld sending %s to %p",
319 [[sender className] UTF8String], 318 [[sender className] UTF8String],
320 static_cast<long>(tag), 319 static_cast<long>(tag),
321 [actionString UTF8String], 320 [actionString UTF8String],
322 aTarget); 321 aTarget);
323
324 base::debug::ScopedCrashKey key(crash_keys::mac::kSendAction, value); 322 base::debug::ScopedCrashKey key(crash_keys::mac::kSendAction, value);
325 323
326 // Certain third-party code, such as print drivers, can still throw
327 // exceptions and Chromium cannot fix them. This provides a way to
328 // work around those on a spot basis.
329 bool enableNSExceptions = false;
330
331 // http://crbug.com/80686 , an Epson printer driver.
332 if (anAction == @selector(selectPDE:)) {
333 enableNSExceptions = true;
334 }
335
336 // Minimize the window by keeping this close to the super call.
337 scoped_ptr<base::mac::ScopedNSExceptionEnabler> enabler;
338 if (enableNSExceptions)
339 enabler.reset(new base::mac::ScopedNSExceptionEnabler());
340 return [super sendAction:anAction to:aTarget from:sender]; 324 return [super sendAction:anAction to:aTarget from:sender];
341 } 325 }
342 326
343 - (BOOL)isHandlingSendEvent { 327 - (BOOL)isHandlingSendEvent {
344 return handlingSendEvent_; 328 return handlingSendEvent_;
345 } 329 }
346 330
347 - (void)setHandlingSendEvent:(BOOL)handlingSendEvent { 331 - (void)setHandlingSendEvent:(BOOL)handlingSendEvent {
348 handlingSendEvent_ = handlingSendEvent; 332 handlingSendEvent_ = handlingSendEvent;
349 } 333 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 std::vector<NSWindow*>::iterator window_iterator = 487 std::vector<NSWindow*>::iterator window_iterator =
504 std::find(previousKeyWindows_.begin(), 488 std::find(previousKeyWindows_.begin(),
505 previousKeyWindows_.end(), 489 previousKeyWindows_.end(),
506 window); 490 window);
507 if (window_iterator != previousKeyWindows_.end()) { 491 if (window_iterator != previousKeyWindows_.end()) {
508 previousKeyWindows_.erase(window_iterator); 492 previousKeyWindows_.erase(window_iterator);
509 } 493 }
510 } 494 }
511 495
512 @end 496 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698