| OLD | NEW |
| 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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
| 9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 if (renderWidgetHostView_->ShouldRouteEvent(event)) { | 2006 if (renderWidgetHostView_->ShouldRouteEvent(event)) { |
| 2007 renderWidgetHostView_->render_widget_host_->delegate() | 2007 renderWidgetHostView_->render_widget_host_->delegate() |
| 2008 ->GetInputEventRouter() | 2008 ->GetInputEventRouter() |
| 2009 ->RouteMouseEvent(renderWidgetHostView_.get(), &event); | 2009 ->RouteMouseEvent(renderWidgetHostView_.get(), &event); |
| 2010 } else { | 2010 } else { |
| 2011 renderWidgetHostView_->ProcessMouseEvent(event); | 2011 renderWidgetHostView_->ProcessMouseEvent(event); |
| 2012 } | 2012 } |
| 2013 } | 2013 } |
| 2014 | 2014 |
| 2015 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent { | 2015 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent { |
| 2016 NSLog(@"performKeyEquivalent: %@", theEvent); |
| 2016 // |performKeyEquivalent:| is sent to all views of a window, not only down the | 2017 // |performKeyEquivalent:| is sent to all views of a window, not only down the |
| 2017 // responder chain (cf. "Handling Key Equivalents" in | 2018 // responder chain (cf. "Handling Key Equivalents" in |
| 2018 // http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Event
Overview/HandlingKeyEvents/HandlingKeyEvents.html | 2019 // http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Event
Overview/HandlingKeyEvents/HandlingKeyEvents.html |
| 2019 // ). We only want to handle key equivalents if we're first responder. | 2020 // ). We only want to handle key equivalents if we're first responder. |
| 2020 if ([[self window] firstResponder] != self) | 2021 if ([[self window] firstResponder] != self) |
| 2021 return NO; | 2022 return NO; |
| 2022 | 2023 |
| 2023 // If the event is reserved by the system, then do not pass it to web content. | 2024 // If the event is reserved by the system, then do not pass it to web content. |
| 2024 if (EventIsReservedBySystem(theEvent)) | 2025 if (EventIsReservedBySystem(theEvent)) { |
| 2026 DLOG(INFO) << "BAIL! - it's reserved."; |
| 2025 return NO; | 2027 return NO; |
| 2028 } |
| 2026 | 2029 |
| 2027 // If we return |NO| from this function, cocoa will send the key event to | 2030 // If we return |NO| from this function, cocoa will send the key event to |
| 2028 // the menu and only if the menu does not process the event to |keyDown:|. We | 2031 // the menu and only if the menu does not process the event to |keyDown:|. We |
| 2029 // want to send the event to a renderer _before_ sending it to the menu, so | 2032 // want to send the event to a renderer _before_ sending it to the menu, so |
| 2030 // we need to return |YES| for all events that might be swallowed by the menu. | 2033 // we need to return |YES| for all events that might be swallowed by the menu. |
| 2031 // We do not return |YES| for every keypress because we don't get |keyDown:| | 2034 // We do not return |YES| for every keypress because we don't get |keyDown:| |
| 2032 // events for keys that we handle this way. | 2035 // events for keys that we handle this way. |
| 2033 NSUInteger modifierFlags = [theEvent modifierFlags]; | 2036 NSUInteger modifierFlags = [theEvent modifierFlags]; |
| 2034 if ((modifierFlags & NSCommandKeyMask) == 0) { | 2037 if ((modifierFlags & NSCommandKeyMask) == 0) { |
| 2035 // Make sure the menu does not contain key equivalents that don't | 2038 // Make sure the menu does not contain key equivalents that don't |
| (...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3407 | 3410 |
| 3408 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3411 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3409 // regions that are not draggable. (See ControlRegionView in | 3412 // regions that are not draggable. (See ControlRegionView in |
| 3410 // native_app_window_cocoa.mm). This requires the render host view to be | 3413 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3411 // draggable by default. | 3414 // draggable by default. |
| 3412 - (BOOL)mouseDownCanMoveWindow { | 3415 - (BOOL)mouseDownCanMoveWindow { |
| 3413 return YES; | 3416 return YES; |
| 3414 } | 3417 } |
| 3415 | 3418 |
| 3416 @end | 3419 @end |
| OLD | NEW |