| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/chrome_event_processing_window.h" | 5 #import "chrome/browser/cocoa/chrome_event_processing_window.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/cocoa/browser_command_executor.h" | 8 #import "chrome/browser/cocoa/browser_command_executor.h" |
| 9 #import "chrome/browser/cocoa/browser_frame_view.h" | 9 #import "chrome/browser/cocoa/browser_frame_view.h" |
| 10 #import "chrome/browser/cocoa/tab_strip_controller.h" | 10 #import "chrome/browser/cocoa/tab_strip_controller.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // Handle per-window shortcuts like cmd-1, but do not handle browser-level | 62 // Handle per-window shortcuts like cmd-1, but do not handle browser-level |
| 63 // shortcuts like cmd-left (else, cmd-left would do history navigation even | 63 // shortcuts like cmd-left (else, cmd-left would do history navigation even |
| 64 // if e.g. the Omnibox has focus). | 64 // if e.g. the Omnibox has focus). |
| 65 if ([self handleExtraWindowKeyboardShortcut:event]) | 65 if ([self handleExtraWindowKeyboardShortcut:event]) |
| 66 return YES; | 66 return YES; |
| 67 return [super performKeyEquivalent:event]; | 67 return [super performKeyEquivalent:event]; |
| 68 } | 68 } |
| 69 | 69 |
| 70 - (BOOL)redispatchEvent:(NSEvent*)event { | 70 - (BOOL)redispatchEvent:(NSEvent*)event { |
| 71 DCHECK(event); | 71 DCHECK(event); |
| 72 DCHECK([event window] == self); | 72 DCHECK_EQ([event window], self); |
| 73 eventHandled_ = YES; | 73 eventHandled_ = YES; |
| 74 redispatchingEvent_ = YES; | 74 redispatchingEvent_ = YES; |
| 75 [NSApp sendEvent:event]; | 75 [NSApp sendEvent:event]; |
| 76 redispatchingEvent_ = NO; | 76 redispatchingEvent_ = NO; |
| 77 | 77 |
| 78 // If the event was not handled by [NSApp sendEvent:], the sendEvent: | 78 // If the event was not handled by [NSApp sendEvent:], the sendEvent: |
| 79 // method below will be called, and because |redispatchingEvent_| is YES, | 79 // method below will be called, and because |redispatchingEvent_| is YES, |
| 80 // |eventHandled_| will be set to NO. | 80 // |eventHandled_| will be set to NO. |
| 81 return eventHandled_; | 81 return eventHandled_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 - (void)sendEvent:(NSEvent*)event { | 84 - (void)sendEvent:(NSEvent*)event { |
| 85 if (!redispatchingEvent_) | 85 if (!redispatchingEvent_) |
| 86 [super sendEvent:event]; | 86 [super sendEvent:event]; |
| 87 else | 87 else |
| 88 eventHandled_ = NO; | 88 eventHandled_ = NO; |
| 89 } | 89 } |
| 90 | 90 |
| 91 @end // ChromeEventProcessingWindow | 91 @end // ChromeEventProcessingWindow |
| 92 | 92 |
| OLD | NEW |