| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   433 bool BrowserPluginGuest::HandleStopFindingForEmbedder(StopFindAction action) { |   433 bool BrowserPluginGuest::HandleStopFindingForEmbedder(StopFindAction action) { | 
|   434   return delegate_->HandleStopFindingForEmbedder(action); |   434   return delegate_->HandleStopFindingForEmbedder(action); | 
|   435 } |   435 } | 
|   436  |   436  | 
|   437 void BrowserPluginGuest::ResendEventToEmbedder( |   437 void BrowserPluginGuest::ResendEventToEmbedder( | 
|   438     const blink::WebInputEvent& event) { |   438     const blink::WebInputEvent& event) { | 
|   439   if (!attached() || !owner_web_contents_) |   439   if (!attached() || !owner_web_contents_) | 
|   440     return; |   440     return; | 
|   441  |   441  | 
|   442   DCHECK(browser_plugin_instance_id_); |   442   DCHECK(browser_plugin_instance_id_); | 
|   443   RenderWidgetHostImpl* host = |   443   RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( | 
|   444       embedder_web_contents()->GetMainFrame()->GetRenderWidgetHost(); |   444       embedder_web_contents()->GetMainFrame()->GetView()); | 
|   445  |   445  | 
|   446   gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); |   446   gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); | 
|   447   if (event.type == blink::WebInputEvent::GestureScrollUpdate) { |   447   if (event.type == blink::WebInputEvent::GestureScrollUpdate) { | 
|   448     blink::WebGestureEvent resent_gesture_event; |   448     blink::WebGestureEvent resent_gesture_event; | 
|   449     memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); |   449     memcpy(&resent_gesture_event, &event, sizeof(blink::WebGestureEvent)); | 
|   450     resent_gesture_event.x += offset_from_embedder.x(); |   450     resent_gesture_event.x += offset_from_embedder.x(); | 
|   451     resent_gesture_event.y += offset_from_embedder.y(); |   451     resent_gesture_event.y += offset_from_embedder.y(); | 
|   452     // Mark the resend source with the browser plugin's instance id, so the |   452     // Mark the resend source with the browser plugin's instance id, so the | 
|   453     // correct browser_plugin will know to ignore the event. |   453     // correct browser_plugin will know to ignore the event. | 
|   454     resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; |   454     resent_gesture_event.resendingPluginId = browser_plugin_instance_id_; | 
|   455     host->ForwardGestureEvent(resent_gesture_event); |   455     view->ProcessGestureEvent(resent_gesture_event, ui::LatencyInfo()); | 
|   456   } else if (event.type == blink::WebInputEvent::MouseWheel) { |   456   } else if (event.type == blink::WebInputEvent::MouseWheel) { | 
|   457     blink::WebMouseWheelEvent resent_wheel_event; |   457     blink::WebMouseWheelEvent resent_wheel_event; | 
|   458     memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); |   458     memcpy(&resent_wheel_event, &event, sizeof(blink::WebMouseWheelEvent)); | 
|   459     resent_wheel_event.x += offset_from_embedder.x(); |   459     resent_wheel_event.x += offset_from_embedder.x(); | 
|   460     resent_wheel_event.y += offset_from_embedder.y(); |   460     resent_wheel_event.y += offset_from_embedder.y(); | 
|   461     resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; |   461     resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; | 
|   462     host->ForwardWheelEvent(resent_wheel_event); |   462     view->ProcessMouseWheelEvent(resent_wheel_event); | 
|   463   } else { |   463   } else { | 
|   464     NOTIMPLEMENTED(); |   464     NOTIMPLEMENTED(); | 
|   465   } |   465   } | 
|   466 } |   466 } | 
|   467  |   467  | 
|   468 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |   468 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 
|   469   return static_cast<WebContentsImpl*>(web_contents()); |   469   return static_cast<WebContentsImpl*>(web_contents()); | 
|   470 } |   470 } | 
|   471  |   471  | 
|   472 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |   472 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1007           range, character_bounds); |  1007           range, character_bounds); | 
|  1008 } |  1008 } | 
|  1009 #endif |  1009 #endif | 
|  1010  |  1010  | 
|  1011 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |  1011 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 
|  1012   if (delegate_) |  1012   if (delegate_) | 
|  1013     delegate_->SetContextMenuPosition(position); |  1013     delegate_->SetContextMenuPosition(position); | 
|  1014 } |  1014 } | 
|  1015  |  1015  | 
|  1016 }  // namespace content |  1016 }  // namespace content | 
| OLD | NEW |