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

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_target_mac.mm

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Fix nits Created 3 years, 11 months 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698