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

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: Simplify approach based on alexmos feedback. 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..31d582d344d323238f973ba5691e83828011ddc0 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,38 @@ private:
// corresponding FrameTreeNode.
struct WebContentsTreeNode {
public:
- WebContentsTreeNode();
+ explicit WebContentsTreeNode(WebContentsImpl* web_contents);
~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() {
+ int outer_contents_frame_tree_node_id() const {
return outer_contents_frame_tree_node_id_;
}
+ WebContentsImpl* get_focused_web_contents() {
alexmos 2016/05/26 00:32:25 nit: just focused_web_contents(), mirroring naming
avallee 2016/06/07 15:37:44 Done.
+ return focused_web_contents_;
+ }
+
+ void SetFocusedWebContents(WebContentsImpl* web_contents);
+
private:
+ // The WebContents that owns this node.
+ WebContentsImpl* web_contents_;
alexmos 2016/05/26 00:32:25 This looks unused now.
avallee 2016/06/07 15:37:44 Removed.
// 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_;
+ // List of inner WebContents, mapped by id of the FrameTreeNode hosting
+ // them.
+ ChildrenMap inner_web_contents_tree_nodes_;
alexmos 2016/05/26 00:32:26 Is the transformation to use a map here still nece
avallee 2016/06/07 15:37:44 I think it will be necessary for page focus settin
+ // Only the root node should have this set. This indicates the WebContents
+ // whose frame tree has the focused frame.
+ WebContentsImpl* focused_web_contents_;
alexmos 2016/05/26 00:32:26 It's unfortunate that we have to keep this around
};
// See WebContents::Create for a description of these parameters.
@@ -969,6 +982,12 @@ private:
// up at the next animation step if the throbber is going.
void SetNotWaitingForResponse() { waiting_for_response_ = false; }
+ // Returns the focused WebContents.
alexmos 2016/05/26 00:32:26 nit: expand a bit on what this is for. I.e., if t
avallee 2016/06/07 15:37:44 Done.
+ WebContentsImpl* GetFocusedWebContents();
+
+ // Returns the root of the WebContents tree.
+ WebContentsImpl* GetOutermostWebContents();
+
// Navigation helpers --------------------------------------------------------
//
// These functions are helpers for Navigate() and DidNavigate().

Powered by Google App Engine
This is Rietveld 408576698