| 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 20 matching lines...) Expand all Loading... |
| 31 #include "content/common/input_messages.h" | 31 #include "content/common/input_messages.h" |
| 32 #include "content/common/view_messages.h" | 32 #include "content/common/view_messages.h" |
| 33 #include "content/public/browser/browser_context.h" | 33 #include "content/public/browser/browser_context.h" |
| 34 #include "content/public/browser/browser_plugin_guest_manager.h" | 34 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 35 #include "content/public/browser/content_browser_client.h" | 35 #include "content/public/browser/content_browser_client.h" |
| 36 #include "content/public/browser/guest_host.h" | 36 #include "content/public/browser/guest_host.h" |
| 37 #include "content/public/browser/render_widget_host_view.h" | 37 #include "content/public/browser/render_widget_host_view.h" |
| 38 #include "content/public/browser/user_metrics.h" | 38 #include "content/public/browser/user_metrics.h" |
| 39 #include "content/public/browser/web_contents_observer.h" | 39 #include "content/public/browser/web_contents_observer.h" |
| 40 #include "content/public/common/drop_data.h" | 40 #include "content/public/common/drop_data.h" |
| 41 #include "ui/gfx/geometry/point_conversions.h" |
| 41 #include "ui/gfx/geometry/size_conversions.h" | 42 #include "ui/gfx/geometry/size_conversions.h" |
| 42 | 43 |
| 43 #if defined(OS_MACOSX) | 44 #if defined(OS_MACOSX) |
| 44 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" | 45 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" |
| 45 #include "content/common/frame_messages.h" | 46 #include "content/common/frame_messages.h" |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 48 namespace content { | 49 namespace content { |
| 49 | 50 |
| 50 class BrowserPluginGuest::EmbedderVisibilityObserver | 51 class BrowserPluginGuest::EmbedderVisibilityObserver |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 bool BrowserPluginGuest::StopFinding(StopFindAction action) { | 447 bool BrowserPluginGuest::StopFinding(StopFindAction action) { |
| 447 return delegate_->StopFinding(action); | 448 return delegate_->StopFinding(action); |
| 448 } | 449 } |
| 449 | 450 |
| 450 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 451 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
| 451 return static_cast<WebContentsImpl*>(web_contents()); | 452 return static_cast<WebContentsImpl*>(web_contents()); |
| 452 } | 453 } |
| 453 | 454 |
| 454 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 455 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
| 455 const gfx::Point& relative_position) const { | 456 const gfx::Point& relative_position) const { |
| 457 return gfx::ToRoundedPoint( |
| 458 GetScreenCoordinates(gfx::PointF(relative_position))); |
| 459 } |
| 460 |
| 461 gfx::PointF BrowserPluginGuest::GetScreenCoordinates( |
| 462 const gfx::PointF& relative_position) const { |
| 456 if (!attached()) | 463 if (!attached()) |
| 457 return relative_position; | 464 return relative_position; |
| 458 | 465 |
| 459 gfx::Point screen_pos(relative_position); | 466 gfx::PointF screen_pos(relative_position); |
| 460 screen_pos += guest_window_rect_.OffsetFromOrigin(); | 467 screen_pos += guest_window_rect_.OffsetFromOrigin(); |
| 461 if (embedder_web_contents()->GetBrowserPluginGuest()) { | 468 if (embedder_web_contents()->GetBrowserPluginGuest()) { |
| 462 BrowserPluginGuest* embedder_guest = | 469 BrowserPluginGuest* embedder_guest = |
| 463 embedder_web_contents()->GetBrowserPluginGuest(); | 470 embedder_web_contents()->GetBrowserPluginGuest(); |
| 464 screen_pos += embedder_guest->guest_window_rect_.OffsetFromOrigin(); | 471 screen_pos += embedder_guest->guest_window_rect_.OffsetFromOrigin(); |
| 465 } | 472 } |
| 466 return screen_pos; | 473 return screen_pos; |
| 467 } | 474 } |
| 468 | |
| 469 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { | 475 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { |
| 470 if (!attached()) { | 476 if (!attached()) { |
| 471 // Some pages such as data URLs, javascript URLs, and about:blank | 477 // Some pages such as data URLs, javascript URLs, and about:blank |
| 472 // do not load external resources and so they load prior to attachment. | 478 // do not load external resources and so they load prior to attachment. |
| 473 // As a result, we must save all these IPCs until attachment and then | 479 // As a result, we must save all these IPCs until attachment and then |
| 474 // forward them so that the embedder gets a chance to see and process | 480 // forward them so that the embedder gets a chance to see and process |
| 475 // the load events. | 481 // the load events. |
| 476 pending_messages_.push_back(linked_ptr<IPC::Message>(msg)); | 482 pending_messages_.push_back(linked_ptr<IPC::Message>(msg)); |
| 477 return; | 483 return; |
| 478 } | 484 } |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 void BrowserPluginGuest::OnImeCompositionRangeChanged( | 975 void BrowserPluginGuest::OnImeCompositionRangeChanged( |
| 970 const gfx::Range& range, | 976 const gfx::Range& range, |
| 971 const std::vector<gfx::Rect>& character_bounds) { | 977 const std::vector<gfx::Rect>& character_bounds) { |
| 972 static_cast<RenderWidgetHostViewBase*>( | 978 static_cast<RenderWidgetHostViewBase*>( |
| 973 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( | 979 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( |
| 974 range, character_bounds); | 980 range, character_bounds); |
| 975 } | 981 } |
| 976 #endif | 982 #endif |
| 977 | 983 |
| 978 } // namespace content | 984 } // namespace content |
| OLD | NEW |