Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

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

Powered by Google App Engine
This is Rietveld 408576698