| 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/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 void BrowserPluginGuest::ResendEventToEmbedder( | 460 void BrowserPluginGuest::ResendEventToEmbedder( |
| 461 const blink::WebInputEvent& event) { | 461 const blink::WebInputEvent& event) { |
| 462 if (!attached() || !owner_web_contents_) | 462 if (!attached() || !owner_web_contents_) |
| 463 return; | 463 return; |
| 464 | 464 |
| 465 DCHECK(browser_plugin_instance_id_); | 465 DCHECK(browser_plugin_instance_id_); |
| 466 RenderWidgetHostViewBase* view = | 466 RenderWidgetHostViewBase* view = |
| 467 static_cast<RenderWidgetHostViewBase*>(GetOwnerRenderWidgetHostView()); | 467 static_cast<RenderWidgetHostViewBase*>(GetOwnerRenderWidgetHostView()); |
| 468 | 468 |
| 469 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); | 469 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); |
| 470 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { | 470 if (event.type() == blink::WebInputEvent::GestureScrollUpdate) { |
| 471 blink::WebGestureEvent resent_gesture_event; | 471 blink::WebGestureEvent resent_gesture_event; |
| 472 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); | 472 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); |
| 473 resent_gesture_event.x += offset_from_embedder.x(); | 473 resent_gesture_event.x += offset_from_embedder.x(); |
| 474 resent_gesture_event.y += offset_from_embedder.y(); | 474 resent_gesture_event.y += offset_from_embedder.y(); |
| 475 // Mark the resend source with the browser plugin's instance id, so the | 475 // Mark the resend source with the browser plugin's instance id, so the |
| 476 // correct browser_plugin will know to ignore the event. | 476 // correct browser_plugin will know to ignore the event. |
| 477 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; | 477 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; |
| 478 ui::LatencyInfo latency_info = | 478 ui::LatencyInfo latency_info = |
| 479 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( | 479 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( |
| 480 resent_gesture_event); | 480 resent_gesture_event); |
| 481 view->ProcessGestureEvent(resent_gesture_event, latency_info); | 481 view->ProcessGestureEvent(resent_gesture_event, latency_info); |
| 482 } else if (event.type == blink::WebInputEvent::MouseWheel) { | 482 } else if (event.type() == blink::WebInputEvent::MouseWheel) { |
| 483 blink::WebMouseWheelEvent resent_wheel_event; | 483 blink::WebMouseWheelEvent resent_wheel_event; |
| 484 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); | 484 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); |
| 485 resent_wheel_event.x += offset_from_embedder.x(); | 485 resent_wheel_event.x += offset_from_embedder.x(); |
| 486 resent_wheel_event.y += offset_from_embedder.y(); | 486 resent_wheel_event.y += offset_from_embedder.y(); |
| 487 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; | 487 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; |
| 488 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. | 488 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. |
| 489 // https://crbug.com/613628 | 489 // https://crbug.com/613628 |
| 490 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); | 490 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); |
| 491 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); | 491 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); |
| 492 } else { | 492 } else { |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 range, character_bounds); | 1063 range, character_bounds); |
| 1064 } | 1064 } |
| 1065 #endif | 1065 #endif |
| 1066 | 1066 |
| 1067 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1067 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
| 1068 if (delegate_) | 1068 if (delegate_) |
| 1069 delegate_->SetContextMenuPosition(position); | 1069 delegate_->SetContextMenuPosition(position); |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 } // namespace content | 1072 } // namespace content |
| OLD | NEW |