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

Side by Side Diff: content/browser/frame_host/frame_tree_node.h

Issue 2661403003: Track the original opener of a webcontents so we can rely on it for popups (Closed)
Patch Set: typo 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 unified diff | Download patch
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 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 size_t child_count() const { 109 size_t child_count() const {
110 return children_.size(); 110 return children_.size();
111 } 111 }
112 112
113 FrameTreeNode* parent() const { return parent_; } 113 FrameTreeNode* parent() const { return parent_; }
114 114
115 FrameTreeNode* opener() const { return opener_; } 115 FrameTreeNode* opener() const { return opener_; }
116 116
117 FrameTreeNode* original_opener() const { return original_opener_; }
118
117 // Assigns a new opener for this node and, if |opener| is non-null, registers 119 // Assigns a new opener for this node and, if |opener| is non-null, registers
118 // an observer that will clear this node's opener if |opener| is ever 120 // an observer that will clear this node's opener if |opener| is ever
119 // destroyed. 121 // destroyed.
120 void SetOpener(FrameTreeNode* opener); 122 void SetOpener(FrameTreeNode* opener);
121 123
124 // Assigns the initial opener for this node, and if |opener| is non-null,
125 // registers an observer that will clear this node's opener if |opener| is
126 // ever destroyed.
127 // It is not possible to change the opener once it was set.
128 void SetOriginalOpener(FrameTreeNode* opener);
129
122 FrameTreeNode* child_at(size_t index) const { 130 FrameTreeNode* child_at(size_t index) const {
123 return children_[index].get(); 131 return children_[index].get();
124 } 132 }
125 133
126 // Returns the URL of the last committed page in the current frame. 134 // Returns the URL of the last committed page in the current frame.
127 const GURL& current_url() const { 135 const GURL& current_url() const {
128 return current_frame_host()->last_committed_url(); 136 return current_frame_host()->last_committed_url();
129 } 137 }
130 138
131 // Sets the last committed URL for this frame and updates 139 // Sets the last committed URL for this frame and updates
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // window.opener to null. 342 // window.opener to null.
335 FrameTreeNode* opener_; 343 FrameTreeNode* opener_;
336 344
337 // An observer that clears this node's |opener_| if the opener is destroyed. 345 // An observer that clears this node's |opener_| if the opener is destroyed.
338 // This observer is added to the |opener_|'s observer list when the |opener_| 346 // This observer is added to the |opener_|'s observer list when the |opener_|
339 // is set to a non-null node, and it is removed from that list when |opener_| 347 // is set to a non-null node, and it is removed from that list when |opener_|
340 // changes or when this node is destroyed. It is also cleared if |opener_| 348 // changes or when this node is destroyed. It is also cleared if |opener_|
341 // is disowned. 349 // is disowned.
342 std::unique_ptr<OpenerDestroyedObserver> opener_observer_; 350 std::unique_ptr<OpenerDestroyedObserver> opener_observer_;
343 351
352 // The frame that opened this frame, if any. Contrary to opener_, this
353 // cannot be changed unless the original opener is destroyed.
354 FrameTreeNode* original_opener_;
355
356 // An observer that clears this node's |original_opener_| if the opener is
357 // destroyed.
358 std::unique_ptr<OpenerDestroyedObserver> original_opener_observer_;
359
344 // The immediate children of this specific frame. 360 // The immediate children of this specific frame.
345 std::vector<std::unique_ptr<FrameTreeNode>> children_; 361 std::vector<std::unique_ptr<FrameTreeNode>> children_;
346 362
347 // Whether this frame has committed any real load, replacing its initial 363 // Whether this frame has committed any real load, replacing its initial
348 // about:blank page. 364 // about:blank page.
349 bool has_committed_real_load_; 365 bool has_committed_real_load_;
350 366
351 // Track information that needs to be replicated to processes that have 367 // Track information that needs to be replicated to processes that have
352 // proxies for this frame. 368 // proxies for this frame.
353 FrameReplicationState replication_state_; 369 FrameReplicationState replication_state_;
(...skipping 30 matching lines...) Expand all
384 // browser process activities to this node (when possible). It is unrelated 400 // browser process activities to this node (when possible). It is unrelated
385 // to the core logic of FrameTreeNode. 401 // to the core logic of FrameTreeNode.
386 FrameTreeNodeBlameContext blame_context_; 402 FrameTreeNodeBlameContext blame_context_;
387 403
388 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 404 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
389 }; 405 };
390 406
391 } // namespace content 407 } // namespace content
392 408
393 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 409 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
OLDNEW
« 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