| 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 30 matching lines...) Expand all Loading... |
| 41 #include "content/public/browser/browser_context.h" | 41 #include "content/public/browser/browser_context.h" |
| 42 #include "content/public/browser/browser_plugin_guest_manager.h" | 42 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 43 #include "content/public/browser/content_browser_client.h" | 43 #include "content/public/browser/content_browser_client.h" |
| 44 #include "content/public/browser/guest_host.h" | 44 #include "content/public/browser/guest_host.h" |
| 45 #include "content/public/browser/guest_mode.h" | 45 #include "content/public/browser/guest_mode.h" |
| 46 #include "content/public/browser/render_process_host.h" | 46 #include "content/public/browser/render_process_host.h" |
| 47 #include "content/public/browser/render_widget_host_view.h" | 47 #include "content/public/browser/render_widget_host_view.h" |
| 48 #include "content/public/browser/user_metrics.h" | 48 #include "content/public/browser/user_metrics.h" |
| 49 #include "content/public/browser/web_contents_observer.h" | 49 #include "content/public/browser/web_contents_observer.h" |
| 50 #include "content/public/common/drop_data.h" | 50 #include "content/public/common/drop_data.h" |
| 51 #include "ui/events/blink/web_input_event_traits.h" |
| 51 #include "ui/gfx/geometry/size_conversions.h" | 52 #include "ui/gfx/geometry/size_conversions.h" |
| 52 | 53 |
| 53 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
| 54 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" | 55 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" |
| 55 #include "content/common/frame_messages.h" | 56 #include "content/common/frame_messages.h" |
| 56 #endif | 57 #endif |
| 57 | 58 |
| 58 namespace content { | 59 namespace content { |
| 59 | 60 |
| 60 class BrowserPluginGuest::EmbedderVisibilityObserver | 61 class BrowserPluginGuest::EmbedderVisibilityObserver |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 452 |
| 452 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); | 453 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); |
| 453 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { | 454 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { |
| 454 blink::WebGestureEvent resent_gesture_event; | 455 blink::WebGestureEvent resent_gesture_event; |
| 455 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); | 456 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); |
| 456 resent_gesture_event.x += offset_from_embedder.x(); | 457 resent_gesture_event.x += offset_from_embedder.x(); |
| 457 resent_gesture_event.y += offset_from_embedder.y(); | 458 resent_gesture_event.y += offset_from_embedder.y(); |
| 458 // Mark the resend source with the browser plugin's instance id, so the | 459 // Mark the resend source with the browser plugin's instance id, so the |
| 459 // correct browser_plugin will know to ignore the event. | 460 // correct browser_plugin will know to ignore the event. |
| 460 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; | 461 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; |
| 461 view->ProcessGestureEvent(resent_gesture_event, ui::LatencyInfo()); | 462 ui::LatencyInfo latency_info = |
| 463 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( |
| 464 resent_gesture_event); |
| 465 view->ProcessGestureEvent(resent_gesture_event, latency_info); |
| 462 } else if (event.type == blink::WebInputEvent::MouseWheel) { | 466 } else if (event.type == blink::WebInputEvent::MouseWheel) { |
| 463 blink::WebMouseWheelEvent resent_wheel_event; | 467 blink::WebMouseWheelEvent resent_wheel_event; |
| 464 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); | 468 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); |
| 465 resent_wheel_event.x += offset_from_embedder.x(); | 469 resent_wheel_event.x += offset_from_embedder.x(); |
| 466 resent_wheel_event.y += offset_from_embedder.y(); | 470 resent_wheel_event.y += offset_from_embedder.y(); |
| 467 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; | 471 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; |
| 468 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. | 472 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. |
| 469 // https://crbug.com/613628 | 473 // https://crbug.com/613628 |
| 470 ui::LatencyInfo latency_info; | 474 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); |
| 471 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); | 475 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); |
| 472 } else { | 476 } else { |
| 473 NOTIMPLEMENTED(); | 477 NOTIMPLEMENTED(); |
| 474 } | 478 } |
| 475 } | 479 } |
| 476 | 480 |
| 477 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 481 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
| 478 return static_cast<WebContentsImpl*>(web_contents()); | 482 return static_cast<WebContentsImpl*>(web_contents()); |
| 479 } | 483 } |
| 480 | 484 |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 range, character_bounds); | 1026 range, character_bounds); |
| 1023 } | 1027 } |
| 1024 #endif | 1028 #endif |
| 1025 | 1029 |
| 1026 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1030 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
| 1027 if (delegate_) | 1031 if (delegate_) |
| 1028 delegate_->SetContextMenuPosition(position); | 1032 delegate_->SetContextMenuPosition(position); |
| 1029 } | 1033 } |
| 1030 | 1034 |
| 1031 } // namespace content | 1035 } // namespace content |
| OLD | NEW |