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/render_process_host.h" | 45 #include "content/public/browser/render_process_host.h" |
46 #include "content/public/browser/render_widget_host_view.h" | 46 #include "content/public/browser/render_widget_host_view.h" |
47 #include "content/public/browser/user_metrics.h" | 47 #include "content/public/browser/user_metrics.h" |
48 #include "content/public/browser/web_contents_observer.h" | 48 #include "content/public/browser/web_contents_observer.h" |
49 #include "content/public/common/browser_plugin_guest_mode.h" | 49 #include "content/public/common/browser_plugin_guest_mode.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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 451 |
451 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); | 452 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); |
452 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { | 453 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { |
453 blink::WebGestureEvent resent_gesture_event; | 454 blink::WebGestureEvent resent_gesture_event; |
454 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); | 455 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); |
455 resent_gesture_event.x += offset_from_embedder.x(); | 456 resent_gesture_event.x += offset_from_embedder.x(); |
456 resent_gesture_event.y += offset_from_embedder.y(); | 457 resent_gesture_event.y += offset_from_embedder.y(); |
457 // 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 |
458 // correct browser_plugin will know to ignore the event. | 459 // correct browser_plugin will know to ignore the event. |
459 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; | 460 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; |
460 view->ProcessGestureEvent(resent_gesture_event, ui::LatencyInfo()); | 461 ui::LatencyInfo latency_info = |
| 462 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( |
| 463 resent_gesture_event); |
| 464 view->ProcessGestureEvent(resent_gesture_event, latency_info); |
461 } else if (event.type == blink::WebInputEvent::MouseWheel) { | 465 } else if (event.type == blink::WebInputEvent::MouseWheel) { |
462 blink::WebMouseWheelEvent resent_wheel_event; | 466 blink::WebMouseWheelEvent resent_wheel_event; |
463 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); | 467 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); |
464 resent_wheel_event.x += offset_from_embedder.x(); | 468 resent_wheel_event.x += offset_from_embedder.x(); |
465 resent_wheel_event.y += offset_from_embedder.y(); | 469 resent_wheel_event.y += offset_from_embedder.y(); |
466 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; | 470 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; |
467 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. | 471 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. |
468 // https://crbug.com/613628 | 472 // https://crbug.com/613628 |
469 ui::LatencyInfo latency_info; | 473 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); |
470 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); | 474 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); |
471 } else { | 475 } else { |
472 NOTIMPLEMENTED(); | 476 NOTIMPLEMENTED(); |
473 } | 477 } |
474 } | 478 } |
475 | 479 |
476 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 480 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
477 return static_cast<WebContentsImpl*>(web_contents()); | 481 return static_cast<WebContentsImpl*>(web_contents()); |
478 } | 482 } |
479 | 483 |
(...skipping 542 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 |