summaryrefslogtreecommitdiffstats
path: root/o3d/samples/fullscreen.html
diff options
context:
space:
mode:
authorericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-30 01:52:48 +0000
committerericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-30 01:52:48 +0000
commit8784a7c3fafb6eafbd434c83df94f4a146a0ce9f (patch)
treec25614bfce64c3113979c4ab14006022951a712c /o3d/samples/fullscreen.html
parente46c47f8f360ed1fadb6a921f32bff4a17d57861 (diff)
downloadchromium_src-8784a7c3fafb6eafbd434c83df94f4a146a0ce9f.zip
chromium_src-8784a7c3fafb6eafbd434c83df94f4a146a0ce9f.tar.gz
chromium_src-8784a7c3fafb6eafbd434c83df94f4a146a0ce9f.tar.bz2
Review URL: http://codereview.chromium.org/149101
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19574 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/fullscreen.html')
-rw-r--r--o3d/samples/fullscreen.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/o3d/samples/fullscreen.html b/o3d/samples/fullscreen.html
index 449de27..0383ca2 100644
--- a/o3d/samples/fullscreen.html
+++ b/o3d/samples/fullscreen.html
@@ -58,6 +58,7 @@ o3djs.require('o3djs.primitives');
// Events
// init() once the page has finished loading.
window.onload = init;
+window.onunload = uninit;
// global variables
var g_o3d;
@@ -307,12 +308,30 @@ function getFullscreenModeId() {
}
}
+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 updateBanner() {
}
}
+function uninit() {
+ if (timeoutId) {
+ clearTimeout(timeoutId);
+ timeoutId = null;
+ }
+}
+
</script>
</head>
<body>
@@ -334,11 +360,17 @@ function updateBanner() {
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>