[KeyboardLock] Content layer integration

This change completes the KeybaoardLockServiceImpl class and hooks it
into the RenderWidgetHostImpl class.

RenderWidgetHostImpl is responsible for tracking the keys requested
to be locked, forwarding the request to WebContentsImpl, handling
the response from WebContentsImpl once the UX is fullscreen, and
then calling into the RenderWidgetHostView impl to actually request
KeyboardLock.

WebContentsImpl tracks the RenderWidgetHostImpl instance which has an
active KeyboardLock request.  It also calls back into that instance
once tab-initiated fullscreen is entered/exited.  Note that there are
two other approaches I could have taken here: I could have used a
WebContentsObserver class or I could have pushed this logic up
into the chrome layer (ExclusiveAccessManager related class).  I
chose the current approach as the logic needed for calling down to
the RenderWidgetHostImpl class is simple and only needed in a few
places.

RenderWidgetHostView is the class which will handle platform
specialization for the KeyboardLock request.  I've implemented this
logic for Aura in this CL, macOS will be completed in a follow-up.

My next CL will integrate KeyboardLock into the chrome layer and
implement ESC key handling and UX string display.  Also to be added
are some browser tests for this functionality.  These will be
required before we enable this functionality by default.

BUG=680809

Change-Id: I703d1ba27592943fff80432303583499d789a2ec
Reviewed-on: https://chromium-review.googlesource.com/939535
Commit-Queue: Joe Downing <[email protected]>
Reviewed-by: Nick Carter <[email protected]>
Cr-Commit-Position: refs/heads/master@{#545096}
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 21e4480..04446a61 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -722,6 +722,9 @@
                           bool user_gesture,
                           bool last_unlocked_by_target,
                           bool privileged) override;
+  bool RequestKeyboardLock(RenderWidgetHostImpl* render_widget_host) override;
+  void CancelKeyboardLock(RenderWidgetHostImpl* render_widget_host) override;
+  RenderWidgetHostImpl* GetKeyboardLockWidget() override;
   // The following function is already listed under WebContents overrides:
   // bool IsFullscreenForCurrentTab() const override;
   blink::WebDisplayMode GetDisplayMode(
@@ -1672,7 +1675,11 @@
 
   // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if
   // there's no RenderWidgetHost holding a lock.
-  RenderWidgetHostImpl* mouse_lock_widget_;
+  RenderWidgetHostImpl* mouse_lock_widget_ = nullptr;
+
+  // Stores the RenderWidgetHost that currently holds a keyboard lock or nullptr
+  // if no RenderWidgetHost has the keyboard locked.
+  RenderWidgetHostImpl* keyboard_lock_widget_ = nullptr;
 
 #if defined(OS_ANDROID)
   std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_;