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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1949163002: SendPageMessage() should not send to a WebView guest's embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revise comment. Created 4 years, 7 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
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 delete msg; 2496 delete msg;
2497 return; 2497 return;
2498 } 2498 }
2499 2499
2500 auto send_msg = [](IPC::Sender* sender, int routing_id, IPC::Message* msg) { 2500 auto send_msg = [](IPC::Sender* sender, int routing_id, IPC::Message* msg) {
2501 IPC::Message* copy = new IPC::Message(*msg); 2501 IPC::Message* copy = new IPC::Message(*msg);
2502 copy->set_routing_id(routing_id); 2502 copy->set_routing_id(routing_id);
2503 sender->Send(copy); 2503 sender->Send(copy);
2504 }; 2504 };
2505 2505
2506 for (const auto& pair : proxy_hosts_) 2506 // When sending a PageMessage for an inner WebContents, we don't want to also
2507 send_msg(pair.second.get(), pair.second->GetRoutingID(), msg); 2507 // send it to the outer WebContent's frame as well.
2508 RenderFrameProxyHost* outer_delegate_proxy =
2509 ForInnerDelegate() ? GetProxyToOuterDelegate() : nullptr;
2510 for (const auto& pair : proxy_hosts_) {
2511 if (outer_delegate_proxy != pair.second.get())
2512 send_msg(pair.second.get(), pair.second->GetRoutingID(), msg);
2513 }
2508 2514
2509 if (speculative_render_frame_host_) { 2515 if (speculative_render_frame_host_) {
2510 send_msg(speculative_render_frame_host_.get(), 2516 send_msg(speculative_render_frame_host_.get(),
2511 speculative_render_frame_host_->GetRoutingID(), msg); 2517 speculative_render_frame_host_->GetRoutingID(), msg);
2512 } else if (pending_render_frame_host_) { 2518 } else if (pending_render_frame_host_) {
2513 send_msg(pending_render_frame_host_.get(), 2519 send_msg(pending_render_frame_host_.get(),
2514 pending_render_frame_host_->GetRoutingID(), msg); 2520 pending_render_frame_host_->GetRoutingID(), msg);
2515 } 2521 }
2516 2522
2517 msg->set_routing_id(render_frame_host_->GetRoutingID()); 2523 msg->set_routing_id(render_frame_host_->GetRoutingID());
(...skipping 29 matching lines...) Expand all
2547 resolved_url)) { 2553 resolved_url)) {
2548 DCHECK(!dest_instance || 2554 DCHECK(!dest_instance ||
2549 dest_instance == render_frame_host_->GetSiteInstance()); 2555 dest_instance == render_frame_host_->GetSiteInstance());
2550 return false; 2556 return false;
2551 } 2557 }
2552 2558
2553 return true; 2559 return true;
2554 } 2560 }
2555 2561
2556 } // namespace content 2562 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698