commit | 3bee08e25f92a3ecaeac0be34dd23fed3596e128 | [log] [tgz] |
---|---|---|
author | zijiehe <[email protected]> | Wed May 17 04:14:46 2017 |
committer | Commit bot <[email protected]> | Wed May 17 04:14:46 2017 |
tree | 30d0b0bbda69d12f2a50eb87ac1160060b90693b | |
parent | 29c52e534042bff7e45c4a2784d7f4922885b12a [diff] [blame] |
Add WebContentObserver::OnWebContentsLostFocus() In Keyboard Lock feature, we need to disable low level keyboard lock once the page lost focus. So this change adds a OnWebContentsLostFocus() callback in WebContentObserver to export the bluring action. For detail, please refer to the design doc at, https://docs.google.com/document/d/1T9gJHYdA1VGZ6QHQeOu0hOacWWWJ7yNEt1VDbLju4bs/edit#heading=h.cgwemqs2j4ta W3C Working Draft: https://garykac.github.io/system-keyboard-lock/ Intent to implement: https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/9pauQUAvrcw/lfbG7eunCAAJ BUG=680809 Review-Url: https://codereview.chromium.org/2877323002 Cr-Commit-Position: refs/heads/master@{#472319}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 5dc0a012..9a91bc9 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1862,6 +1862,11 @@ } } +void WebContentsImpl::RenderWidgetLostFocus( + RenderWidgetHostImpl* render_widget_host) { + NotifyWebContentsLostFocus(); +} + void WebContentsImpl::RenderWidgetWasResized( RenderWidgetHostImpl* render_widget_host, bool width_changed) { @@ -3292,6 +3297,11 @@ observer.OnWebContentsFocused(); } +void WebContentsImpl::NotifyWebContentsLostFocus() { + for (auto& observer : observers_) + observer.OnWebContentsLostFocus(); +} + void WebContentsImpl::SystemDragEnded(RenderWidgetHost* source_rwh) { if (source_rwh) source_rwh->DragSourceSystemDragEnded();