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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 int BrowserPluginGuest::GetGuestProxyRoutingID() { | 113 int BrowserPluginGuest::GetGuestProxyRoutingID() { |
114 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 114 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
115 // We don't use the proxy to send postMessage in --site-per-process, since | 115 // We don't use the proxy to send postMessage in --site-per-process, since |
116 // we use the contentWindow directly from the frame element instead. | 116 // we use the contentWindow directly from the frame element instead. |
117 return MSG_ROUTING_NONE; | 117 return MSG_ROUTING_NONE; |
118 } | 118 } |
119 | 119 |
120 if (guest_proxy_routing_id_ != MSG_ROUTING_NONE) | 120 if (guest_proxy_routing_id_ != MSG_ROUTING_NONE) |
121 return guest_proxy_routing_id_; | 121 return guest_proxy_routing_id_; |
122 | 122 |
123 // Create a swapped out RenderView for the guest in the embedder renderer | 123 // Create a RenderFrameProxyHost for the guest in the embedder renderer |
124 // process, so that the embedder can access the guest's window object. | 124 // process, so that the embedder can access the guest's window object. |
125 // On reattachment, we can reuse the same swapped out RenderView because | 125 // On reattachment, we can reuse the same RenderFrameProxyHost because |
126 // the embedder process will always be the same even if the embedder | 126 // the embedder process will always be the same even if the embedder |
127 // WebContents changes. | 127 // WebContents changes. |
128 // | 128 // |
129 // TODO(fsamuel): Make sure this works for transferring guests across | 129 // TODO(fsamuel): Make sure this works for transferring guests across |
130 // owners in different processes. We probably need to clear the | 130 // owners in different processes. We probably need to clear the |
131 // |guest_proxy_routing_id_| and perform any necessary cleanup on Detach | 131 // |guest_proxy_routing_id_| and perform any necessary cleanup on Detach |
132 // to enable this. | 132 // to enable this. |
133 SiteInstance* owner_site_instance = owner_web_contents_->GetSiteInstance(); | 133 SiteInstance* owner_site_instance = owner_web_contents_->GetSiteInstance(); |
134 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { | 134 int proxy_routing_id = |
135 int proxy_routing_id = | 135 GetWebContents()->GetFrameTree()->root()->render_manager()-> |
136 GetWebContents()->GetFrameTree()->root()->render_manager()-> | 136 CreateRenderFrameProxy(owner_site_instance); |
137 CreateRenderFrameProxy(owner_site_instance); | 137 guest_proxy_routing_id_ = RenderFrameProxyHost::FromID( |
138 guest_proxy_routing_id_ = RenderFrameProxyHost::FromID( | 138 owner_site_instance->GetProcess()->GetID(), proxy_routing_id) |
139 owner_site_instance->GetProcess()->GetID(), proxy_routing_id) | 139 ->GetRenderViewHost()->GetRoutingID(); |
140 ->GetRenderViewHost()->GetRoutingID(); | |
141 } else { | |
142 guest_proxy_routing_id_ = | |
143 GetWebContents()->CreateSwappedOutRenderView(owner_site_instance); | |
144 } | |
145 | 140 |
146 return guest_proxy_routing_id_; | 141 return guest_proxy_routing_id_; |
147 } | 142 } |
148 | 143 |
149 int BrowserPluginGuest::LoadURLWithParams( | 144 int BrowserPluginGuest::LoadURLWithParams( |
150 const NavigationController::LoadURLParams& load_params) { | 145 const NavigationController::LoadURLParams& load_params) { |
151 GetWebContents()->GetController().LoadURLWithParams(load_params); | 146 GetWebContents()->GetController().LoadURLWithParams(load_params); |
152 return GetGuestProxyRoutingID(); | 147 return GetGuestProxyRoutingID(); |
153 } | 148 } |
154 | 149 |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 range, character_bounds); | 1010 range, character_bounds); |
1016 } | 1011 } |
1017 #endif | 1012 #endif |
1018 | 1013 |
1019 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1014 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
1020 if (delegate_) | 1015 if (delegate_) |
1021 delegate_->SetContextMenuPosition(position); | 1016 delegate_->SetContextMenuPosition(position); |
1022 } | 1017 } |
1023 | 1018 |
1024 } // namespace content | 1019 } // namespace content |
OLD | NEW |