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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 | 448 |
448 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); | 449 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); |
449 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { | 450 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { |
450 blink::WebGestureEvent resent_gesture_event; | 451 blink::WebGestureEvent resent_gesture_event; |
451 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); | 452 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); |
452 resent_gesture_event.x += offset_from_embedder.x(); | 453 resent_gesture_event.x += offset_from_embedder.x(); |
453 resent_gesture_event.y += offset_from_embedder.y(); | 454 resent_gesture_event.y += offset_from_embedder.y(); |
454 // Mark the resend source with the browser plugin's instance id, so the | 455 // Mark the resend source with the browser plugin's instance id, so the |
455 // correct browser_plugin will know to ignore the event. | 456 // correct browser_plugin will know to ignore the event. |
456 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; | 457 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; |
457 view->ProcessGestureEvent(resent_gesture_event, ui::LatencyInfo()); | 458 ui::LatencyInfo latency_info = |
459 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( | |
460 resent_gesture_event); | |
461 view->ProcessGestureEvent(resent_gesture_event, latency_info); | |
458 } else if (event.type == blink::WebInputEvent::MouseWheel) { | 462 } else if (event.type == blink::WebInputEvent::MouseWheel) { |
459 blink::WebMouseWheelEvent resent_wheel_event; | 463 blink::WebMouseWheelEvent resent_wheel_event; |
460 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); | 464 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); |
461 resent_wheel_event.x += offset_from_embedder.x(); | 465 resent_wheel_event.x += offset_from_embedder.x(); |
462 resent_wheel_event.y += offset_from_embedder.y(); | 466 resent_wheel_event.y += offset_from_embedder.y(); |
463 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; | 467 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; |
464 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. | 468 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. |
465 // https://crbug.com/613628 | 469 // https://crbug.com/613628 |
tdresser
2016/09/12 14:23:08
Remove TODO, update linked bug, cc James.
Does th
tdresser
2016/09/12 15:36:37
Whoops, you're right, this isn't done.
We should
sahel
2016/09/12 17:02:26
Acknowledged.
| |
466 ui::LatencyInfo latency_info; | 470 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); |
467 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); | 471 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); |
468 } else { | 472 } else { |
469 NOTIMPLEMENTED(); | 473 NOTIMPLEMENTED(); |
470 } | 474 } |
471 } | 475 } |
472 | 476 |
473 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 477 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
474 return static_cast<WebContentsImpl*>(web_contents()); | 478 return static_cast<WebContentsImpl*>(web_contents()); |
475 } | 479 } |
476 | 480 |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1017 range, character_bounds); | 1021 range, character_bounds); |
1018 } | 1022 } |
1019 #endif | 1023 #endif |
1020 | 1024 |
1021 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1025 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
1022 if (delegate_) | 1026 if (delegate_) |
1023 delegate_->SetContextMenuPosition(position); | 1027 delegate_->SetContextMenuPosition(position); |
1024 } | 1028 } |
1025 | 1029 |
1026 } // namespace content | 1030 } // namespace content |
OLD | NEW |