summaryrefslogtreecommitdiffstats
path: root/ppapi/examples
diff options
context:
space:
mode:
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, 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>