Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: ppapi/examples/mouse_lock/mouse_lock.html

Issue 8970016: refactoring mouse lock to support pepper and WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes & WebKit APIs are bound now. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/examples/mouse_lock/mouse_lock.html
diff --git a/ppapi/examples/mouse_lock/mouse_lock.html b/ppapi/examples/mouse_lock/mouse_lock.html
index 5ce226109645c56506d1505abf326226f1a1411b..cd180272ae59d6f4fce099f3f20df25232c75542 100644
--- a/ppapi/examples/mouse_lock/mouse_lock.html
+++ b/ppapi/examples/mouse_lock/mouse_lock.html
@@ -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>

Powered by Google App Engine
This is Rietveld 408576698