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

Unified Diff: content/browser/presentation/presentation_service_impl.cc

Issue 2949053002: [Presentation API] OffscreenPresentationManager should only interact with top level receiver frame (Closed)
Patch Set: resolve code review comments from ncarter Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/presentation/presentation_service_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/presentation/presentation_service_impl.cc
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc
index 6fb5641c60ac183f86feb0a642f0f09151575f0d..05d90e0eb4eb85adb951b5457f6993272b8e5f90 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -11,6 +11,8 @@
#include "base/logging.h"
#include "base/stl_util.h"
+#include "content/browser/frame_host/frame_tree_node.h"
+#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
@@ -59,8 +61,11 @@ PresentationServiceImpl::PresentationServiceImpl(
render_process_id_ = render_frame_host->GetProcess()->GetID();
render_frame_id_ = render_frame_host->GetRoutingID();
- DVLOG(2) << "PresentationServiceImpl: "
- << render_process_id_ << ", " << render_frame_id_;
+ auto* rfh_impl = static_cast<RenderFrameHostImpl*>(render_frame_host);
+ is_main_frame_ = rfh_impl->frame_tree_node()->IsMainFrame();
ncarter (slow) 2017/06/23 19:49:01 I forgot -- you can do this without the cast by ju
ncarter (slow) 2017/06/23 19:49:33 (no parent means yes main frame)
zhaobin 2017/06/23 21:34:12 Done.
+
+ DVLOG(2) << "PresentationServiceImpl: " << render_process_id_ << ", "
+ << render_frame_id_ << " is main frame: " << is_main_frame_;
if (auto* delegate = GetPresentationServiceDelegate())
delegate->AddObserver(render_process_id_, render_frame_id_, this);
@@ -114,7 +119,7 @@ void PresentationServiceImpl::SetClient(
// TODO(imcheng): Set ErrorHandler to listen for errors.
client_ = std::move(client);
- if (receiver_delegate_) {
+ if (receiver_delegate_ && is_main_frame_) {
receiver_delegate_->RegisterReceiverConnectionAvailableCallback(
base::Bind(&PresentationServiceImpl::OnReceiverConnectionAvailable,
weak_factory_.GetWeakPtr()));
@@ -428,8 +433,11 @@ void PresentationServiceImpl::WebContentsDestroyed() {
void PresentationServiceImpl::Reset() {
DVLOG(2) << "PresentationServiceImpl::Reset";
- if (auto* delegate = GetPresentationServiceDelegate())
- delegate->Reset(render_process_id_, render_frame_id_);
+ if (controller_delegate_)
+ controller_delegate_->Reset(render_process_id_, render_frame_id_);
+
+ if (receiver_delegate_ && is_main_frame_)
+ receiver_delegate_->Reset(render_process_id_, render_frame_id_);
default_presentation_urls_.clear();
« no previous file with comments | « content/browser/presentation/presentation_service_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698