Index: content/browser/web_contents/web_contents_impl.h |
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h |
index 5a621c32adb4b39566006e10f588efde2b39d2f2..0cd245bb71a1dfdfda2997deded38e561426eddc 100644 |
--- a/content/browser/web_contents/web_contents_impl.h |
+++ b/content/browser/web_contents/web_contents_impl.h |
@@ -132,10 +132,13 @@ class CONTENT_EXPORT WebContentsImpl |
static std::vector<WebContentsImpl*> GetAllWebContents(); |
- static WebContentsImpl* FromFrameTreeNode(FrameTreeNode* frame_tree_node); |
+ static WebContentsImpl* FromFrameTreeNode( |
+ const FrameTreeNode* frame_tree_node); |
static WebContents* FromRenderFrameHostID(int render_process_host_id, |
int render_frame_host_id); |
static WebContents* FromFrameTreeNodeId(int frame_tree_node_id); |
+ static WebContentsImpl* FromOuterFrameTreeNode( |
+ const FrameTreeNode* frame_tree_node); |
// Complex initialization here. Specifically needed to avoid having |
// members call back into our virtual functions in the constructor. |
@@ -268,6 +271,24 @@ class CONTENT_EXPORT WebContentsImpl |
// interface. |
WebContentsBindingSet* GetBindingSet(const std::string& interface_name); |
+ // Returns the focused WebContents. |
+ // If there are multiple inner/outer WebContents (when embedding <webview>, |
+ // <guestview>, ...) returns the single one containing the currently focused |
+ // frame. Otherwise, returns this WebContents. |
+ WebContentsImpl* GetFocusedWebContents(); |
+ |
+ // TODO(paulmeyer): Once GuestViews are no longer implemented as |
+ // BrowserPluginGuests, frame traversal across WebContents should be moved to |
+ // be handled by FrameTreeNode, and |GetInnerWebContents| and |
+ // |GetWebContentsAndAllInner| can be removed. |
+ |
+ // Returns a vector to the inner WebContents within this WebContents. |
+ std::vector<WebContentsImpl*> GetInnerWebContents(); |
+ |
+ // Returns a vector containing this WebContents and all inner WebContents |
+ // within it (recursively). |
+ std::vector<WebContentsImpl*> GetWebContentsAndAllInner(); |
+ |
// WebContents ------------------------------------------------------ |
WebContentsDelegate* GetDelegate() override; |
void SetDelegate(WebContentsDelegate* delegate) override; |
@@ -820,6 +841,10 @@ class CONTENT_EXPORT WebContentsImpl |
// deactivated. |
void SetAsFocusedWebContentsIfNecessary(); |
+ // Called by this WebContents's BrowserPluginGuest (if one exists) to indicate |
+ // that the guest will be detached. |
+ void BrowserPluginGuestWillDetach(); |
+ |
#if defined(OS_ANDROID) |
// Called by FindRequestManager when all of the find match rects are in. |
void NotifyFindMatchRectsReply(int version, |
@@ -895,7 +920,16 @@ class CONTENT_EXPORT WebContentsImpl |
WebContentsImpl* focused_web_contents() { return focused_web_contents_; } |
void SetFocusedWebContents(WebContentsImpl* web_contents); |
+ // Returns the inner WebContents within |frame|, if one exists, or nullptr |
+ // otherwise. |
+ WebContentsImpl* GetInnerWebContentsInFrame(const FrameTreeNode* frame); |
+ |
+ const std::vector<WebContentsImpl*>& inner_web_contents() const; |
+ |
private: |
+ void AttachInnerWebContents(WebContentsImpl* inner_web_contents); |
+ void DetachInnerWebContents(WebContentsImpl* inner_web_contents); |
+ |
// FrameTreeNode::Observer implementation. |
void OnFrameTreeNodeDestroyed(FrameTreeNode* node) final; |
@@ -910,6 +944,9 @@ class CONTENT_EXPORT WebContentsImpl |
// |current_web_contents_| as an inner WebContents. |
int outer_contents_frame_tree_node_id_; |
+ // List of inner WebContents that we host. |
+ std::vector<WebContentsImpl*> inner_web_contents_; |
+ |
// Only the root node should have this set. This indicates the WebContents |
// whose frame tree has the focused frame. The WebContents tree could be |
// arbitrarily deep. |
@@ -1087,12 +1124,6 @@ class CONTENT_EXPORT WebContentsImpl |
// receive page focus and blur events when the containing window changes focus |
// state. |
- // Returns the focused WebContents. |
- // If there are multiple inner/outer WebContents (when embedding <webview>, |
- // <guestview>, ...) returns the single one containing the currently focused |
- // frame. Otherwise, returns this WebContents. |
- WebContentsImpl* GetFocusedWebContents(); |
- |
// Returns true if |this| is the focused WebContents or an ancestor of the |
// focused WebContents. |
bool ContainsOrIsFocusedWebContents(); |
@@ -1193,7 +1224,11 @@ class CONTENT_EXPORT WebContentsImpl |
void SetJavaScriptDialogManagerForTesting( |
JavaScriptDialogManager* dialog_manager); |
- // Returns the FindRequestManager, or creates one if it doesn't already exist. |
+ // Returns the FindRequestManager, which may be found in an outer WebContents. |
+ FindRequestManager* GetFindRequestManager(); |
+ |
+ // Returns the FindRequestManager, or creates one if it doesn't already |
+ // exist. The FindRequestManager may be found in an outer WebContents. |
FindRequestManager* GetOrCreateFindRequestManager(); |
// Removes a registered WebContentsBindingSet by interface name. |