[KeyboardLock] Chrome UX layer integration for fullscreen management
This CL integrates the KeyboardLock feature into the Chrome UX layer.
Integrating in the ExclusiveAccessManager allows fine grained control
over when KeyboardLock is activated (for instance we want keyboard lock
activated in tab-initiated fullscreen, but not in browser or content
fullscreen. The FullscreenController provides that nuanced level of
control for us.
Also, Keyboardlock should only be available to one
tab at a time which is conceptually the same as Fullscreen and
PointerLock.
Lastly, we need to integrate KeyboardLock logic into
the mechanism used for exiting fullscreen and displaying the exit
fullscreen instructions/bubble. Future CLs will add an animated
exit UX which is tied to the press and hold gesture, and a rapid
tap 'panic' timer which will reshow the exit instructions (these
two behaviors were suggested as part of the UX design process).
I have some initial browsertests for this feature however I have
not added interactive browsertests yet as I would like to get
feedback on the implementation before adding additional tests.
I will add those in a follow-up CL if this impl looks good.
BUG=680809
Change-Id: I6588367875934b59ba979cef65a73707c3d85320
Reviewed-on: https://chromium-review.googlesource.com/989021
Reviewed-by: Dominick Ng <[email protected]>
Reviewed-by: Yuri Wiitala <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Ilya Sherman <[email protected]>
Reviewed-by: Nick Carter <[email protected]>
Commit-Queue: Joe Downing <[email protected]>
Cr-Commit-Position: refs/heads/master@{#549230}
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 8e11d44..fc3df65c 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -430,6 +430,7 @@
void SetPageScale(float page_scale_factor) override;
gfx::Size GetPreferredSize() const override;
bool GotResponseToLockMouseRequest(bool allowed) override;
+ bool GotResponseToKeyboardLockRequest(bool allowed) override;
bool HasOpener() const override;
RenderFrameHostImpl* GetOpener() const override;
bool HasOriginalOpener() const override;
@@ -725,7 +726,8 @@
bool user_gesture,
bool last_unlocked_by_target,
bool privileged) override;
- bool RequestKeyboardLock(RenderWidgetHostImpl* render_widget_host) override;
+ bool RequestKeyboardLock(RenderWidgetHostImpl* render_widget_host,
+ bool esc_key_locked) override;
void CancelKeyboardLock(RenderWidgetHostImpl* render_widget_host) override;
RenderWidgetHostImpl* GetKeyboardLockWidget() override;
// The following function is already listed under WebContents overrides:
@@ -1671,6 +1673,11 @@
// if no RenderWidgetHost has the keyboard locked.
RenderWidgetHostImpl* keyboard_lock_widget_ = nullptr;
+ // Indicates whether the escape key is one of the requested keys to be locked.
+ // This information is used to drive the browser UI so the correct exit
+ // instructions are displayed to the user in fullscreen mode.
+ bool esc_key_locked_ = false;
+
#if defined(OS_ANDROID)
std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_;
#endif