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

Unified Diff: content/browser/frame_host/frame_tree_node.h

Issue 2679513002: Track the original opener of a webcontents so we can rely on it for popups (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/frame_tree_node.h
diff --git a/content/browser/frame_host/frame_tree_node.h b/content/browser/frame_host/frame_tree_node.h
index 581dfd2276455c5dcaf0174caa175fb95cb72079..10fe087ec4a028b261e4fdc8c2b53970be86ce2f 100644
--- a/content/browser/frame_host/frame_tree_node.h
+++ b/content/browser/frame_host/frame_tree_node.h
@@ -114,11 +114,19 @@ class CONTENT_EXPORT FrameTreeNode {
FrameTreeNode* opener() const { return opener_; }
+ FrameTreeNode* original_opener() const { return original_opener_; }
+
// Assigns a new opener for this node and, if |opener| is non-null, registers
// an observer that will clear this node's opener if |opener| is ever
// destroyed.
void SetOpener(FrameTreeNode* opener);
+ // Assigns the initial opener for this node, and if |opener| is non-null,
+ // registers an observer that will clear this node's opener if |opener| is
+ // ever destroyed.
+ // It is not possible to change the opener once it was set.
+ void SetOriginalOpener(FrameTreeNode* opener);
+
FrameTreeNode* child_at(size_t index) const {
return children_[index].get();
}
@@ -341,6 +349,14 @@ class CONTENT_EXPORT FrameTreeNode {
// is disowned.
std::unique_ptr<OpenerDestroyedObserver> opener_observer_;
+ // The frame that opened this frame, if any. Contrary to opener_, this
+ // cannot be changed unless the original opener is destroyed.
+ FrameTreeNode* original_opener_;
+
+ // An observer that clears this node's |original_opener_| if the opener is
+ // destroyed.
+ std::unique_ptr<OpenerDestroyedObserver> original_opener_observer_;
+
// The immediate children of this specific frame.
std::vector<std::unique_ptr<FrameTreeNode>> children_;
« no previous file with comments | « chrome/test/data/popup_blocker/popup-window-open-noopener.html ('k') | content/browser/frame_host/frame_tree_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698