summaryrefslogtreecommitdiffstats
path: root/ppapi/examples
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-01 01:38:12 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-01 01:38:12 +0000
commit5d5f7af66e100999851a743a1e15cd1641df72c6 (patch)
treeec926577892e9fc373881abc2fa89eb4af8fc22a /ppapi/examples
parent7075f0b9eb6fd3dd20f8900c4f05ae69f152a089 (diff)
downloadchromium_src-5d5f7af66e100999851a743a1e15cd1641df72c6.zip
chromium_src-5d5f7af66e100999851a743a1e15cd1641df72c6.tar.gz
chromium_src-5d5f7af66e100999851a743a1e15cd1641df72c6.tar.bz2
Only allow to lock the mouse when the tab is in fullscreen mode.
BUG=41781 TEST=Manual test in ppapi/examples/mouse_lock. Review URL: http://codereview.chromium.org/8072011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103612 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/examples')
-rw-r--r--ppapi/examples/mouse_lock/mouse_lock.cc5
-rw-r--r--ppapi/examples/mouse_lock/mouse_lock.html72
2 files changed, 63 insertions, 14 deletions
diff --git a/ppapi/examples/mouse_lock/mouse_lock.cc b/ppapi/examples/mouse_lock/mouse_lock.cc
index 95806cf5..0b86a4b 100644
--- a/ppapi/examples/mouse_lock/mouse_lock.cc
+++ b/ppapi/examples/mouse_lock/mouse_lock.cc
@@ -53,8 +53,9 @@ class MyInstance : public pp::Instance, public pp::MouseLock_Dev {
!mouse_locked_) {
LockMouse(
callback_factory_.NewRequiredCallback(&MyInstance::DidLockMouse));
- } else if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT &&
- mouse_locked_) {
+ } else if (
+ mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE &&
+ mouse_locked_) {
UnlockMouse();
}
return true;
diff --git a/ppapi/examples/mouse_lock/mouse_lock.html b/ppapi/examples/mouse_lock/mouse_lock.html
index 3f8841fa..39bd4e2 100644
--- a/ppapi/examples/mouse_lock/mouse_lock.html
+++ b/ppapi/examples/mouse_lock/mouse_lock.html
@@ -7,19 +7,67 @@
-->
<head>
<title>Mouse Lock Example</title>
+ <style type="text/css">
+ :-webkit-full-screen {
+ width: 100%;
+ height: 100%;
+ }
+ </style>
+ <script>
+ var fullscreen = false;
+ function ToggleFullscreen() {
+ if (fullscreen) {
+ document.webkitCancelFullScreen();
+ } else {
+ document.getElementById('container').webkitRequestFullScreen(
+ Element.ALLOW_KEYBOARD_INPUT);
+ }
+ fullscreen = !fullscreen;
+ }
+ </script>
</head>
-
<body title="This tooltip should not be shown if the mouse is locked.">
-<ul>
- <li>Lock mouse: left click in either of the two boxes; or right click in
- either of the boxes to ensure that it is focused and then press Enter key.
- </li>
- <li>Unlock mouse: lose focus, press Esc key, or right click.</li>
-</ul>
-<object id="plugin" type="application/x-ppapi-example-mouse-lock"
- width="300" height="300" border="2px"></object>
-<div></div>
-<object id="plugin" type="application/x-ppapi-example-mouse-lock"
- width="300" height="300" border="2px"></object>
+<div id="container">
+ <ul>
+ <li>There are two different kinds of fullscreen mode - "tab fullscreen" and
+ "browser fullscreen".
+ <ul>
+ <li>"tab fullscreen" refers to when a tab enters fullscreen mode via the
+ JS or Pepper fullscreen API;</li>
+ <li>"browser fullscreen" refers to the user putting the browser itself
+ into fullscreen mode from the UI (e.g., pressing F11).</li>
+ </ul>
+ <span style="font-weight:bold">
+ NOTE: Mouse lock is only allowed in "tab fullscreen" mode.
+ </span>
+ </li>
+ <li>Lock mouse:
+ <ul>
+ <li>left click in either of the two boxes; or</li>
+ <li>right click in either of the boxes to ensure that it is focused and
+ then press Enter key. (You could verify that the tooltip window is
+ dismissed properly by this second approach.)</li>
+ </ul>
+ </li>
+ <li>Unlock mouse:
+ <ul>
+ <li>lose focus; or</li>
+ <li>press Esc key; or</li>
+ <li>middle click; or</li>
+ <li>exit from the "tab fullscreen" mode.</li>
+ </ul>
+ </li>
+ </ul>
+ <object id="plugin" type="application/x-ppapi-example-mouse-lock"
+ width="300" height="300" border="2px"></object>
+ <div></div>
+ <object id="plugin" type="application/x-ppapi-example-mouse-lock"
+ width="300" height="300" border="2px"></object>
+ <div>
+ <button id="toggle_fullscreen" onclick="ToggleFullscreen();">
+ Toggle Tab Fullscreen
+ </button>
+ </div>
+</div>
</body>
</html>