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 // Note that all IPC sent out from this class will be dropped on the |
| 6 // floor b/c we don't have a BrowserPlugin anymore. |
5 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 7 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 8 |
7 #include <algorithm> | 9 #include <algorithm> |
8 | 10 |
9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
10 #include "base/pickle.h" | 12 #include "base/pickle.h" |
11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
12 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 14 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
13 #include "content/browser/browser_thread_impl.h" | 15 #include "content/browser/browser_thread_impl.h" |
14 #include "content/browser/child_process_security_policy_impl.h" | 16 #include "content/browser/child_process_security_policy_impl.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 delegate_(delegate), | 98 delegate_(delegate), |
97 weak_ptr_factory_(this) { | 99 weak_ptr_factory_(this) { |
98 DCHECK(web_contents); | 100 DCHECK(web_contents); |
99 DCHECK(delegate); | 101 DCHECK(delegate); |
100 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create")); | 102 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create")); |
101 web_contents->SetBrowserPluginGuest(this); | 103 web_contents->SetBrowserPluginGuest(this); |
102 delegate->SetGuestHost(this); | 104 delegate->SetGuestHost(this); |
103 } | 105 } |
104 | 106 |
105 int BrowserPluginGuest::GetGuestProxyRoutingID() { | 107 int BrowserPluginGuest::GetGuestProxyRoutingID() { |
| 108 // Don't create the proxy here, we'll create it later. |
| 109 return MSG_ROUTING_NONE; |
| 110 |
106 if (guest_proxy_routing_id_ != MSG_ROUTING_NONE) | 111 if (guest_proxy_routing_id_ != MSG_ROUTING_NONE) |
107 return guest_proxy_routing_id_; | 112 return guest_proxy_routing_id_; |
108 | 113 |
109 // Create a swapped out RenderView for the guest in the embedder renderer | 114 // Create a swapped out RenderView for the guest in the embedder renderer |
110 // process, so that the embedder can access the guest's window object. | 115 // process, so that the embedder can access the guest's window object. |
111 // On reattachment, we can reuse the same swapped out RenderView because | 116 // On reattachment, we can reuse the same swapped out RenderView because |
112 // the embedder process will always be the same even if the embedder | 117 // the embedder process will always be the same even if the embedder |
113 // WebContents changes. | 118 // WebContents changes. |
114 // | 119 // |
115 // TODO(fsamuel): Make sure this works for transferring guests across | 120 // TODO(fsamuel): Make sure this works for transferring guests across |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 focused_, | 263 focused_, |
259 blink::WebFocusTypeNone); | 264 blink::WebFocusTypeNone); |
260 | 265 |
261 guest_visible_ = params.visible; | 266 guest_visible_ = params.visible; |
262 UpdateVisibility(); | 267 UpdateVisibility(); |
263 | 268 |
264 is_full_page_plugin_ = params.is_full_page_plugin; | 269 is_full_page_plugin_ = params.is_full_page_plugin; |
265 guest_window_rect_ = params.view_rect; | 270 guest_window_rect_ = params.view_rect; |
266 | 271 |
267 if (owner_web_contents_ != owner_web_contents) { | 272 if (owner_web_contents_ != owner_web_contents) { |
268 WebContentsViewGuest* new_view = | 273 // View is not created yet in the case if OOPIF |
269 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); | 274 //WebContentsViewGuest* new_view = |
270 if (owner_web_contents_) | 275 // static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
271 new_view->OnGuestDetached(owner_web_contents_->GetView()); | 276 //if (owner_web_contents_) |
| 277 // new_view->OnGuestDetached(owner_web_contents_->GetView()); |
272 | 278 |
273 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to | 279 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to |
274 // be attached. | 280 // be attached. |
275 owner_web_contents_ = owner_web_contents; | 281 owner_web_contents_ = owner_web_contents; |
276 new_view->OnGuestAttached(owner_web_contents_->GetView()); | 282 //new_view->OnGuestAttached(owner_web_contents_->GetView()); |
277 } | 283 } |
278 | 284 |
279 RendererPreferences* renderer_prefs = | 285 RendererPreferences* renderer_prefs = |
280 GetWebContents()->GetMutableRendererPrefs(); | 286 GetWebContents()->GetMutableRendererPrefs(); |
281 std::string guest_user_agent_override = renderer_prefs->user_agent_override; | 287 std::string guest_user_agent_override = renderer_prefs->user_agent_override; |
282 // Copy renderer preferences (and nothing else) from the embedder's | 288 // Copy renderer preferences (and nothing else) from the embedder's |
283 // WebContents to the guest. | 289 // WebContents to the guest. |
284 // | 290 // |
285 // For GTK and Aura this is necessary to get proper renderer configuration | 291 // For GTK and Aura this is necessary to get proper renderer configuration |
286 // values for caret blinking interval, colors related to selection and | 292 // values for caret blinking interval, colors related to selection and |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 last_pending_frame_->producing_host_id, | 628 last_pending_frame_->producing_host_id, |
623 ack); | 629 ack); |
624 last_pending_frame_.reset(); | 630 last_pending_frame_.reset(); |
625 } | 631 } |
626 delegate_->WillAttach(embedder_web_contents, browser_plugin_instance_id, | 632 delegate_->WillAttach(embedder_web_contents, browser_plugin_instance_id, |
627 params.is_full_page_plugin); | 633 params.is_full_page_plugin); |
628 | 634 |
629 // If a RenderView has already been created for this new window, then we need | 635 // If a RenderView has already been created for this new window, then we need |
630 // to initialize the browser-side state now so that the RenderFrameHostManager | 636 // to initialize the browser-side state now so that the RenderFrameHostManager |
631 // does not create a new RenderView on navigation. | 637 // does not create a new RenderView on navigation. |
632 if (has_render_view_) { | 638 //if (has_render_view_) { |
633 // This will trigger a callback to RenderViewReady after a round-trip IPC. | 639 // // This will trigger a callback to RenderViewReady after a round-trip IPC. |
634 static_cast<RenderViewHostImpl*>( | 640 // static_cast<RenderViewHostImpl*>( |
635 GetWebContents()->GetRenderViewHost())->Init(); | 641 // GetWebContents()->GetRenderViewHost())->Init(); |
636 WebContentsViewGuest* web_contents_view = | 642 // WebContentsViewGuest* web_contents_view = |
637 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); | 643 // static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
638 if (!web_contents()->GetRenderViewHost()->GetView()) { | 644 // if (!web_contents()->GetRenderViewHost()->GetView()) { |
639 web_contents_view->CreateViewForWidget( | 645 // web_contents_view->CreateViewForWidget( |
640 web_contents()->GetRenderViewHost(), true); | 646 // web_contents()->GetRenderViewHost(), true); |
641 } | 647 // } |
642 } | 648 //} |
643 | 649 |
644 InitInternal(params, embedder_web_contents); | 650 InitInternal(params, embedder_web_contents); |
645 | 651 |
646 attached_ = true; | 652 attached_ = true; |
647 SendQueuedMessages(); | 653 SendQueuedMessages(); |
648 | 654 |
649 delegate_->DidAttach(GetGuestProxyRoutingID()); | 655 delegate_->DidAttach(GetGuestProxyRoutingID()); |
650 | 656 |
651 has_render_view_ = true; | 657 //has_render_view_ = true; |
652 | 658 |
653 // Enable input method for guest if it's enabled for the embedder. | 659 //// Enable input method for guest if it's enabled for the embedder. |
654 if (static_cast<RenderViewHostImpl*>( | 660 //if (static_cast<RenderViewHostImpl*>( |
655 owner_web_contents_->GetRenderViewHost())->input_method_active()) { | 661 // owner_web_contents_->GetRenderViewHost())->input_method_active()) { |
656 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( | 662 // RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( |
657 GetWebContents()->GetRenderViewHost()); | 663 // GetWebContents()->GetRenderViewHost()); |
658 guest_rvh->SetInputMethodActive(true); | 664 // guest_rvh->SetInputMethodActive(true); |
659 } | 665 //} |
660 | 666 |
661 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); | 667 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); |
662 } | 668 } |
663 | 669 |
664 void BrowserPluginGuest::OnCompositorFrameSwappedACK( | 670 void BrowserPluginGuest::OnCompositorFrameSwappedACK( |
665 int browser_plugin_instance_id, | 671 int browser_plugin_instance_id, |
666 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { | 672 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { |
667 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, | 673 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, |
668 params.output_surface_id, | 674 params.output_surface_id, |
669 params.producing_host_id, | 675 params.producing_host_id, |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 void BrowserPluginGuest::OnImeCompositionRangeChanged( | 908 void BrowserPluginGuest::OnImeCompositionRangeChanged( |
903 const gfx::Range& range, | 909 const gfx::Range& range, |
904 const std::vector<gfx::Rect>& character_bounds) { | 910 const std::vector<gfx::Rect>& character_bounds) { |
905 static_cast<RenderWidgetHostViewBase*>( | 911 static_cast<RenderWidgetHostViewBase*>( |
906 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( | 912 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( |
907 range, character_bounds); | 913 range, character_bounds); |
908 } | 914 } |
909 #endif | 915 #endif |
910 | 916 |
911 } // namespace content | 917 } // namespace content |
OLD | NEW |