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

Side by Side 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: Added test and addressed comments. Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <functional> 10 #include <functional>
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 GeolocationServiceContext* GetGeolocationServiceContext() override; 456 GeolocationServiceContext* GetGeolocationServiceContext() override;
457 WakeLockServiceContext* GetWakeLockServiceContext() override; 457 WakeLockServiceContext* GetWakeLockServiceContext() override;
458 void EnterFullscreenMode(const GURL& origin) override; 458 void EnterFullscreenMode(const GURL& origin) override;
459 void ExitFullscreenMode(bool will_cause_resize) override; 459 void ExitFullscreenMode(bool will_cause_resize) override;
460 bool ShouldRouteMessageEvent( 460 bool ShouldRouteMessageEvent(
461 RenderFrameHost* target_rfh, 461 RenderFrameHost* target_rfh,
462 SiteInstance* source_site_instance) const override; 462 SiteInstance* source_site_instance) const override;
463 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; 463 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
464 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( 464 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
465 const GURL& url) override; 465 const GURL& url) override;
466 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
466 467
467 // RenderViewHostDelegate ---------------------------------------------------- 468 // RenderViewHostDelegate ----------------------------------------------------
468 RenderViewHostDelegateView* GetDelegateView() override; 469 RenderViewHostDelegateView* GetDelegateView() override;
469 bool OnMessageReceived(RenderViewHost* render_view_host, 470 bool OnMessageReceived(RenderViewHost* render_view_host,
470 const IPC::Message& message) override; 471 const IPC::Message& message) override;
471 // RenderFrameHostDelegate has the same method, so list it there because this 472 // RenderFrameHostDelegate has the same method, so list it there because this
472 // interface is going away. 473 // interface is going away.
473 // WebContents* GetAsWebContents() override; 474 // WebContents* GetAsWebContents() override;
474 void RenderViewCreated(RenderViewHost* render_view_host) override; 475 void RenderViewCreated(RenderViewHost* render_view_host) override;
475 void RenderViewReady(RenderViewHost* render_view_host) override; 476 void RenderViewReady(RenderViewHost* render_view_host) override;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 public: 813 public:
813 WebContentsTreeNode(); 814 WebContentsTreeNode();
814 ~WebContentsTreeNode(); 815 ~WebContentsTreeNode();
815 816
816 typedef std::set<WebContentsTreeNode*> ChildrenSet; 817 typedef std::set<WebContentsTreeNode*> ChildrenSet;
817 818
818 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, 819 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
819 RenderFrameHostImpl* outer_contents_frame); 820 RenderFrameHostImpl* outer_contents_frame);
820 821
821 WebContentsImpl* outer_web_contents() { return outer_web_contents_; } 822 WebContentsImpl* outer_web_contents() { return outer_web_contents_; }
822 int outer_contents_frame_tree_node_id() { 823 int outer_contents_frame_tree_node_id() const {
823 return outer_contents_frame_tree_node_id_; 824 return outer_contents_frame_tree_node_id_;
824 } 825 }
825 826
827 WebContentsImpl* focused_web_contents() { return focused_web_contents_; }
828
829 void SetFocusedWebContents(WebContentsImpl* web_contents);
830
826 private: 831 private:
827 // The outer WebContents. 832 // The outer WebContents.
828 WebContentsImpl* outer_web_contents_; 833 WebContentsImpl* outer_web_contents_;
829 // The ID of the FrameTreeNode in outer WebContents that is hosting us. 834 // The ID of the FrameTreeNode in outer WebContents that is hosting us.
830 int outer_contents_frame_tree_node_id_; 835 int outer_contents_frame_tree_node_id_;
831 // List of inner WebContents that we host. 836 // List of inner WebContents that we host.
832 ChildrenSet inner_web_contents_tree_nodes_; 837 ChildrenSet inner_web_contents_tree_nodes_;
838 // Only the root node should have this set. This indicates the WebContents
839 // whose frame tree has the focused frame.
840 WebContentsImpl* focused_web_contents_;
833 }; 841 };
834 842
835 // See WebContents::Create for a description of these parameters. 843 // See WebContents::Create for a description of these parameters.
836 WebContentsImpl(BrowserContext* browser_context); 844 WebContentsImpl(BrowserContext* browser_context);
837 845
838 // Add and remove observers for page navigation notifications. The order in 846 // Add and remove observers for page navigation notifications. The order in
839 // which notifications are sent to observers is undefined. Clients must be 847 // which notifications are sent to observers is undefined. Clients must be
840 // sure to remove the observer before they go away. 848 // sure to remove the observer before they go away.
841 void AddObserver(WebContentsObserver* observer); 849 void AddObserver(WebContentsObserver* observer);
842 void RemoveObserver(WebContentsObserver* observer); 850 void RemoveObserver(WebContentsObserver* observer);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 const base::string16& main_text, 970 const base::string16& main_text,
963 const base::string16& sub_text); 971 const base::string16& sub_text);
964 void OnHideValidationMessage(); 972 void OnHideValidationMessage();
965 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); 973 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view);
966 974
967 // Called by derived classes to indicate that we're no longer waiting for a 975 // Called by derived classes to indicate that we're no longer waiting for a
968 // response. This won't actually update the throbber, but it will get picked 976 // response. This won't actually update the throbber, but it will get picked
969 // up at the next animation step if the throbber is going. 977 // up at the next animation step if the throbber is going.
970 void SetNotWaitingForResponse() { waiting_for_response_ = false; } 978 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
971 979
980 // Returns the focused WebContents.
981 // If there are multiple inner/outer WebContents (when embedding <webview>,
982 // <guestview>, ...) returns the single one containing the currently focused
983 // frame. Otherwise, returns this WebContents.
984 WebContentsImpl* GetFocusedWebContents();
985
986 // Returns the root of the WebContents tree.
987 WebContentsImpl* GetOutermostWebContents();
988
972 // Navigation helpers -------------------------------------------------------- 989 // Navigation helpers --------------------------------------------------------
973 // 990 //
974 // These functions are helpers for Navigate() and DidNavigate(). 991 // These functions are helpers for Navigate() and DidNavigate().
975 992
976 // Handles post-navigation tasks in DidNavigate AFTER the entry has been 993 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
977 // committed to the navigation controller. Note that the navigation entry is 994 // committed to the navigation controller. Note that the navigation entry is
978 // not provided since it may be invalid/changed after being committed. The 995 // not provided since it may be invalid/changed after being committed. The
979 // current navigation entry is in the NavigationController at this point. 996 // current navigation entry is in the NavigationController at this point.
980 997
981 // If our controller was restored, update the max page ID associated with the 998 // If our controller was restored, update the max page ID associated with the
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 // Adds/removes a callback called on creation of each new WebContents. 1412 // Adds/removes a callback called on creation of each new WebContents.
1396 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); 1413 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1397 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); 1414 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1398 1415
1399 DISALLOW_COPY_AND_ASSIGN(FriendZone); 1416 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1400 }; 1417 };
1401 1418
1402 } // namespace content 1419 } // namespace content
1403 1420
1404 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1421 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698