| 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 <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return methodDescription.name != NULL || methodDescription.types != NULL; | 151 return methodDescription.name != NULL || methodDescription.types != NULL; |
| 152 } | 152 } |
| 153 | 153 |
| 154 // Private methods: | 154 // Private methods: |
| 155 @interface RenderWidgetHostViewCocoa () | 155 @interface RenderWidgetHostViewCocoa () |
| 156 @property(nonatomic, assign) NSRange selectedRange; | 156 @property(nonatomic, assign) NSRange selectedRange; |
| 157 @property(nonatomic, assign) NSRange markedRange; | 157 @property(nonatomic, assign) NSRange markedRange; |
| 158 | 158 |
| 159 + (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event; | 159 + (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event; |
| 160 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r; | 160 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r; |
| 161 - (void)gotUnhandledWheelEvent; | 161 - (void)processedWheelEvent:(const blink::WebMouseWheelEvent&)event |
| 162 consumed:(BOOL)consumed; |
| 163 |
| 162 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right; | 164 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right; |
| 163 - (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar; | 165 - (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar; |
| 164 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv; | 166 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv; |
| 165 - (void)windowDidChangeBackingProperties:(NSNotification*)notification; | 167 - (void)windowDidChangeBackingProperties:(NSNotification*)notification; |
| 166 - (void)windowChangedGlobalFrame:(NSNotification*)notification; | 168 - (void)windowChangedGlobalFrame:(NSNotification*)notification; |
| 167 - (void)drawWithDirtyRect:(CGRect)dirtyRect | 169 - (void)drawWithDirtyRect:(CGRect)dirtyRect |
| 168 inContext:(CGContextRef)context; | 170 inContext:(CGContextRef)context; |
| 169 - (void)checkForPluginImeCancellation; | 171 - (void)checkForPluginImeCancellation; |
| 170 - (void)updateScreenProperties; | 172 - (void)updateScreenProperties; |
| 171 - (void)setResponderDelegate: | 173 - (void)setResponderDelegate: |
| (...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 mouse_locked_ = false; | 2027 mouse_locked_ = false; |
| 2026 | 2028 |
| 2027 // Unlock position of mouse cursor and unhide it. | 2029 // Unlock position of mouse cursor and unhide it. |
| 2028 CGAssociateMouseAndMouseCursorPosition(YES); | 2030 CGAssociateMouseAndMouseCursorPosition(YES); |
| 2029 [NSCursor unhide]; | 2031 [NSCursor unhide]; |
| 2030 | 2032 |
| 2031 if (render_widget_host_) | 2033 if (render_widget_host_) |
| 2032 render_widget_host_->LostMouseLock(); | 2034 render_widget_host_->LostMouseLock(); |
| 2033 } | 2035 } |
| 2034 | 2036 |
| 2035 void RenderWidgetHostViewMac::UnhandledWheelEvent( | 2037 void RenderWidgetHostViewMac::ProcessedWheelEvent( |
| 2036 const blink::WebMouseWheelEvent& event) { | 2038 const blink::WebMouseWheelEvent& event, |
| 2039 bool consumed) { |
| 2037 // Only record a wheel event as unhandled if JavaScript handlers got a chance | 2040 // Only record a wheel event as unhandled if JavaScript handlers got a chance |
| 2038 // to see it (no-op wheel events are ignored by the event dispatcher) | 2041 // to see it (no-op wheel events are ignored by the event dispatcher) |
| 2039 if (event.deltaX || event.deltaY) | 2042 if (event.deltaX || event.deltaY) |
| 2040 [cocoa_view_ gotUnhandledWheelEvent]; | 2043 [cocoa_view_ processedWheelEvent:event consumed:consumed]; |
| 2041 } | 2044 } |
| 2042 | 2045 |
| 2043 bool RenderWidgetHostViewMac::Send(IPC::Message* message) { | 2046 bool RenderWidgetHostViewMac::Send(IPC::Message* message) { |
| 2044 if (render_widget_host_) | 2047 if (render_widget_host_) |
| 2045 return render_widget_host_->Send(message); | 2048 return render_widget_host_->Send(message); |
| 2046 delete message; | 2049 delete message; |
| 2047 return false; | 2050 return false; |
| 2048 } | 2051 } |
| 2049 | 2052 |
| 2050 void RenderWidgetHostViewMac::SoftwareFrameWasFreed( | 2053 void RenderWidgetHostViewMac::SoftwareFrameWasFreed( |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2561 responderDelegate_.reset([delegate retain]); | 2564 responderDelegate_.reset([delegate retain]); |
| 2562 } | 2565 } |
| 2563 | 2566 |
| 2564 - (void)resetCursorRects { | 2567 - (void)resetCursorRects { |
| 2565 if (currentCursor_) { | 2568 if (currentCursor_) { |
| 2566 [self addCursorRect:[self visibleRect] cursor:currentCursor_]; | 2569 [self addCursorRect:[self visibleRect] cursor:currentCursor_]; |
| 2567 [currentCursor_ setOnMouseEntered:YES]; | 2570 [currentCursor_ setOnMouseEntered:YES]; |
| 2568 } | 2571 } |
| 2569 } | 2572 } |
| 2570 | 2573 |
| 2571 - (void)gotUnhandledWheelEvent { | 2574 - (void)processedWheelEvent:(const blink::WebMouseWheelEvent&)event |
| 2572 if (responderDelegate_ && | 2575 consumed:(BOOL)consumed { |
| 2573 [responderDelegate_ | 2576 [responderDelegate_ rendererHandledWheelEvent:event consumed:consumed]; |
| 2574 respondsToSelector:@selector(gotUnhandledWheelEvent)]) { | |
| 2575 [responderDelegate_ gotUnhandledWheelEvent]; | |
| 2576 } | |
| 2577 } | 2577 } |
| 2578 | 2578 |
| 2579 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right { | 2579 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right { |
| 2580 if (responderDelegate_ && | 2580 if (responderDelegate_ && |
| 2581 [responderDelegate_ | 2581 [responderDelegate_ |
| 2582 respondsToSelector:@selector(scrollOffsetPinnedToLeft:toRight:)]) { | 2582 respondsToSelector:@selector(scrollOffsetPinnedToLeft:toRight:)]) { |
| 2583 [responderDelegate_ scrollOffsetPinnedToLeft:left toRight:right]; | 2583 [responderDelegate_ scrollOffsetPinnedToLeft:left toRight:right]; |
| 2584 } | 2584 } |
| 2585 } | 2585 } |
| 2586 | 2586 |
| (...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4385 | 4385 |
| 4386 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 4386 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 4387 // regions that are not draggable. (See ControlRegionView in | 4387 // regions that are not draggable. (See ControlRegionView in |
| 4388 // native_app_window_cocoa.mm). This requires the render host view to be | 4388 // native_app_window_cocoa.mm). This requires the render host view to be |
| 4389 // draggable by default. | 4389 // draggable by default. |
| 4390 - (BOOL)mouseDownCanMoveWindow { | 4390 - (BOOL)mouseDownCanMoveWindow { |
| 4391 return YES; | 4391 return YES; |
| 4392 } | 4392 } |
| 4393 | 4393 |
| 4394 @end | 4394 @end |
| OLD | NEW |