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

Unified Diff: samples/fullscreen.html

Issue 149101: Add an example of cancelling fullscreen mode to the fullscreen. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Update patch to include an onunload in the unlikely event that it's necessary Created 11 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/fullscreen.html
===================================================================
--- samples/fullscreen.html (revision 19537)
+++ samples/fullscreen.html (working copy)
@@ -58,6 +58,7 @@
// Events
// init() once the page has finished loading.
window.onload = init;
+window.onunload = uninit;
// global variables
var g_o3d;
@@ -307,12 +308,30 @@
}
}
+var timeoutId;
function handleResizeEvent(event) {
// Only show the fullscreen banner if we're in plugin mode.
g_orthoRoot.visible = !event.fullscreen &&
document.getElementById("show_banner").checked;
setupCamera(g_teapotRoot);
+
+ // Set a timer to pop us back out of full-screen mode, just to show how easy
+ // it is to cancel. You need a user action [a mouse click] to get into
+ // full-screen mode, but you can revert back to a plugin without asking.
+ if (event.fullscreen &&
+ document.getElementById("cancel_fullscreen").checked) {
+ timeoutId = setTimeout(
+ function () {
+ g_client.cancelFullscreenDisplay()
+ },
+ 5000);
+ } else {
+ if (timeoutId) {
+ clearTimeout(timeoutId);
+ timeoutId = null;
+ }
+ }
}
function updateBanner() {
@@ -327,6 +346,13 @@
}
}
+function uninit() {
+ if (timeoutId) {
+ clearTimeout(timeoutId);
+ timeoutId = null;
+ }
+}
+
</script>
</head>
<body>
@@ -334,11 +360,17 @@
This tutorial shows how to toggle between plugin and full-screen display.
<p>It's built on top of helloworld.html; diff the two to see what changes were
necessary.
+<p>Shortly after transitioning to full-screen mode, the teapot will
+automatically revert back to plugin mode, to demonstrate how programs can cancel
+full-screen mode on demand.
<br/>
<!-- Start of O3D plugin -->
<div id="o3d" style="width: 600px; height: 600px;"></div>
<!-- End of O3D plugin -->
<input type="checkbox" id="show_banner" checked onclick=updateBanner()>
Show full-screen banner when not full-screen.</input>
+<br>
+<input type="checkbox" id="cancel_fullscreen" checked>
+Revert back to plugin mode automatically after a few seconds of full-screen mode.</input>
</body>
</html>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698