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/renderer/render_widget_fullscreen_pepper.h" | 5 #include "content/renderer/render_widget_fullscreen_pepper.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 mouse.type = WebInputEvent::MouseUp; | 85 mouse.type = WebInputEvent::MouseUp; |
86 case WebInputEvent::GestureScrollEnd: | 86 case WebInputEvent::GestureScrollEnd: |
87 mouse.type = WebInputEvent::MouseUp; | 87 mouse.type = WebInputEvent::MouseUp; |
88 break; | 88 break; |
89 default: | 89 default: |
90 return mouse; | 90 return mouse; |
91 } | 91 } |
92 | 92 |
93 mouse.timeStampSeconds = gesture.timeStampSeconds; | 93 mouse.timeStampSeconds = gesture.timeStampSeconds; |
94 mouse.modifiers = gesture.modifiers | WebInputEvent::LeftButtonDown; | 94 mouse.modifiers = gesture.modifiers | WebInputEvent::LeftButtonDown; |
95 mouse.button = WebMouseEvent::ButtonLeft; | 95 mouse.button = WebMouseEvent::Button::Left; |
96 mouse.clickCount = (mouse.type == WebInputEvent::MouseDown || | 96 mouse.clickCount = (mouse.type == WebInputEvent::MouseDown || |
97 mouse.type == WebInputEvent::MouseUp); | 97 mouse.type == WebInputEvent::MouseUp); |
98 | 98 |
99 mouse.x = gesture.x; | 99 mouse.x = gesture.x; |
100 mouse.y = gesture.y; | 100 mouse.y = gesture.y; |
101 mouse.windowX = gesture.x; | 101 mouse.windowX = gesture.x; |
102 mouse.windowY = gesture.y; | 102 mouse.windowY = gesture.y; |
103 mouse.globalX = gesture.globalX; | 103 mouse.globalX = gesture.globalX; |
104 mouse.globalY = gesture.globalY; | 104 mouse.globalY = gesture.globalY; |
105 | 105 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 mouse.y = gesture_event->y; | 178 mouse.y = gesture_event->y; |
179 mouse.windowX = gesture_event->x; | 179 mouse.windowX = gesture_event->x; |
180 mouse.windowY = gesture_event->y; | 180 mouse.windowY = gesture_event->y; |
181 mouse.globalX = gesture_event->globalX; | 181 mouse.globalX = gesture_event->globalX; |
182 mouse.globalY = gesture_event->globalY; | 182 mouse.globalY = gesture_event->globalY; |
183 mouse.movementX = 0; | 183 mouse.movementX = 0; |
184 mouse.movementY = 0; | 184 mouse.movementY = 0; |
185 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); | 185 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); |
186 | 186 |
187 mouse.type = WebInputEvent::MouseDown; | 187 mouse.type = WebInputEvent::MouseDown; |
188 mouse.button = WebMouseEvent::ButtonLeft; | 188 mouse.button = WebMouseEvent::Button::Left; |
189 mouse.clickCount = gesture_event->data.tap.tapCount; | 189 mouse.clickCount = gesture_event->data.tap.tapCount; |
190 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); | 190 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); |
191 | 191 |
192 mouse.type = WebInputEvent::MouseUp; | 192 mouse.type = WebInputEvent::MouseUp; |
193 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); | 193 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); |
194 break; | 194 break; |
195 } | 195 } |
196 | 196 |
197 default: { | 197 default: { |
198 WebMouseEvent mouse = WebMouseEventFromGestureEvent(*gesture_event); | 198 WebMouseEvent mouse = WebMouseEventFromGestureEvent(*gesture_event); |
(...skipping 13 matching lines...) Expand all Loading... |
212 // do the necessary translation ourselves. | 212 // do the necessary translation ourselves. |
213 if (WebInputEvent::isMouseEventType(event.type)) { | 213 if (WebInputEvent::isMouseEventType(event.type)) { |
214 const WebMouseEvent& mouse_event = | 214 const WebMouseEvent& mouse_event = |
215 reinterpret_cast<const WebMouseEvent&>(event); | 215 reinterpret_cast<const WebMouseEvent&>(event); |
216 bool send_context_menu_event = false; | 216 bool send_context_menu_event = false; |
217 // On Mac/Linux, we handle it on mouse down. | 217 // On Mac/Linux, we handle it on mouse down. |
218 // On Windows, we handle it on mouse up. | 218 // On Windows, we handle it on mouse up. |
219 #if defined(OS_WIN) | 219 #if defined(OS_WIN) |
220 send_context_menu_event = | 220 send_context_menu_event = |
221 mouse_event.type == WebInputEvent::MouseUp && | 221 mouse_event.type == WebInputEvent::MouseUp && |
222 mouse_event.button == WebMouseEvent::ButtonRight; | 222 mouse_event.button == WebMouseEvent::Button::Right; |
223 #elif defined(OS_MACOSX) | 223 #elif defined(OS_MACOSX) |
224 send_context_menu_event = | 224 send_context_menu_event = |
225 mouse_event.type == WebInputEvent::MouseDown && | 225 mouse_event.type == WebInputEvent::MouseDown && |
226 (mouse_event.button == WebMouseEvent::ButtonRight || | 226 (mouse_event.button == WebMouseEvent::Button::Right || |
227 (mouse_event.button == WebMouseEvent::ButtonLeft && | 227 (mouse_event.button == WebMouseEvent::Button::Left && |
228 mouse_event.modifiers & WebMouseEvent::ControlKey)); | 228 mouse_event.modifiers & WebMouseEvent::ControlKey)); |
229 #else | 229 #else |
230 send_context_menu_event = | 230 send_context_menu_event = |
231 mouse_event.type == WebInputEvent::MouseDown && | 231 mouse_event.type == WebInputEvent::MouseDown && |
232 mouse_event.button == WebMouseEvent::ButtonRight; | 232 mouse_event.button == WebMouseEvent::Button::Right; |
233 #endif | 233 #endif |
234 if (send_context_menu_event) { | 234 if (send_context_menu_event) { |
235 WebMouseEvent context_menu_event(mouse_event); | 235 WebMouseEvent context_menu_event(mouse_event); |
236 context_menu_event.type = WebInputEvent::ContextMenu; | 236 context_menu_event.type = WebInputEvent::ContextMenu; |
237 widget_->plugin()->HandleInputEvent(context_menu_event, &cursor); | 237 widget_->plugin()->HandleInputEvent(context_menu_event, &cursor); |
238 } | 238 } |
239 } | 239 } |
240 return result ? WebInputEventResult::HandledApplication | 240 return result ? WebInputEventResult::HandledApplication |
241 : WebInputEventResult::NotHandled; | 241 : WebInputEventResult::NotHandled; |
242 } | 242 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() { | 374 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() { |
375 return active_url_; | 375 return active_url_; |
376 } | 376 } |
377 | 377 |
378 void RenderWidgetFullscreenPepper::OnDeviceScaleFactorChanged() { | 378 void RenderWidgetFullscreenPepper::OnDeviceScaleFactorChanged() { |
379 if (compositor_) | 379 if (compositor_) |
380 compositor_->setDeviceScaleFactor(device_scale_factor_); | 380 compositor_->setDeviceScaleFactor(device_scale_factor_); |
381 } | 381 } |
382 | 382 |
383 } // namespace content | 383 } // namespace content |
OLD | NEW |