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

Unified Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2411693003: Move blocking of top-level navigations to nested URLs with extension origins from non-extension pro… (Closed)
Patch Set: review comments Created 4 years, 2 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
Index: content/browser/frame_host/navigation_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index b0f6efe4efab876abe3faade52850886b9d2f0b9..05d7027eaed3abd615ab2f04091c19758d8a19ff 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -14,6 +14,7 @@
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/navigator_delegate.h"
+#include "content/browser/frame_host/render_frame_host_manager.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_navigation_handle.h"
#include "content/common/frame_messages.h"
@@ -91,6 +92,15 @@ NavigationHandleImpl::NavigationHandleImpl(
weak_factory_(this) {
DCHECK(!navigation_start.is_null());
redirect_chain_.push_back(url);
+
+ RenderFrameHostImpl* creator_frame =
+ frame_tree_node_->render_manager()->current_frame_host();
alexmos 2016/10/12 23:13:28 nit: This can be shortened to frame_tree_node_->cu
jam 2016/10/13 00:14:46 Done.
+ // TODO(jam): do we need to handle the case where there's no initial frame
+ // host? Revisit as more code uses this site instance which would expose
+ // missing cases.
+ if (creator_frame)
+ creator_site_instance_ = creator_frame->GetSiteInstance();
+
GetDelegate()->DidStartNavigation(this);
if (IsInMainFrame()) {
@@ -128,6 +138,10 @@ const GURL& NavigationHandleImpl::GetURL() {
return url_;
}
+SiteInstance* NavigationHandleImpl::GetCreatorSiteInstance() {
+ return creator_site_instance_.get();
+}
+
bool NavigationHandleImpl::IsInMainFrame() {
return frame_tree_node_->IsMainFrame();
}

Powered by Google App Engine
This is Rietveld 408576698