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

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

Issue 2700613003: Enable find-in-page across GuestViews. (Closed)
Patch Set: Small fix. Created 3 years, 8 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;
184 } 191 }
185 192
186 RenderWidgetHostImpl* BrowserPluginGuest::GetOwnerRenderWidgetHost() const { 193 RenderWidgetHostImpl* BrowserPluginGuest::GetOwnerRenderWidgetHost() const {
187 return static_cast<RenderWidgetHostImpl*>( 194 return static_cast<RenderWidgetHostImpl*>(
188 delegate_->GetOwnerRenderWidgetHost()); 195 delegate_->GetOwnerRenderWidgetHost());
189 } 196 }
190 197
191 void BrowserPluginGuest::Init() { 198 void BrowserPluginGuest::Init() {
192 if (initialized_) 199 if (initialized_)
193 return; 200 return;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 GetSurfaceManager()->SatisfySequence(sequence); 432 GetSurfaceManager()->SatisfySequence(sequence);
426 } 433 }
427 434
428 void BrowserPluginGuest::OnRequireSequence( 435 void BrowserPluginGuest::OnRequireSequence(
429 int instance_id, 436 int instance_id,
430 const cc::SurfaceId& id, 437 const cc::SurfaceId& id,
431 const cc::SurfaceSequence& sequence) { 438 const cc::SurfaceSequence& sequence) {
432 GetSurfaceManager()->RequireSequence(id, sequence); 439 GetSurfaceManager()->RequireSequence(id, sequence);
433 } 440 }
434 441
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( 442 void BrowserPluginGuest::ResendEventToEmbedder(
447 const blink::WebInputEvent& event) { 443 const blink::WebInputEvent& event) {
448 if (!attached() || !owner_web_contents_) 444 if (!attached() || !owner_web_contents_)
449 return; 445 return;
450 446
451 DCHECK(browser_plugin_instance_id_); 447 DCHECK(browser_plugin_instance_id_);
452 RenderWidgetHostViewBase* view = 448 RenderWidgetHostViewBase* view =
453 static_cast<RenderWidgetHostViewBase*>(GetOwnerRenderWidgetHostView()); 449 static_cast<RenderWidgetHostViewBase*>(GetOwnerRenderWidgetHostView());
454 450
455 gfx::Vector2d offset_from_embedder = guest_window_rect_.OffsetFromOrigin(); 451 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); 1057 range, character_bounds);
1062 } 1058 }
1063 #endif 1059 #endif
1064 1060
1065 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { 1061 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) {
1066 if (delegate_) 1062 if (delegate_)
1067 delegate_->SetContextMenuPosition(position); 1063 delegate_->SetContextMenuPosition(position);
1068 } 1064 }
1069 1065
1070 } // namespace content 1066 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/browser/find_request_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698