| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // If this tab is no longer active, its window will be |nil|. In that case, | 326 // If this tab is no longer active, its window will be |nil|. In that case, |
| 327 // best ignore the event. | 327 // best ignore the event. |
| 328 if (![self window]) | 328 if (![self window]) |
| 329 return; | 329 return; |
| 330 ChromeEventProcessingWindow* window = | 330 ChromeEventProcessingWindow* window = |
| 331 (ChromeEventProcessingWindow*)[self window]; | 331 (ChromeEventProcessingWindow*)[self window]; |
| 332 DCHECK([window isKindOfClass:[ChromeEventProcessingWindow class]]); | 332 DCHECK([window isKindOfClass:[ChromeEventProcessingWindow class]]); |
| 333 | 333 |
| 334 // Do not fire shortcuts on key up. | 334 // Do not fire shortcuts on key up. |
| 335 if ([event type] == NSKeyDown) { | 335 if ([event type] == NSKeyDown) { |
| 336 // Send the event to the menu before sending it to the browser/window |
| 337 // shortcut handling, so that if a user configures cmd-left to mean |
| 338 // "previous tab", it takes precedence over the built-in "history back" |
| 339 // binding. Other than that, the |redispatchEvent| call would take care of |
| 340 // invoking the original menu item shortcut as well. |
| 341 if ([[NSApp mainMenu] performKeyEquivalent:event]) |
| 342 return; |
| 343 |
| 336 if ([window handleExtraBrowserKeyboardShortcut:event]) | 344 if ([window handleExtraBrowserKeyboardShortcut:event]) |
| 337 return; | 345 return; |
| 338 if ([window handleExtraWindowKeyboardShortcut:event]) | 346 if ([window handleExtraWindowKeyboardShortcut:event]) |
| 339 return; | 347 return; |
| 340 } | 348 } |
| 341 | 349 |
| 342 // We need to re-dispatch the event, so that it is sent to the menu or other | 350 // We need to re-dispatch the event, so that it is sent to the menu or other |
| 343 // cocoa mechanisms (such as the cmd-` handler). | 351 // cocoa mechanisms (such as the cmd-` handler). |
| 344 RenderWidgetHostViewCocoa* rwhv = static_cast<RenderWidgetHostViewCocoa*>( | 352 RenderWidgetHostViewCocoa* rwhv = static_cast<RenderWidgetHostViewCocoa*>( |
| 345 tabContentsView_->GetContentNativeView()); | 353 tabContentsView_->GetContentNativeView()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 } | 462 } |
| 455 | 463 |
| 456 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 464 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
| 457 return [dropTarget_ performDragOperation:sender view:self]; | 465 return [dropTarget_ performDragOperation:sender view:self]; |
| 458 } | 466 } |
| 459 | 467 |
| 460 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 468 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
| 461 // them into the C++ system. TODO(avi): all that jazz | 469 // them into the C++ system. TODO(avi): all that jazz |
| 462 | 470 |
| 463 @end | 471 @end |
| OLD | NEW |