| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 void BrowserPluginGuest::ResendEventToEmbedder( | 451 void BrowserPluginGuest::ResendEventToEmbedder( |
| 452 const blink::WebInputEvent& event) { | 452 const blink::WebInputEvent& event) { |
| 453 if (!attached() || !owner_web_contents_) | 453 if (!attached() || !owner_web_contents_) |
| 454 return; | 454 return; |
| 455 | 455 |
| 456 DCHECK(browser_plugin_instance_id_); | 456 DCHECK(browser_plugin_instance_id_); |
| 457 RenderWidgetHostViewBase* view = | 457 RenderWidgetHostViewBase* view = |
| 458 static_cast<RenderWidgetHostViewBase*>(GetOwnerRenderWidgetHostView()); | 458 static_cast<RenderWidgetHostViewBase*>(GetOwnerRenderWidgetHostView()); |
| 459 | 459 |
| 460 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); | 460 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); |
| 461 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { | 461 if (event.type() == blink::WebInputEvent::GestureScrollUpdate) { |
| 462 blink::WebGestureEvent resent_gesture_event; | 462 blink::WebGestureEvent resent_gesture_event; |
| 463 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); | 463 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); |
| 464 resent_gesture_event.x += offset_from_embedder.x(); | 464 resent_gesture_event.x += offset_from_embedder.x(); |
| 465 resent_gesture_event.y += offset_from_embedder.y(); | 465 resent_gesture_event.y += offset_from_embedder.y(); |
| 466 // Mark the resend source with the browser plugin's instance id, so the | 466 // Mark the resend source with the browser plugin's instance id, so the |
| 467 // correct browser_plugin will know to ignore the event. | 467 // correct browser_plugin will know to ignore the event. |
| 468 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; | 468 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; |
| 469 ui::LatencyInfo latency_info = | 469 ui::LatencyInfo latency_info = |
| 470 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( | 470 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( |
| 471 resent_gesture_event); | 471 resent_gesture_event); |
| 472 view->ProcessGestureEvent(resent_gesture_event, latency_info); | 472 view->ProcessGestureEvent(resent_gesture_event, latency_info); |
| 473 } else if (event.type == blink::WebInputEvent::MouseWheel) { | 473 } else if (event.type() == blink::WebInputEvent::MouseWheel) { |
| 474 blink::WebMouseWheelEvent resent_wheel_event; | 474 blink::WebMouseWheelEvent resent_wheel_event; |
| 475 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); | 475 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); |
| 476 resent_wheel_event.x += offset_from_embedder.x(); | 476 resent_wheel_event.x += offset_from_embedder.x(); |
| 477 resent_wheel_event.y += offset_from_embedder.y(); | 477 resent_wheel_event.y += offset_from_embedder.y(); |
| 478 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; | 478 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; |
| 479 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. | 479 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. |
| 480 // https://crbug.com/613628 | 480 // https://crbug.com/613628 |
| 481 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); | 481 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); |
| 482 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); | 482 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); |
| 483 } else { | 483 } else { |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 range, character_bounds); | 1056 range, character_bounds); |
| 1057 } | 1057 } |
| 1058 #endif | 1058 #endif |
| 1059 | 1059 |
| 1060 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1060 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
| 1061 if (delegate_) | 1061 if (delegate_) |
| 1062 delegate_->SetContextMenuPosition(position); | 1062 delegate_->SetContextMenuPosition(position); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 } // namespace content | 1065 } // namespace content |
| OLD | NEW |