diff options
author | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 07:13:20 +0000 |
---|---|---|
committer | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 07:13:20 +0000 |
commit | e39037d2b7adaa7c4518a49faa5ddc78ac895efa (patch) | |
tree | 1a02d96c2a42b045869e641bceca137112700ca7 /ppapi | |
parent | ef4113beaa7c033fef93b9814c2bc6fb5a88b2fb (diff) | |
download | chromium_src-e39037d2b7adaa7c4518a49faa5ddc78ac895efa.zip chromium_src-e39037d2b7adaa7c4518a49faa5ddc78ac895efa.tar.gz chromium_src-e39037d2b7adaa7c4518a49faa5ddc78ac895efa.tar.bz2 |
Mouse Lock is currently supported in Pepper, but not yet supported from WebKit.
Move the render thread logic for managing the mouse lock state out of the pepper_plugin_delegate_impl, and into a higher level dispatcher for render_view_impl.
Handle mouse lock / pointer lock requests from both pepper and webkit (WebKit API not yet landed, small TODOs left in this code to enable once that lands).
BUG=109957
TEST=Pepper examples/mouse_lock and NaCl mouse lock examples still work.
Review URL: http://codereview.chromium.org/8970016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/examples/mouse_lock/mouse_lock.cc | 5 | ||||
-rw-r--r-- | ppapi/examples/mouse_lock/mouse_lock.html | 54 |
2 files changed, 40 insertions, 19 deletions
diff --git a/ppapi/examples/mouse_lock/mouse_lock.cc b/ppapi/examples/mouse_lock/mouse_lock.cc index 6a934ba..f6bfbb6 100644 --- a/ppapi/examples/mouse_lock/mouse_lock.cc +++ b/ppapi/examples/mouse_lock/mouse_lock.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -75,8 +75,9 @@ class MyInstance : public pp::Instance, public pp::MouseLock { LockMouse(callback_factory_.NewRequiredCallback( &MyInstance::DidLockMouse)); } + return true; } - return true; + return false; } default: return false; diff --git a/ppapi/examples/mouse_lock/mouse_lock.html b/ppapi/examples/mouse_lock/mouse_lock.html index 5ce2261..5f0e5aa 100644 --- a/ppapi/examples/mouse_lock/mouse_lock.html +++ b/ppapi/examples/mouse_lock/mouse_lock.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <!-- - Copyright (c) 2011 The Chromium Authors. All rights reserved. + Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> @@ -13,16 +13,6 @@ height: 100%; } </style> - <script> - function ToggleFullscreen() { - if (document.webkitIsFullScreen) { - document.webkitCancelFullScreen(); - } else { - document.getElementById('container').webkitRequestFullScreen( - Element.ALLOW_KEYBOARD_INPUT); - } - } - </script> </head> <body title="This tooltip should not be shown if the mouse is locked."> <div id="container"> @@ -61,15 +51,45 @@ </li> </ul> <div> - <button id="toggle_fullscreen" onclick="ToggleFullscreen();"> + <button onclick="ToggleFullscreen();"> Toggle Tab Fullscreen </button> + <button onclick="AddAPlugin();"> + Add A Plugin + </button> + <button onclick="RemoveAPlugin();"> + Remove A Plugin (press 'x') + </button> + </div> + <div id="plugins_container"> </div> - <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> </body> +<script> + plugins_container = document.getElementById("plugins_container"); + AddAPlugin(); + AddAPlugin(); + + function ToggleFullscreen() { + if (document.webkitIsFullScreen) { + document.webkitCancelFullScreen(); + } else { + document.getElementById('container').webkitRequestFullScreen( + Element.ALLOW_KEYBOARD_INPUT); + } + } + function AddAPlugin() { + plugins_container.insertAdjacentHTML("BeforeEnd", + '<object type="application/x-ppapi-example-mouse-lock" ' + + 'width="300" height="300" border="2px"></object>'); + } + function RemoveAPlugin() { + if (plugins_container.firstElementChild) + plugins_container.removeChild(plugins_container.firstElementChild); + } + document.body.onkeydown = function (e) { + if (String.fromCharCode(e.keyCode) == "X") + RemoveAPlugin(); + } +</script> </html> |