| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/input/synthetic_gesture_target_mac.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_mac.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsautorelease_pool.h" | 7 #include "base/mac/scoped_nsautorelease_pool.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 9 | 9 |
| 10 // Unlike some event APIs, Apple does not provide a way to programmatically | 10 // Unlike some event APIs, Apple does not provide a way to programmatically |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 namespace content { | 71 namespace content { |
| 72 | 72 |
| 73 SyntheticGestureTargetMac::SyntheticGestureTargetMac( | 73 SyntheticGestureTargetMac::SyntheticGestureTargetMac( |
| 74 RenderWidgetHostImpl* host, | 74 RenderWidgetHostImpl* host, |
| 75 RenderWidgetHostViewCocoa* cocoa_view) | 75 RenderWidgetHostViewCocoa* cocoa_view) |
| 76 : SyntheticGestureTargetBase(host), cocoa_view_(cocoa_view) {} | 76 : SyntheticGestureTargetBase(host), cocoa_view_(cocoa_view) {} |
| 77 | 77 |
| 78 void SyntheticGestureTargetMac::DispatchInputEventToPlatform( | 78 void SyntheticGestureTargetMac::DispatchInputEventToPlatform( |
| 79 const WebInputEvent& event) { | 79 const WebInputEvent& event) { |
| 80 if (WebInputEvent::isGestureEventType(event.type)) { | 80 if (WebInputEvent::isGestureEventType(event.type())) { |
| 81 // Create an autorelease pool so that we clean up any synthetic events we | 81 // Create an autorelease pool so that we clean up any synthetic events we |
| 82 // generate. | 82 // generate. |
| 83 base::mac::ScopedNSAutoreleasePool pool; | 83 base::mac::ScopedNSAutoreleasePool pool; |
| 84 | 84 |
| 85 const WebGestureEvent* gesture_event = | 85 const WebGestureEvent* gesture_event = |
| 86 static_cast<const WebGestureEvent*>(&event); | 86 static_cast<const WebGestureEvent*>(&event); |
| 87 | 87 |
| 88 switch (event.type) { | 88 switch (event.type()) { |
| 89 case WebInputEvent::GesturePinchBegin: { | 89 case WebInputEvent::GesturePinchBegin: { |
| 90 id event = [SyntheticPinchEvent | 90 id event = [SyntheticPinchEvent |
| 91 eventWithMagnification:0.0f | 91 eventWithMagnification:0.0f |
| 92 locationInWindow:NSMakePoint(gesture_event->x, | 92 locationInWindow:NSMakePoint(gesture_event->x, |
| 93 gesture_event->y)]; | 93 gesture_event->y)]; |
| 94 [cocoa_view_ beginGestureWithEvent:event]; | 94 [cocoa_view_ beginGestureWithEvent:event]; |
| 95 return; | 95 return; |
| 96 } | 96 } |
| 97 case WebInputEvent::GesturePinchEnd: { | 97 case WebInputEvent::GesturePinchEnd: { |
| 98 id event = [SyntheticPinchEvent | 98 id event = [SyntheticPinchEvent |
| (...skipping 14 matching lines...) Expand all Loading... |
| 113 default: | 113 default: |
| 114 break; | 114 break; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 // This event wasn't handled yet, forward to the base class. | 118 // This event wasn't handled yet, forward to the base class. |
| 119 SyntheticGestureTargetBase::DispatchInputEventToPlatform(event); | 119 SyntheticGestureTargetBase::DispatchInputEventToPlatform(event); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace content | 122 } // namespace content |
| OLD | NEW |