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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // The instance ID does not matter here. This instance ID is used by the IPC | 280 // The instance ID does not matter here. This instance ID is used by the IPC |
281 // for routing, but here we're calling OnResizeGuest for initialization. | 281 // for routing, but here we're calling OnResizeGuest for initialization. |
282 OnResizeGuest(browser_plugin::kInstanceIDNone, params.resize_guest_params); | 282 OnResizeGuest(browser_plugin::kInstanceIDNone, params.resize_guest_params); |
283 | 283 |
284 // TODO(chrishtr): this code is wrong. The navigate_on_drag_drop field will | 284 // TODO(chrishtr): this code is wrong. The navigate_on_drag_drop field will |
285 // be reset again the next time preferences are updated. | 285 // be reset again the next time preferences are updated. |
286 WebPreferences prefs = | 286 WebPreferences prefs = |
287 GetWebContents()->GetRenderViewHost()->GetWebkitPreferences(); | 287 GetWebContents()->GetRenderViewHost()->GetWebkitPreferences(); |
288 prefs.navigate_on_drag_drop = false; | 288 prefs.navigate_on_drag_drop = false; |
289 GetWebContents()->GetRenderViewHost()->UpdateWebkitPreferences(prefs); | 289 GetWebContents()->GetRenderViewHost()->UpdateWebkitPreferences(prefs); |
290 | |
291 // Enable input method for guest if it's enabled for the embedder. | |
292 if (static_cast<RenderViewHostImpl*>( | |
293 owner_web_contents_->GetRenderViewHost())->input_method_active()) { | |
294 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( | |
295 GetWebContents()->GetRenderViewHost()); | |
296 guest_rvh->SetInputMethodActive(true); | |
297 } | |
298 } | 290 } |
299 | 291 |
300 BrowserPluginGuest::~BrowserPluginGuest() { | 292 BrowserPluginGuest::~BrowserPluginGuest() { |
301 } | 293 } |
302 | 294 |
303 // static | 295 // static |
304 BrowserPluginGuest* BrowserPluginGuest::Create( | 296 BrowserPluginGuest* BrowserPluginGuest::Create( |
305 WebContentsImpl* web_contents, | 297 WebContentsImpl* web_contents, |
306 BrowserPluginGuestDelegate* delegate) { | 298 BrowserPluginGuestDelegate* delegate) { |
307 return new BrowserPluginGuest( | 299 return new BrowserPluginGuest( |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 if (guest_proxy_routing_id_ == MSG_ROUTING_NONE) { | 625 if (guest_proxy_routing_id_ == MSG_ROUTING_NONE) { |
634 guest_proxy_routing_id_ = | 626 guest_proxy_routing_id_ = |
635 GetWebContents()->CreateSwappedOutRenderView( | 627 GetWebContents()->CreateSwappedOutRenderView( |
636 owner_web_contents_->GetSiteInstance()); | 628 owner_web_contents_->GetSiteInstance()); |
637 } | 629 } |
638 | 630 |
639 delegate_->DidAttach(guest_proxy_routing_id_); | 631 delegate_->DidAttach(guest_proxy_routing_id_); |
640 | 632 |
641 has_render_view_ = true; | 633 has_render_view_ = true; |
642 | 634 |
| 635 // Enable input method for guest if it's enabled for the embedder. |
| 636 if (static_cast<RenderViewHostImpl*>( |
| 637 owner_web_contents_->GetRenderViewHost())->input_method_active()) { |
| 638 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( |
| 639 GetWebContents()->GetRenderViewHost()); |
| 640 guest_rvh->SetInputMethodActive(true); |
| 641 } |
| 642 |
643 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); | 643 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); |
644 } | 644 } |
645 | 645 |
646 void BrowserPluginGuest::OnCompositorFrameSwappedACK( | 646 void BrowserPluginGuest::OnCompositorFrameSwappedACK( |
647 int browser_plugin_instance_id, | 647 int browser_plugin_instance_id, |
648 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { | 648 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { |
649 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, | 649 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, |
650 params.output_surface_id, | 650 params.output_surface_id, |
651 params.producing_host_id, | 651 params.producing_host_id, |
652 params.ack); | 652 params.ack); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 void BrowserPluginGuest::OnImeCompositionRangeChanged( | 900 void BrowserPluginGuest::OnImeCompositionRangeChanged( |
901 const gfx::Range& range, | 901 const gfx::Range& range, |
902 const std::vector<gfx::Rect>& character_bounds) { | 902 const std::vector<gfx::Rect>& character_bounds) { |
903 static_cast<RenderWidgetHostViewBase*>( | 903 static_cast<RenderWidgetHostViewBase*>( |
904 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( | 904 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( |
905 range, character_bounds); | 905 range, character_bounds); |
906 } | 906 } |
907 #endif | 907 #endif |
908 | 908 |
909 } // namespace content | 909 } // namespace content |
OLD | NEW |