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

Unified Diff: chrome/browser/tab_contents/tab_contents_view_mac.mm

Issue 400012: Refactor the keyboard events handling code related to RenderViewHostDelegate:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view_mac.h ('k') | chrome/browser/views/frame/browser_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents_view_mac.mm
===================================================================
--- chrome/browser/tab_contents/tab_contents_view_mac.mm (revision 34219)
+++ chrome/browser/tab_contents/tab_contents_view_mac.mm (working copy)
@@ -47,7 +47,6 @@
@interface TabContentsViewCocoa (Private)
- (id)initWithTabContentsViewMac:(TabContentsViewMac*)w;
-- (BOOL)processKeyboardEvent:(NativeWebKeyboardEvent*)event;
- (void)registerDragTypes;
- (void)setCurrentDragOperation:(NSDragOperation)operation;
- (void)startDragWithDropData:(const WebDropData&)dropData
@@ -231,12 +230,6 @@
}
}
-bool TabContentsViewMac::HandleKeyboardEvent(
- const NativeWebKeyboardEvent& event) {
- return [cocoa_view_.get() processKeyboardEvent:
- const_cast<NativeWebKeyboardEvent*>(&event)] == YES;
-}
-
void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) {
RenderViewContextMenuMac menu(tab_contents(),
params,
@@ -355,48 +348,6 @@
return tabContentsView_->tab_contents();
}
-- (BOOL)processKeyboardEvent:(NativeWebKeyboardEvent*)wkEvent {
- if (wkEvent->skip_in_browser || wkEvent->type == WebKit::WebInputEvent::Char)
- return NO;
-
- NSEvent* event = wkEvent->os_event;
- DCHECK(event != NULL);
-
- // If this tab is no longer active, its window will be |nil|. In that case,
- // best ignore the event.
- if (![self window])
- return NO;
- ChromeEventProcessingWindow* window =
- (ChromeEventProcessingWindow*)[self window];
- DCHECK([window isKindOfClass:[ChromeEventProcessingWindow class]]);
-
- // Do not fire shortcuts on key up.
- if ([event type] == NSKeyDown) {
- // Send the event to the menu before sending it to the browser/window
- // shortcut handling, so that if a user configures cmd-left to mean
- // "previous tab", it takes precedence over the built-in "history back"
- // binding. Other than that, the |redispatchEvent| call would take care of
- // invoking the original menu item shortcut as well.
- if ([[NSApp mainMenu] performKeyEquivalent:event])
- return YES;
-
- if ([window handleExtraBrowserKeyboardShortcut:event])
- return YES;
- if ([window handleExtraWindowKeyboardShortcut:event])
- return YES;
- }
-
- // We need to re-dispatch the event, so that it is sent to the menu or other
- // cocoa mechanisms (such as the cmd-` handler).
- RenderWidgetHostViewCocoa* rwhv = static_cast<RenderWidgetHostViewCocoa*>(
- tabContentsView_->GetContentNativeView());
- DCHECK([rwhv isKindOfClass:[RenderWidgetHostViewCocoa class]]);
- [rwhv setIgnoreKeyEvents:YES];
- BOOL eventHandled = [window redispatchEvent:event];
- [rwhv setIgnoreKeyEvents:NO];
- return eventHandled;
-}
-
- (void)mouseEvent:(NSEvent *)theEvent {
TabContents* tabContents = [self tabContents];
if (tabContents->delegate()) {
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view_mac.h ('k') | chrome/browser/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698