| 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 18 matching lines...) Expand all Loading... |
| 29 #include "content/common/input_messages.h" | 29 #include "content/common/input_messages.h" |
| 30 #include "content/common/view_messages.h" | 30 #include "content/common/view_messages.h" |
| 31 #include "content/public/browser/browser_context.h" | 31 #include "content/public/browser/browser_context.h" |
| 32 #include "content/public/browser/browser_plugin_guest_manager.h" | 32 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 33 #include "content/public/browser/content_browser_client.h" | 33 #include "content/public/browser/content_browser_client.h" |
| 34 #include "content/public/browser/render_widget_host_view.h" | 34 #include "content/public/browser/render_widget_host_view.h" |
| 35 #include "content/public/browser/user_metrics.h" | 35 #include "content/public/browser/user_metrics.h" |
| 36 #include "content/public/browser/web_contents_observer.h" | 36 #include "content/public/browser/web_contents_observer.h" |
| 37 #include "content/public/common/drop_data.h" | 37 #include "content/public/common/drop_data.h" |
| 38 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 38 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
| 39 #include "ui/gfx/geometry/size_conversions.h" |
| 39 | 40 |
| 40 #if defined(OS_MACOSX) | 41 #if defined(OS_MACOSX) |
| 41 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" | 42 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 namespace content { | 45 namespace content { |
| 45 | 46 |
| 46 class BrowserPluginGuest::EmbedderWebContentsObserver | 47 class BrowserPluginGuest::EmbedderWebContentsObserver |
| 47 : public WebContentsObserver { | 48 : public WebContentsObserver { |
| 48 public: | 49 public: |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 int host_routing_id, | 314 int host_routing_id, |
| 314 scoped_ptr<cc::CompositorFrame> frame) { | 315 scoped_ptr<cc::CompositorFrame> frame) { |
| 315 if (!attached()) { | 316 if (!attached()) { |
| 316 // If the guest doesn't have an embedder then there's nothing to give the | 317 // If the guest doesn't have an embedder then there's nothing to give the |
| 317 // the frame to. | 318 // the frame to. |
| 318 return; | 319 return; |
| 319 } | 320 } |
| 320 | 321 |
| 321 cc::RenderPass* root_pass = | 322 cc::RenderPass* root_pass = |
| 322 frame->delegated_frame_data->render_pass_list.back(); | 323 frame->delegated_frame_data->render_pass_list.back(); |
| 323 gfx::Size view_size(root_pass->output_rect.size()); | 324 gfx::Size view_size(gfx::ToFlooredSize(gfx::ScaleSize( |
| 325 root_pass->output_rect.size(), |
| 326 1.0f / frame->metadata.device_scale_factor))); |
| 327 |
| 324 if (last_seen_view_size_ != view_size) { | 328 if (last_seen_view_size_ != view_size) { |
| 325 delegate_->GuestSizeChanged(last_seen_view_size_, view_size); | 329 delegate_->GuestSizeChanged(last_seen_view_size_, view_size); |
| 326 last_seen_view_size_ = view_size; | 330 last_seen_view_size_ = view_size; |
| 327 } | 331 } |
| 328 | 332 |
| 329 base::SharedMemoryHandle software_frame_handle = | 333 base::SharedMemoryHandle software_frame_handle = |
| 330 base::SharedMemory::NULLHandle(); | 334 base::SharedMemory::NULLHandle(); |
| 331 if (frame->software_frame_data) { | 335 if (frame->software_frame_data) { |
| 332 cc::SoftwareFrameData* frame_data = frame->software_frame_data.get(); | 336 cc::SoftwareFrameData* frame_data = frame->software_frame_data.get(); |
| 333 scoped_ptr<cc::SharedBitmap> bitmap = | 337 scoped_ptr<cc::SharedBitmap> bitmap = |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 void BrowserPluginGuest::OnImeCompositionRangeChanged( | 837 void BrowserPluginGuest::OnImeCompositionRangeChanged( |
| 834 const gfx::Range& range, | 838 const gfx::Range& range, |
| 835 const std::vector<gfx::Rect>& character_bounds) { | 839 const std::vector<gfx::Rect>& character_bounds) { |
| 836 static_cast<RenderWidgetHostViewBase*>( | 840 static_cast<RenderWidgetHostViewBase*>( |
| 837 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( | 841 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( |
| 838 range, character_bounds); | 842 range, character_bounds); |
| 839 } | 843 } |
| 840 #endif | 844 #endif |
| 841 | 845 |
| 842 } // namespace content | 846 } // namespace content |
| OLD | NEW |