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

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

Issue 11498008: RenderWidget popup should be a NSWindow so it can go outside the main window. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed cancelChildPopups Created 8 years 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 #import "base/auto_reset.h" 7 #import "base/auto_reset.h"
8 #import "base/logging.h" 8 #import "base/logging.h"
9 #include "base/mac/crash_logging.h" 9 #include "base/mac/crash_logging.h"
10 #import "base/mac/scoped_nsexception_enabler.h" 10 #import "base/mac/scoped_nsexception_enabler.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 + (void)initialize { 225 + (void)initialize {
226 // Turn all deallocated Objective-C objects into zombies, keeping 226 // Turn all deallocated Objective-C objects into zombies, keeping
227 // the most recent 10,000 of them on the treadmill. 227 // the most recent 10,000 of them on the treadmill.
228 ObjcEvilDoers::ZombieEnable(true, 10000); 228 ObjcEvilDoers::ZombieEnable(true, 10000);
229 } 229 }
230 230
231 - (id)init { 231 - (id)init {
232 SwizzleInit(); 232 SwizzleInit();
233 if ((self = [super init])) { 233 if ((self = [super init])) {
234 eventHooks_.reset([[NSMutableArray alloc] init]);
235 } 234 }
236 235
237 // Sanity check to alert if overridden methods are not supported. 236 // Sanity check to alert if overridden methods are not supported.
238 DCHECK([NSApplication 237 DCHECK([NSApplication
239 instancesRespondToSelector:@selector(_cycleWindowsReversed:)]); 238 instancesRespondToSelector:@selector(_cycleWindowsReversed:)]);
240 DCHECK([NSApplication 239 DCHECK([NSApplication
241 instancesRespondToSelector:@selector(_removeWindow:)]); 240 instancesRespondToSelector:@selector(_removeWindow:)]);
242 DCHECK([NSApplication 241 DCHECK([NSApplication
243 instancesRespondToSelector:@selector(_setKeyWindow:)]); 242 instancesRespondToSelector:@selector(_setKeyWindow:)]);
244 243
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 enableNSExceptions = true; 404 enableNSExceptions = true;
406 } 405 }
407 406
408 // Minimize the window by keeping this close to the super call. 407 // Minimize the window by keeping this close to the super call.
409 scoped_ptr<base::mac::ScopedNSExceptionEnabler> enabler(NULL); 408 scoped_ptr<base::mac::ScopedNSExceptionEnabler> enabler(NULL);
410 if (enableNSExceptions) 409 if (enableNSExceptions)
411 enabler.reset(new base::mac::ScopedNSExceptionEnabler()); 410 enabler.reset(new base::mac::ScopedNSExceptionEnabler());
412 return [super sendAction:anAction to:aTarget from:sender]; 411 return [super sendAction:anAction to:aTarget from:sender];
413 } 412 }
414 413
415 - (void)addEventHook:(id<CrApplicationEventHookProtocol>)handler {
416 [eventHooks_ addObject:handler];
417 }
418
419 - (void)removeEventHook:(id<CrApplicationEventHookProtocol>)handler {
420 [eventHooks_ removeObject:handler];
421 }
422
423 - (BOOL)isHandlingSendEvent { 414 - (BOOL)isHandlingSendEvent {
424 return handlingSendEvent_; 415 return handlingSendEvent_;
425 } 416 }
426 417
427 - (void)setHandlingSendEvent:(BOOL)handlingSendEvent { 418 - (void)setHandlingSendEvent:(BOOL)handlingSendEvent {
428 handlingSendEvent_ = handlingSendEvent; 419 handlingSendEvent_ = handlingSendEvent;
429 } 420 }
430 421
431 - (void)sendEvent:(NSEvent*)event {
432 base::mac::ScopedSendingEvent sendingEventScoper;
433 for (id<CrApplicationEventHookProtocol> handler in eventHooks_.get()) {
434 [handler hookForEvent:event];
435 }
436 [super sendEvent:event];
437 }
438
439 // NSExceptions which are caught by the event loop are logged here. 422 // NSExceptions which are caught by the event loop are logged here.
440 // NSException uses setjmp/longjmp, which can be very bad for C++, so 423 // NSException uses setjmp/longjmp, which can be very bad for C++, so
441 // we attempt to track and report them. 424 // we attempt to track and report them.
442 - (void)reportException:(NSException *)anException { 425 - (void)reportException:(NSException *)anException {
443 // If we throw an exception in this code, we can create an infinite 426 // If we throw an exception in this code, we can create an infinite
444 // loop. If we throw out of the if() without resetting 427 // loop. If we throw out of the if() without resetting
445 // |reportException|, we'll stop reporting exceptions for this run. 428 // |reportException|, we'll stop reporting exceptions for this run.
446 static BOOL reportingException = NO; 429 static BOOL reportingException = NO;
447 DCHECK(!reportingException); 430 DCHECK(!reportingException);
448 if (!reportingException) { 431 if (!reportingException) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 std::vector<NSWindow*>::iterator window_iterator = 551 std::vector<NSWindow*>::iterator window_iterator =
569 std::find(previousKeyWindows_.begin(), 552 std::find(previousKeyWindows_.begin(),
570 previousKeyWindows_.end(), 553 previousKeyWindows_.end(),
571 window); 554 window);
572 if (window_iterator != previousKeyWindows_.end()) { 555 if (window_iterator != previousKeyWindows_.end()) {
573 previousKeyWindows_.erase(window_iterator); 556 previousKeyWindows_.erase(window_iterator);
574 } 557 }
575 } 558 }
576 559
577 @end 560 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698