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

Unified Diff: content/browser/web_contents/web_contents_impl.h

Issue 2700613003: Enable find-in-page across GuestViews. (Closed)
Patch Set: Created 3 years, 9 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/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 ab1ed3226c564f6f525aab8f23cf76b4d9d727a2..80e80a65a7537f674309e66841bafb51024730a9 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -131,10 +131,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.
@@ -267,6 +270,15 @@ 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();
+
+ // Returns a vector of all WebContentses within (and including) this one.
+ std::vector<WebContentsImpl*> GetWebContentsAndAllInner();
+
// WebContents ------------------------------------------------------
WebContentsDelegate* GetDelegate() override;
void SetDelegate(WebContentsDelegate* delegate) override;
@@ -809,6 +821,10 @@ class CONTENT_EXPORT WebContentsImpl
// |IsFullscreen| must return |true| when this method is called.
bool HasActiveEffectivelyFullscreenVideo() const;
+ // Called by this WebContents's BrowserPluginGuest (if one exists) to indicate
+ // that the guest will be destroyed.
+ void BrowserPluginGuestWillDestroy();
+
#if defined(OS_ANDROID)
// Called by FindRequestManager when all of the find match rects are in.
void NotifyFindMatchRectsReply(int version,
@@ -872,6 +888,8 @@ class CONTENT_EXPORT WebContentsImpl
explicit WebContentsTreeNode(WebContentsImpl* current_web_contents);
~WebContentsTreeNode() final;
+ typedef std::unordered_map<int, WebContentsTreeNode*> ChildrenMap;
ncarter (slow) 2017/03/27 23:21:37 This looks unused.
paulmeyer 2017/03/31 18:31:16 Yes, it is. Removed.
+
void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
RenderFrameHostImpl* outer_contents_frame);
@@ -884,7 +902,17 @@ 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);
+
+ // Fills |all_contents| with all inner WebContentsTreeNodes' WebContentses.
ncarter (slow) 2017/03/27 23:21:37 With this class comment, I would not expect that t
paulmeyer 2017/03/31 18:31:16 I agree that the use in FindRequestManager::GetChi
+ void GetAllInnerWebContents(std::vector<WebContentsImpl*>* all_contents);
+
private:
+ void AttachInnerWebContents(WebContentsImpl* inner_web_contents);
+ void DetachInnerWebContents(WebContentsImpl* inner_web_contents);
+
// FrameTreeNode::Observer implementation.
void OnFrameTreeNodeDestroyed(FrameTreeNode* node) final;
@@ -899,6 +927,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.
@@ -1075,12 +1106,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();
@@ -1189,7 +1214,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.

Powered by Google App Engine
This is Rietveld 408576698