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();