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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // |guest_proxy_routing_id_| and perform any necessary cleanup on Detach | 140 // |guest_proxy_routing_id_| and perform any necessary cleanup on Detach |
141 // to enable this. | 141 // to enable this. |
142 // | 142 // |
143 // TODO(ekaramad): If the guest is embedded inside a cross-process <iframe> | 143 // TODO(ekaramad): If the guest is embedded inside a cross-process <iframe> |
144 // (e.g., <embed>-ed PDF), the reverse proxy will not be created and the | 144 // (e.g., <embed>-ed PDF), the reverse proxy will not be created and the |
145 // posted message's source attribute will be null which in turn breaks the | 145 // posted message's source attribute will be null which in turn breaks the |
146 // two-way messaging between the guest and the embedder. We should either | 146 // two-way messaging between the guest and the embedder. We should either |
147 // create a RenderFrameProxyHost for the reverse path, or implement | 147 // create a RenderFrameProxyHost for the reverse path, or implement |
148 // MimeHandlerViewGuest using OOPIF (https://crbug.com/659750). | 148 // MimeHandlerViewGuest using OOPIF (https://crbug.com/659750). |
149 SiteInstance* owner_site_instance = delegate_->GetOwnerSiteInstance(); | 149 SiteInstance* owner_site_instance = delegate_->GetOwnerSiteInstance(); |
150 if (!owner_site_instance) | |
151 return MSG_ROUTING_NONE; | |
152 int proxy_routing_id = GetWebContents() | 150 int proxy_routing_id = GetWebContents() |
153 ->GetFrameTree() | 151 ->GetFrameTree() |
154 ->root() | 152 ->root() |
155 ->render_manager() | 153 ->render_manager() |
156 ->CreateRenderFrameProxy(owner_site_instance); | 154 ->CreateRenderFrameProxy(owner_site_instance); |
157 guest_proxy_routing_id_ = RenderFrameProxyHost::FromID( | 155 guest_proxy_routing_id_ = RenderFrameProxyHost::FromID( |
158 owner_site_instance->GetProcess()->GetID(), proxy_routing_id) | 156 owner_site_instance->GetProcess()->GetID(), proxy_routing_id) |
159 ->GetRenderViewHost()->GetRoutingID(); | 157 ->GetRenderViewHost()->GetRoutingID(); |
160 | 158 |
161 return guest_proxy_routing_id_; | 159 return guest_proxy_routing_id_; |
(...skipping 11 matching lines...) Expand all Loading... |
173 last_seen_view_size_ = new_size; | 171 last_seen_view_size_ = new_size; |
174 } | 172 } |
175 } | 173 } |
176 | 174 |
177 void BrowserPluginGuest::SizeContents(const gfx::Size& new_size) { | 175 void BrowserPluginGuest::SizeContents(const gfx::Size& new_size) { |
178 GetWebContents()->GetView()->SizeContents(new_size); | 176 GetWebContents()->GetView()->SizeContents(new_size); |
179 } | 177 } |
180 | 178 |
181 void BrowserPluginGuest::WillDestroy() { | 179 void BrowserPluginGuest::WillDestroy() { |
182 is_in_destruction_ = true; | 180 is_in_destruction_ = true; |
183 | 181 owner_web_contents_ = nullptr; |
184 // It is important that the WebContents is notified of destruction before | |
185 // detaching. | |
186 GetWebContents()->BrowserPluginGuestWillDestroy(); | |
187 | |
188 attached_ = false; | 182 attached_ = false; |
189 owner_web_contents_ = nullptr; | |
190 } | 183 } |
191 | 184 |
192 RenderWidgetHostImpl* BrowserPluginGuest::GetOwnerRenderWidgetHost() const { | 185 RenderWidgetHostImpl* BrowserPluginGuest::GetOwnerRenderWidgetHost() const { |
193 return static_cast<RenderWidgetHostImpl*>( | 186 return static_cast<RenderWidgetHostImpl*>( |
194 delegate_->GetOwnerRenderWidgetHost()); | 187 delegate_->GetOwnerRenderWidgetHost()); |
195 } | 188 } |
196 | 189 |
197 void BrowserPluginGuest::Init() { | 190 void BrowserPluginGuest::Init() { |
198 if (initialized_) | 191 if (initialized_) |
199 return; | 192 return; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 GetSurfaceManager()->SatisfySequence(sequence); | 423 GetSurfaceManager()->SatisfySequence(sequence); |
431 } | 424 } |
432 | 425 |
433 void BrowserPluginGuest::OnRequireSequence( | 426 void BrowserPluginGuest::OnRequireSequence( |
434 int instance_id, | 427 int instance_id, |
435 const cc::SurfaceId& id, | 428 const cc::SurfaceId& id, |
436 const cc::SurfaceSequence& sequence) { | 429 const cc::SurfaceSequence& sequence) { |
437 GetSurfaceManager()->RequireSequence(id, sequence); | 430 GetSurfaceManager()->RequireSequence(id, sequence); |
438 } | 431 } |
439 | 432 |
| 433 bool BrowserPluginGuest::HandleFindForEmbedder( |
| 434 int request_id, |
| 435 const base::string16& search_text, |
| 436 const blink::WebFindOptions& options) { |
| 437 return delegate_->HandleFindForEmbedder(request_id, search_text, options); |
| 438 } |
| 439 |
| 440 bool BrowserPluginGuest::HandleStopFindingForEmbedder(StopFindAction action) { |
| 441 return delegate_->HandleStopFindingForEmbedder(action); |
| 442 } |
| 443 |
440 void BrowserPluginGuest::ResendEventToEmbedder( | 444 void BrowserPluginGuest::ResendEventToEmbedder( |
441 const blink::WebInputEvent& event) { | 445 const blink::WebInputEvent& event) { |
442 if (!attached() || !owner_web_contents_) | 446 if (!attached() || !owner_web_contents_) |
443 return; | 447 return; |
444 | 448 |
445 DCHECK(browser_plugin_instance_id_); | 449 DCHECK(browser_plugin_instance_id_); |
446 RenderWidgetHostViewBase* view = | 450 RenderWidgetHostViewBase* view = |
447 static_cast<RenderWidgetHostViewBase*>(GetOwnerRenderWidgetHostView()); | 451 static_cast<RenderWidgetHostViewBase*>(GetOwnerRenderWidgetHostView()); |
448 | 452 |
449 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); | 453 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 range, character_bounds); | 1060 range, character_bounds); |
1057 } | 1061 } |
1058 #endif | 1062 #endif |
1059 | 1063 |
1060 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1064 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
1061 if (delegate_) | 1065 if (delegate_) |
1062 delegate_->SetContextMenuPosition(position); | 1066 delegate_->SetContextMenuPosition(position); |
1063 } | 1067 } |
1064 | 1068 |
1065 } // namespace content | 1069 } // namespace content |
OLD | NEW |