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

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_target_aura.cc

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_aura.h" 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h"
6 6
7 #include "content/browser/renderer_host/render_widget_host_impl.h" 7 #include "content/browser/renderer_host/render_widget_host_impl.h"
8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
9 #include "content/browser/renderer_host/ui_events_helper.h" 9 #include "content/browser/renderer_host/ui_events_helper.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 13 matching lines...) Expand all
24 void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform( 24 void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform(
25 const WebTouchEvent& web_touch, 25 const WebTouchEvent& web_touch,
26 const ui::LatencyInfo& latency_info) { 26 const ui::LatencyInfo& latency_info) {
27 TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info); 27 TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info);
28 ScopedVector<ui::TouchEvent> events; 28 ScopedVector<ui::TouchEvent> events;
29 bool conversion_success = MakeUITouchEventsFromWebTouchEvents( 29 bool conversion_success = MakeUITouchEventsFromWebTouchEvents(
30 touch_with_latency, &events, LOCAL_COORDINATES); 30 touch_with_latency, &events, LOCAL_COORDINATES);
31 DCHECK(conversion_success); 31 DCHECK(conversion_success);
32 32
33 aura::Window* window = GetWindow(); 33 aura::Window* window = GetWindow();
34 aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); 34 aura::WindowTreeHost* host = window->GetHost();
35 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), 35 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(),
36 end = events.end(); iter != end; ++iter) { 36 end = events.end(); iter != end; ++iter) {
37 (*iter)->ConvertLocationToTarget(window, dispatcher->window()); 37 (*iter)->ConvertLocationToTarget(window, host->window());
38 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(*iter); 38 ui::EventDispatchDetails details =
39 host->dispatcher()->OnEventFromSource(*iter);
39 if (details.dispatcher_destroyed) 40 if (details.dispatcher_destroyed)
40 break; 41 break;
41 } 42 }
42 } 43 }
43 44
44 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( 45 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform(
45 const blink::WebMouseWheelEvent& web_wheel, 46 const blink::WebMouseWheelEvent& web_wheel,
46 const ui::LatencyInfo&) { 47 const ui::LatencyInfo&) {
47 gfx::Point location(web_wheel.x, web_wheel.y); 48 gfx::Point location(web_wheel.x, web_wheel.y);
48 ui::MouseEvent mouse_event( 49 ui::MouseEvent mouse_event(
49 ui::ET_MOUSEWHEEL, location, location, ui::EF_NONE, ui::EF_NONE); 50 ui::ET_MOUSEWHEEL, location, location, ui::EF_NONE, ui::EF_NONE);
50 ui::MouseWheelEvent wheel_event( 51 ui::MouseWheelEvent wheel_event(
51 mouse_event, web_wheel.deltaX, web_wheel.deltaY); 52 mouse_event, web_wheel.deltaX, web_wheel.deltaY);
52 53
53 aura::Window* window = GetWindow(); 54 aura::Window* window = GetWindow();
54 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow()); 55 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow());
55 ui::EventDispatchDetails details = 56 ui::EventDispatchDetails details =
56 window->GetDispatcher()->OnEventFromSource(&wheel_event); 57 window->GetHost()->dispatcher()->OnEventFromSource(&wheel_event);
57 if (details.dispatcher_destroyed) 58 if (details.dispatcher_destroyed)
58 return; 59 return;
59 } 60 }
60 61
61 namespace { 62 namespace {
62 63
63 ui::EventType 64 ui::EventType
64 WebMouseEventTypeToEventType(blink::WebInputEvent::Type web_type) { 65 WebMouseEventTypeToEventType(blink::WebInputEvent::Type web_type) {
65 switch (web_type) { 66 switch (web_type) {
66 case blink::WebInputEvent::MouseDown: 67 case blink::WebInputEvent::MouseDown:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const blink::WebMouseEvent& web_mouse, 114 const blink::WebMouseEvent& web_mouse,
114 const ui::LatencyInfo& latency_info) { 115 const ui::LatencyInfo& latency_info) {
115 gfx::Point location(web_mouse.x, web_mouse.y); 116 gfx::Point location(web_mouse.x, web_mouse.y);
116 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type); 117 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type);
117 int flags = WebMouseEventButtonToFlags(web_mouse.button); 118 int flags = WebMouseEventButtonToFlags(web_mouse.button);
118 ui::MouseEvent mouse_event(event_type, location, location, flags, flags); 119 ui::MouseEvent mouse_event(event_type, location, location, flags, flags);
119 120
120 aura::Window* window = GetWindow(); 121 aura::Window* window = GetWindow();
121 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); 122 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow());
122 ui::EventDispatchDetails details = 123 ui::EventDispatchDetails details =
123 window->GetDispatcher()->OnEventFromSource(&mouse_event); 124 window->GetHost()->dispatcher()->OnEventFromSource(&mouse_event);
124 if (details.dispatcher_destroyed) 125 if (details.dispatcher_destroyed)
125 return; 126 return;
126 } 127 }
127 128
128 SyntheticGestureParams::GestureSourceType 129 SyntheticGestureParams::GestureSourceType
129 SyntheticGestureTargetAura::GetDefaultSyntheticGestureSourceType() const { 130 SyntheticGestureTargetAura::GetDefaultSyntheticGestureSourceType() const {
130 return SyntheticGestureParams::TOUCH_INPUT; 131 return SyntheticGestureParams::TOUCH_INPUT;
131 } 132 }
132 133
133 bool SyntheticGestureTargetAura::SupportsSyntheticGestureSourceType( 134 bool SyntheticGestureTargetAura::SupportsSyntheticGestureSourceType(
134 SyntheticGestureParams::GestureSourceType gesture_source_type) const { 135 SyntheticGestureParams::GestureSourceType gesture_source_type) const {
135 return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT || 136 return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT ||
136 gesture_source_type == SyntheticGestureParams::MOUSE_INPUT; 137 gesture_source_type == SyntheticGestureParams::MOUSE_INPUT;
137 } 138 }
138 139
139 int SyntheticGestureTargetAura::GetTouchSlopInDips() const { 140 int SyntheticGestureTargetAura::GetTouchSlopInDips() const {
140 // - 1 because Aura considers a pointer to be moving if it has moved at least 141 // - 1 because Aura considers a pointer to be moving if it has moved at least
141 // 'max_touch_move_in_pixels_for_click' pixels. 142 // 'max_touch_move_in_pixels_for_click' pixels.
142 return ui::GestureConfiguration::max_touch_move_in_pixels_for_click() - 1; 143 return ui::GestureConfiguration::max_touch_move_in_pixels_for_click() - 1;
143 } 144 }
144 145
145 aura::Window* SyntheticGestureTargetAura::GetWindow() const { 146 aura::Window* SyntheticGestureTargetAura::GetWindow() const {
146 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); 147 aura::Window* window = render_widget_host()->GetView()->GetNativeView();
147 DCHECK(window); 148 DCHECK(window);
148 return window; 149 return window;
149 } 150 }
150 151
151 } // namespace content 152 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698