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

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

Issue 921473006: GuestView: Fix message routing across embedder navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove render_view_routing_id() from GuestViewContainer Created 5 years, 10 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_embedder.h" 5 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "content/browser/browser_plugin/browser_plugin_guest.h" 8 #include "content/browser/browser_plugin/browser_plugin_guest.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return false; 91 return false;
92 } 92 }
93 93
94 void BrowserPluginEmbedder::DidSendScreenRects() { 94 void BrowserPluginEmbedder::DidSendScreenRects() {
95 GetBrowserPluginGuestManager()->ForEachGuest( 95 GetBrowserPluginGuestManager()->ForEachGuest(
96 GetWebContents(), base::Bind( 96 GetWebContents(), base::Bind(
97 &BrowserPluginEmbedder::DidSendScreenRectsCallback)); 97 &BrowserPluginEmbedder::DidSendScreenRectsCallback));
98 } 98 }
99 99
100 bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) { 100 bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
101 return OnMessageReceived(message, nullptr);
102 }
103
104 bool BrowserPluginEmbedder::OnMessageReceived(
105 const IPC::Message& message,
106 RenderFrameHost* render_frame_host) {
101 bool handled = true; 107 bool handled = true;
102 IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message) 108 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(BrowserPluginEmbedder, message,
109 render_frame_host)
103 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Attach, OnAttach) 110 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Attach, OnAttach)
104 IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor, 111 IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor,
105 OnUpdateDragCursor(&handled)); 112 OnUpdateDragCursor(&handled));
106 IPC_MESSAGE_UNHANDLED(handled = false) 113 IPC_MESSAGE_UNHANDLED(handled = false)
107 IPC_END_MESSAGE_MAP() 114 IPC_END_MESSAGE_MAP()
108 return handled; 115 return handled;
109 } 116 }
110 117
111 void BrowserPluginEmbedder::DragSourceEndedAt(int client_x, int client_y, 118 void BrowserPluginEmbedder::DragSourceEndedAt(int client_x, int client_y,
112 int screen_x, int screen_y, blink::WebDragOperation operation) { 119 int screen_x, int screen_y, blink::WebDragOperation operation) {
(...skipping 15 matching lines...) Expand all
128 135
129 guest_dragging_over_.reset(); 136 guest_dragging_over_.reset();
130 ClearGuestDragStateIfApplicable(); 137 ClearGuestDragStateIfApplicable();
131 } 138 }
132 139
133 void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) { 140 void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) {
134 *handled = (guest_dragging_over_.get() != NULL); 141 *handled = (guest_dragging_over_.get() != NULL);
135 } 142 }
136 143
137 void BrowserPluginEmbedder::OnAttach( 144 void BrowserPluginEmbedder::OnAttach(
145 RenderFrameHost* render_frame_host,
138 int browser_plugin_instance_id, 146 int browser_plugin_instance_id,
139 const BrowserPluginHostMsg_Attach_Params& params) { 147 const BrowserPluginHostMsg_Attach_Params& params) {
148 int owner_process_id = render_frame_host ?
Charlie Reis 2015/02/13 21:21:56 I don't think we should support the case that this
Fady Samuel 2015/02/13 22:31:25 Using the GetWebContents()->GetRenderProcessHost()
149 render_frame_host->GetProcess()->GetID() :
150 GetWebContents()->GetRenderProcessHost()->GetID();
151
140 WebContents* guest_web_contents = 152 WebContents* guest_web_contents =
141 GetBrowserPluginGuestManager()->GetGuestByInstanceID( 153 GetBrowserPluginGuestManager()->GetGuestByInstanceID(
142 GetWebContents(), browser_plugin_instance_id); 154 owner_process_id,
155 browser_plugin_instance_id);
143 if (!guest_web_contents) 156 if (!guest_web_contents)
144 return; 157 return;
145 BrowserPluginGuest* guest = static_cast<WebContentsImpl*>(guest_web_contents) 158 BrowserPluginGuest* guest = static_cast<WebContentsImpl*>(guest_web_contents)
146 ->GetBrowserPluginGuest(); 159 ->GetBrowserPluginGuest();
147 guest->Attach(browser_plugin_instance_id, GetWebContents(), params); 160 guest->Attach(browser_plugin_instance_id, GetWebContents(), params);
148 } 161 }
149 162
150 bool BrowserPluginEmbedder::HandleKeyboardEvent( 163 bool BrowserPluginEmbedder::HandleKeyboardEvent(
151 const NativeWebKeyboardEvent& event) { 164 const NativeWebKeyboardEvent& event) {
152 if ((event.windowsKeyCode != ui::VKEY_ESCAPE) || 165 if ((event.windowsKeyCode != ui::VKEY_ESCAPE) ||
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest() 224 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()
212 ->StopFinding(action)) { 225 ->StopFinding(action)) {
213 // There can only ever currently be one browser plugin that handles find so 226 // There can only ever currently be one browser plugin that handles find so
214 // we can break the iteration at this point. 227 // we can break the iteration at this point.
215 return true; 228 return true;
216 } 229 }
217 return false; 230 return false;
218 } 231 }
219 232
220 } // namespace content 233 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698