Allow WebView to directly observe focus change of its WebContents.
Currently WebContentsDelegate::WebContentsFocused exists, but not
WebContentsObserver::WebContentsFocused. WebContentsDelegate::WebContentsFocused
exists only to allow views::WebView to call View::RequestFocus. Unfortunately,
views::WebView is only a delegate of the WebContentses that it creates itself
(it only *observes* the WebContentses that it owns via SetWebContents). However,
this makes every delegate responsible for forwarding focus events to the
views::WebView, which is not robust.
This CL resolves a TODO in WebView to allow the views::WebView to *observe* the
focus change of its WebContents and eliminates
WebContentsDelegate::WebContentsFocused.
This fixes an issue in the app list where no delegate was forwarding focus
changes to the custom launcher page's WebView.
BUG=458371
Review URL: https://codereview.chromium.org/959613002
Cr-Commit-Position: refs/heads/master@{#324584}
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 3c45bd5..df36f49e 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -177,6 +177,9 @@
RenderFrameHost* render_frame_host,
const ResourceRedirectDetails& details);
+ // Notify observers that the web contents has been focused.
+ void NotifyWebContentsFocused();
+
WebContentsView* GetView() const;
ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host() {