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