Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 bool BrowserPluginGuest::Find(int request_id, | 452 bool BrowserPluginGuest::Find(int request_id, |
| 453 const base::string16& search_text, | 453 const base::string16& search_text, |
| 454 const blink::WebFindOptions& options) { | 454 const blink::WebFindOptions& options) { |
| 455 return delegate_->Find(request_id, search_text, options); | 455 return delegate_->Find(request_id, search_text, options); |
| 456 } | 456 } |
| 457 | 457 |
| 458 bool BrowserPluginGuest::StopFinding(StopFindAction action) { | 458 bool BrowserPluginGuest::StopFinding(StopFindAction action) { |
| 459 return delegate_->StopFinding(action); | 459 return delegate_->StopFinding(action); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void BrowserPluginGuest::ResendEventToEmbedder( | |
| 463 const blink::WebInputEvent& event) { | |
| 464 if (!attached() || !owner_web_contents_) | |
| 465 return; | |
| 466 | |
| 467 DCHECK(browser_plugin_instance_id_); | |
| 468 RenderWidgetHostImpl* host = | |
| 469 embedder_web_contents()->GetMainFrame()->GetRenderWidgetHost(); | |
| 470 | |
| 471 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { | |
| 472 blink::WebGestureEvent resent_gesture_event; | |
| 473 memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); | |
|
Charlie Reis
2015/09/18 04:30:36
Sigh. memcpy is pretty dangerous in general, and
wjmaclean
2015/09/18 15:30:57
Acknowledged.
I used it based on seeing the patte
| |
| 474 // Mark the resend source with the browser plugin's instance id, so the | |
| 475 // correct browser_plugin will know to ignore the event. | |
| 476 resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; | |
| 477 host->ForwardGestureEvent(resent_gesture_event); | |
| 478 } else if (event.type == blink::WebInputEvent::MouseWheel) { | |
| 479 blink::WebMouseWheelEvent resent_wheel_event; | |
| 480 memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); | |
| 481 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; | |
| 482 host->ForwardWheelEvent(resent_wheel_event); | |
| 483 } else { | |
| 484 NOTIMPLEMENTED(); | |
| 485 } | |
| 486 | |
| 487 } | |
| 488 | |
| 462 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 489 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
| 463 return static_cast<WebContentsImpl*>(web_contents()); | 490 return static_cast<WebContentsImpl*>(web_contents()); |
| 464 } | 491 } |
| 465 | 492 |
| 466 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 493 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
| 467 const gfx::Point& relative_position) const { | 494 const gfx::Point& relative_position) const { |
| 468 if (!attached()) | 495 if (!attached()) |
| 469 return relative_position; | 496 return relative_position; |
| 470 | 497 |
| 471 gfx::Point screen_pos(relative_position); | 498 gfx::Point screen_pos(relative_position); |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 980 range, character_bounds); | 1007 range, character_bounds); |
| 981 } | 1008 } |
| 982 #endif | 1009 #endif |
| 983 | 1010 |
| 984 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1011 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
| 985 if (delegate_) | 1012 if (delegate_) |
| 986 delegate_->SetContextMenuPosition(position); | 1013 delegate_->SetContextMenuPosition(position); |
| 987 } | 1014 } |
| 988 | 1015 |
| 989 } // namespace content | 1016 } // namespace content |
| OLD | NEW |