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_window_controller.h" | 8 #import "chrome/browser/cocoa/browser_window_controller.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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 // Handle per-window shortcuts like cmd-1, but do not handle browser-level | 81 // Handle per-window shortcuts like cmd-1, but do not handle browser-level |
82 // shortcuts like cmd-left (else, cmd-left would do history navigation even | 82 // shortcuts like cmd-left (else, cmd-left would do history navigation even |
83 // if e.g. the Omnibox has focus). If the web has focus, don't do this here, | 83 // if e.g. the Omnibox has focus). If the web has focus, don't do this here, |
84 // since the web needs to get a chance at swallowing the event first. | 84 // since the web needs to get a chance at swallowing the event first. |
85 if ([self handleExtraWindowKeyboardShortcut:event]) | 85 if ([self handleExtraWindowKeyboardShortcut:event]) |
86 return YES; | 86 return YES; |
87 return [super performKeyEquivalent:event]; | 87 return [super performKeyEquivalent:event]; |
88 } | 88 } |
89 | 89 |
90 - (void)redispatchEvent:(NSEvent*)event { | 90 - (BOOL)redispatchEvent:(NSEvent*)event { |
91 DCHECK(event); | 91 DCHECK(event); |
92 DCHECK([event window] == self); | 92 DCHECK([event window] == self); |
| 93 eventHandled_ = YES; |
93 redispatchingEvent_ = YES; | 94 redispatchingEvent_ = YES; |
94 [NSApp sendEvent:event]; | 95 [NSApp sendEvent:event]; |
95 redispatchingEvent_ = NO; | 96 redispatchingEvent_ = NO; |
| 97 |
| 98 // If the event was not handled by [NSApp sendEvent:], the sendEvent: |
| 99 // method below will be called, and because |redispatchingEvent_| is YES, |
| 100 // |eventHandled_| will be set to NO. |
| 101 return eventHandled_; |
96 } | 102 } |
97 | 103 |
98 - (void)sendEvent:(NSEvent*)event { | 104 - (void)sendEvent:(NSEvent*)event { |
99 if (!redispatchingEvent_) | 105 if (!redispatchingEvent_) |
100 [super sendEvent:event]; | 106 [super sendEvent:event]; |
| 107 else |
| 108 eventHandled_ = NO; |
101 } | 109 } |
102 | 110 |
103 @end // ChromeEventProcessingWindow | 111 @end // ChromeEventProcessingWindow |
104 | 112 |
OLD | NEW |