Permalink
Browse files

Window State Sample created; Removed Fullscreen Sample.

The Window State sample is a super set of the functionality
the Fullscreen sample offered, adding the ability to exercise
the app.window apis to maximize, minimize, restore, hide, and
show.
  • Loading branch information...
1 parent df33930 commit a75c176a8a5be58ebb5210e3f39a460a0652adaa @scheib scheib committed Mar 22, 2013
View
@@ -1,9 +0,0 @@
-# Fullscreen sample
-
-This is a basic test of using the HTML fullscreen api to cause a window to go
-full screen.
-
-## Resources
-
-* [Fullscreen Specification](http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html)
-
View
@@ -1,3 +0,0 @@
-chrome.app.runtime.onLaunched.addListener(function() {
- chrome.app.window.create('window.html', {bounds: {width: 500, height: 309}});
-});
View
Deleted file not rendered
View
Deleted file not rendered
View
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-</head>
-<body>
- <h1>Fullscreen sample</h1>
- <button id="enter">Enter Fullscreen</button>
- <button id="exit">Exit Fullscreen</button>
- <script src="window.js"></script>
-</body>
-</html>
View
@@ -1,25 +0,0 @@
-// Log events:
-
-document.onwebkitfullscreenchange = function () {
- console.log("onwebkitfullscreenchange");
-}
-
-document.onwebkitfullscreenerror = function () {
- console.log("onwebkitfullscreenerror");
-}
-
-// Button handlers:
-
-document.getElementById('enter').addEventListener('click', function(e) {
- document.body.webkitRequestFullscreen();
-});
-
-document.getElementById('exit').addEventListener('click', function(e) {
- document.webkitExitFullscreen();
-});
-
-// Attempt fullscreen on window creation.
-// It will fail, but hopefully some day it won't:
-// http://code.google.com/p/chromium/issues/detail?id=164624
-document.body.webkitRequestFullscreen();
-
View
@@ -0,0 +1,9 @@
+# Window State sample
+
+Demonstrates transitioning the window into minimized, maximized, fullscreen
+and hidden states. Includes HTML5 requestFullscreen and app.window.fullscreen().
+
+## Resources
+
+* [Fullscreen Specification](http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html)
+* [Window](http://developer.chrome.com/trunk/apps/app.window.html)
@@ -0,0 +1,3 @@
+chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.app.window.create('window.html');
+});
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Binary file not shown.
@@ -1,9 +1,8 @@
{
"manifest_version": 2,
- "name": "Fullscreen sample",
+ "name": "Window State Sample",
"version": "1",
"icons": {
- "16": "icon_16.png",
"128": "icon_128.png"
},
"app": {
View
@@ -0,0 +1,7 @@
+#fullscreen-area {
+ box-shadow: inset 0px 1px 10px rgba(0,0,0,1);
+ margin: 5px;
+ padding: 5px;
+ border-radius: 5px;
+}
+
View
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link href="window.css" rel="stylesheet">
+</head>
+<body>
+ <h1>Window State Sample</h1>
+ <div id="fullscreen-area">
+ <button id="newWindow">Create new window</button><br>
+ <button id="newWindowFullscreen">Create new fullscreen window</button><br>
+ <button id="newWindowFullscreenHidden">Create new fullscreen hidden window, then show after a delay.</button><br>
+ <p>HTML5 Fullscreen:
+ <button id="html-fullscreen-enter">Enter</button>
+ <button id="html-fullscreen-exit">Exit</button>
+ <br>
+ <span id="html-fullscreen-label"></span>
+ </p>
+ <p>Delayed app.window actions:
+ <br>
+ <button id="fullscreen">Fullscreen</button>
+ <button id="maximize">Maximize</button>
+ <button id="minimize">Minimize</button>
+ <button id="restore">Restore</button>
+ <button id="hide">Hide</button>
+ <button id="show">Show</button>
+ <br>
+ Delay: <input id="delay-slider" type ="range" min ="0000" max="10000" step="1000" value="2000"/>
+ <span id="delay-label"></span>
+ </p>
+ </div>
+ This text is outside of the HTML5 fullscreen area.
+</body>
+<script src="window.js"></script>
+</html>
View
@@ -0,0 +1,87 @@
+// Variables:
+
+var hiddenWindowDelay = 3000;
+var fullscreenchangeCount = 0;
+var fullscreenerrorCount = 0;
+
+// Helper functions
+$ = function(selector) { return document.querySelector(selector); }
+
+// Log events:
+
+var updateFulllscreenLabel = function updateFulllscreenLabel() {
+ $('#html-fullscreen-label').innerText =
+ fullscreenchangeCount + " change, " +
+ fullscreenerrorCount + " error events.";
+}
+updateFulllscreenLabel(); // Initial text update.
+
+document.onwebkitfullscreenchange = function () {
+ fullscreenchangeCount++;
+ console.log("onwebkitfullscreenchange");
+ updateFulllscreenLabel();
+}
+
+document.onwebkitfullscreenerror = function () {
+ fullscreenerrorCount++;
+ console.log("onwebkitfullscreenerror");
+ updateFulllscreenLabel();
+}
+
+// Button handlers:
+
+$('#newWindow').onclick = function(e) {
+ chrome.app.window.create('window.html', { state: 'normal'});
+};
+
+$('#newWindowFullscreen').onclick = function(e) {
+ chrome.app.window.create('window.html', { state: 'fullscreen'});
+};
+
+$('#newWindowFullscreenHidden').onclick = function(e) {
+ chrome.app.window.create('window.html', { state: 'fullscreen', hidden: true},
+ function (createdWindow) {
+ setTimeout(function () { createdWindow.show(); }, hiddenWindowDelay);
+ }
+ );
+};
+
+$('#html-fullscreen-enter').onclick = function(e) {
+ $('#fullscreen-area').webkitRequestFullscreen();
+};
+
+$('#html-fullscreen-exit').onclick = function(e) {
+ document.webkitExitFullscreen();
+};
+
+$('#fullscreen').onclick = function(e) {
+ setTimeout(chrome.app.window.current().fullscreen, $('#delay-slider').value);
+};
+
+$('#maximize').onclick = function(e) {
+ setTimeout(chrome.app.window.current().maximize, $('#delay-slider').value);
+};
+
+$('#minimize').onclick = function(e) {
+ setTimeout(chrome.app.window.current().minimize, $('#delay-slider').value);
+};
+
+$('#restore').onclick = function(e) {
+ setTimeout(chrome.app.window.current().restore, $('#delay-slider').value);
+};
+
+$('#hide').onclick = function(e) {
+ setTimeout(chrome.app.window.current().hide, $('#delay-slider').value);
+};
+
+$('#show').onclick = function(e) {
+ setTimeout(chrome.app.window.current().show, $('#delay-slider').value);
+};
+
+var updateDelaySiderText = function updateDelaySiderText() {
+ $('#delay-label').innerText = $('#delay-slider').value / 1000 + " seconds.";
+}
+
+$('#delay-slider').onchange = updateDelaySiderText;
+updateDelaySiderText(); // Initial text update.
+

2 comments on commit a75c176

rc1 replied Apr 10, 2013

The fullscreen app is still listed in the README.md.

Member

scheib replied Apr 10, 2013

README.md updated: 9278acb

Please sign in to comment.