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

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

Issue 1934703002: Fix keyboard focus for OOPIF-<webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Fix tab focus change. Created 4 years, 7 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 645b6c7408ed7b6b940cf0b0a7577a276a0b4937..024b678b53a52c468d134dff1244b302b22dbfc4 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -463,6 +463,7 @@ class CONTENT_EXPORT WebContentsImpl
void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
const GURL& url) override;
+ void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
// RenderViewHostDelegate ----------------------------------------------------
RenderViewHostDelegateView* GetDelegateView() override;
@@ -810,26 +811,36 @@ private:
// corresponding FrameTreeNode.
struct WebContentsTreeNode {
public:
- WebContentsTreeNode();
+ WebContentsTreeNode(WebContentsImpl* inner);
alexmos 2016/05/12 20:28:42 nit: explicit?
avallee 2016/05/16 20:26:44 Done.
~WebContentsTreeNode();
- typedef std::set<WebContentsTreeNode*> ChildrenSet;
+ typedef std::unordered_map<int, WebContentsTreeNode*> ChildrenMap;
void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
RenderFrameHostImpl* outer_contents_frame);
- WebContentsImpl* outer_web_contents() { return outer_web_contents_; }
- int outer_contents_frame_tree_node_id() {
+ WebContentsImpl* outer_web_contents() const { return outer_web_contents_; }
+ int outer_contents_frame_tree_node_id() const {
return outer_contents_frame_tree_node_id_;
}
+ WebContentsImpl* FindContentsForFrame(int frame_id) {
alexmos 2016/05/12 20:28:42 This seems to be a FrameTreeNode id, so I'd rename
alexmos 2016/05/12 20:28:43 It might be better to mention "Inner" in the name
avallee 2016/05/16 20:26:44 Did something in that line.
+ return const_cast<WebContentsImpl*>(
+ static_cast<const WebContentsTreeNode*>(this)->FindContentsForFrame(
alexmos 2016/05/12 20:28:43 This doesn't look like it should be inlined (I thi
avallee 2016/05/16 20:26:44 This is trivial, it compiles down to calling the c
+ frame_id));
+ }
+ const WebContentsImpl* FindContentsForFrame(int frame_id) const;
alexmos 2016/05/12 20:28:42 Are two declarations for this really necessary?
avallee 2016/05/16 20:26:44 Find frame makes sense as a const function, but sh
alexmos 2016/05/19 00:08:09 I wasn't sure myself, so I ran this by nick@ and I
avallee 2016/05/24 20:07:07 Ack. So even though we implement WebContents, and
+
private:
- // The outer WebContents.
+ // The web contents that owns this node
alexmos 2016/05/12 20:28:43 nit: s/web contents/WebContents/ nit: period at th
avallee 2016/05/16 20:26:44 Done.
+ WebContentsImpl* const inner_web_contents_;
alexmos 2016/05/12 20:28:43 I found the naming of this confusing. It sounds s
avallee 2016/05/16 20:26:44 Agreed, done.
+
alexmos 2016/05/12 20:28:42 nit: either no blank line here, or blank lines sep
avallee 2016/05/16 20:26:44 Done.
+ // The outer WebContents
WebContentsImpl* outer_web_contents_;
// The ID of the FrameTreeNode in outer WebContents that is hosting us.
int outer_contents_frame_tree_node_id_;
// List of inner WebContents that we host.
- ChildrenSet inner_web_contents_tree_nodes_;
+ ChildrenMap inner_web_contents_tree_nodes_;
};
// See WebContents::Create for a description of these parameters.
@@ -969,6 +980,12 @@ private:
// up at the next animation step if the throbber is going.
void SetNotWaitingForResponse() { waiting_for_response_ = false; }
+ // Called by SetFocusedFrame. Split from SetFocusedFrame to prevent mutual
+ // recursion from inner to outer web contents.
+ void SetFocusedFrameInternal(FrameTreeNode* node,
+ SiteInstance* source,
+ bool can_visit_outer_contents);
+
// Navigation helpers --------------------------------------------------------
//
// These functions are helpers for Navigate() and DidNavigate().

Powered by Google App Engine
This is Rietveld 408576698