summaryrefslogtreecommitdiffstats
path: root/ppapi/examples
diff options
context:
space:
mode:
authortzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-26 07:35:15 +0000
committertzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-26 07:35:15 +0000
commit9f064462db5b4a434d5897d524640797c55fb1b1 (patch)
tree3d3901cc25f2b1b73a5b018079a96e9113fda5ab /ppapi/examples
parenta596e11f92a756e946ee1c4c64e9d9c083d13a2a (diff)
downloadchromium_src-9f064462db5b4a434d5897d524640797c55fb1b1.zip
chromium_src-9f064462db5b4a434d5897d524640797c55fb1b1.tar.gz
chromium_src-9f064462db5b4a434d5897d524640797c55fb1b1.tar.bz2
Revert 119206 - 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 TBR=scheib@chromium.org Review URL: https://chromiumcodereview.appspot.com/9293001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119208 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.html54
2 files changed, 19 insertions, 40 deletions
diff --git a/ppapi/examples/mouse_lock/mouse_lock.cc b/ppapi/examples/mouse_lock/mouse_lock.cc
index f6bfbb6..6a934ba 100644
--- a/ppapi/examples/mouse_lock/mouse_lock.cc
+++ b/ppapi/examples/mouse_lock/mouse_lock.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,9 +75,8 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
LockMouse(callback_factory_.NewRequiredCallback(
&MyInstance::DidLockMouse));
}
- return true;
}
- return false;
+ return true;
}
default:
return false;
diff --git a/ppapi/examples/mouse_lock/mouse_lock.html b/ppapi/examples/mouse_lock/mouse_lock.html
index 5f0e5aa..5ce2261 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) 2012 The Chromium Authors. All rights reserved.
+ Copyright (c) 2011 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,6 +13,16 @@
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">
@@ -51,45 +61,15 @@
</li>
</ul>
<div>
- <button onclick="ToggleFullscreen();">
+ <button id="toggle_fullscreen" 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>