Permalink
Browse files

Merge pull request #73 from scheib/window-create-size-

Update samples to use 'bounds' parameter to window.create.
  • Loading branch information...
2 parents f81ab26 + 0d90501 commit df33930b8d9b22b2cbab34b471124c75301fb46b @scheib scheib committed Mar 18, 2013
Showing with 184 additions and 109 deletions.
  1. +1 −1 analytics/launch.js
  2. +4 −2 appsquare/background.js
  3. +4 −2 browser/main.js
  4. +4 −2 calculator/main.js
  5. +4 −2 camera-capture/background.js
  6. +5 −3 clock/main.js
  7. +2 −2 context-menu/main.js
  8. +1 −1 dart/js/main.js
  9. +4 −2 diff/js/background.js
  10. +5 −3 dojo/build.sh
  11. BIN dojo/dojo.crx
  12. +1 −1 filesystem-access/background.js
  13. +7 −4 frameless-window/background.js
  14. +1 −1 fullscreen/background.js
  15. +4 −2 gdocs/js/background.js
  16. +4 −2 hello-world-sync/main.js
  17. +14 −3 hello-world/README.md
  18. +9 −4 hello-world/main.js
  19. +1 −1 identity/main.js
  20. +4 −2 instagram-auth/main.js
  21. +4 −2 ioio/background.js
  22. +2 −2 media-gallery/runtime.js
  23. +2 −2 messaging/app1/main.js
  24. +2 −2 messaging/app2/main.js
  25. +2 −2 mini-code-edit/background.js
  26. +1 −1 mini-code-edit/editor.js
  27. +4 −2 optional-permissions/main.js
  28. +4 −2 parrot-ar-drone/main.js
  29. +4 −2 restarted-demo/background.js
  30. +2 −2 rich-notifications/app.js
  31. +1 −1 sandbox/main.js
  32. +1 −1 sandboxed-content/main.js
  33. +6 −4 serial-control-signals/background.js
  34. +1 −1 serial/adkjs/app/js/background.js
  35. +4 −2 serial/ledtoggle/launch.js
  36. +6 −4 servo/background.js
  37. +4 −2 singleton/main.js
  38. +4 −2 storage/background.js
  39. +1 −1 syncfs-editor/js/background.js
  40. +4 −2 systemInfo/main.js
  41. +1 −1 tcpserver/commands/BrowserCommands.js
  42. +1 −1 tcpserver/main.js
  43. +4 −2 telnet/launch.js
  44. +4 −2 udp/main.js
  45. +4 −2 usb/knob/background.js
  46. +4 −2 weather/main.js
  47. +1 −1 webgl-pointer-lock/README.md
  48. +1 −1 webgl-pointer-lock/main.js
  49. +6 −4 webserver/main.js
  50. +4 −4 webview/main.js
  51. +12 −8 windows/main.js
  52. +4 −2 zephyr_hxm/background.js
View
@@ -6,5 +6,5 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('main.html',
- {width: 480, height: 225});
+ {bounds: {width: 480, height: 225}});
});
View
@@ -1,6 +1,8 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('main.html', {
- width: 300,
- height: 600
+ bounds: {
+ width: 300,
+ height: 600
+ }
});
});
View
@@ -24,7 +24,9 @@ chrome.app.runtime.onRestarted.addListener(function() {
*/
function runApp() {
chrome.app.window.create('browser.html', {
- 'width': 1024,
- 'height': 768
+ bounds: {
+ 'width': 1024,
+ 'height': 768
+ }
});
}
View
@@ -12,8 +12,10 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('calculator.html', {
- width: 244,
- height: 380,
+ bounds: {
+ width: 244,
+ height: 380
+ },
maxWidth: 244,
minWidth: 244,
minHeight: 380,
@@ -6,7 +6,9 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
- width: 700,
- height: 600
+ bounds: {
+ width: 700,
+ height: 600
+ }
});
});
View
@@ -12,9 +12,11 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
- height: 550,
- width: 800,
- top: 100,
+ bounds: {
+ height: 550,
+ width: 800,
+ top: 100
+ },
frame: 'none'
});
});
View
@@ -1,4 +1,4 @@
chrome.app.runtime.onLaunched.addListener(function() {
- chrome.app.window.create('a.html', {top: 0, left: 0, width: 300, height: 300});
- chrome.app.window.create('b.html', {top: 0, left: 310, width: 300, height: 300});
+ chrome.app.window.create('a.html', {bounds:{top: 0, left: 0, width: 300, height: 300}});
+ chrome.app.window.create('b.html', {bounds:{top: 0, left: 310, width: 300, height: 300}});
});
View
@@ -6,5 +6,5 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('clock.html',
- {id: 'clock', width: 800, height: 550});
+ {id: 'clock', bounds: {width: 800, height: 550}});
});
View
@@ -6,8 +6,10 @@
function onLaunched(launchData) {
chrome.app.window.create('main.html', {
- width: 1270,
- height: 800
+ bounds: {
+ width: 1270,
+ height: 800
+ }
});
}
View
@@ -19,7 +19,7 @@ function _dojo_launch(app) {
function _dojo_readme(file) {
chrome.app.window.create(file,
- {width: 500, height: 700, left: 602});
+ {bounds: {width: 500, height: 700, left: 602}});
}
function _dojo_source(app) {
window.open("https://github.com/GoogleChrome/chrome-app-samples/tree/master/"+app);
@@ -53,8 +53,10 @@ function writeJS_launch() {
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
- width: 600,
- height: 800
+ bounds: {
+ width: 600,
+ height: 800
+ }
});
});
EOF
View
Binary file not shown.
@@ -1,5 +1,5 @@
chrome.app.runtime.onLaunched.addListener(function(launchData) {
- chrome.app.window.create('index.html', {width: 800, height: 500}, function(win) {
+ chrome.app.window.create('index.html', {bounds: {width: 800, height: 500}}, function(win) {
win.contentWindow.launchData = launchData;
});
});
@@ -1,10 +1,13 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create("frameless_window.html",
- { frame: "none", width: 360,
- height: 300,
+ { frame: "none",
+ bounds: {
+ width: 360,
+ height: 300,
+ left: 600
+ },
minWidth: 220,
- minHeight: 220,
- left: 600
+ minHeight: 220
}
);
});
View
@@ -1,3 +1,3 @@
chrome.app.runtime.onLaunched.addListener(function() {
- chrome.app.window.create('window.html', {width: 500, height: 309});
+ chrome.app.window.create('window.html', {bounds: {width: 500, height: 309}});
});
View
@@ -1,7 +1,9 @@
chrome.app.runtime.onLaunched.addListener(function(launchData) {
chrome.app.window.create('../main.html', {
- width: 500,
- height: 600,
+ bounds: {
+ width: 500,
+ height: 600
+ },
minWidth: 500,
minHeight: 600,
frame: 'none'
View
@@ -1,6 +1,8 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
- width: 500,
- height: 415
+ bounds: {
+ width: 500,
+ height: 415
+ }
});
});
View
@@ -5,10 +5,21 @@ additional permissions. The manifest denotes a background script, main.js,
detailed below:
```javascript
-// Main.js
chrome.app.runtime.onLaunched.addListener(function() {
- chrome.app.window.create('index.html',
- {width: 500, height: 309});
+ // Center window on screen.
+ var screenWidth = screen.availWidth;
+ var screenHeight = screen.availHeight;
+ var width = 500;
+ var height = 300;
+
+ chrome.app.window.create('index.html', {
+ bounds: {
+ width: width,
+ height: height,
+ left: Math.round((screenWidth-width)/2),
+ top: Math.round((screenHeight-height)/2)
+ }
+ });
});
```
View
@@ -5,13 +5,18 @@
* @see http://developer.chrome.com/trunk/apps/app.window.html
*/
chrome.app.runtime.onLaunched.addListener(function() {
+ // Center window on screen.
var screenWidth = screen.availWidth;
var screenHeight = screen.availHeight;
var width = 500;
var height = 300;
- chrome.app.window.create('index.html',
- {width: width, height: height,
- left: (screenWidth-width)/2,
- top: (screenHeight-height)/2});
+ chrome.app.window.create('index.html', {
+ bounds: {
+ width: width,
+ height: height,
+ left: Math.round((screenWidth-width)/2),
+ top: Math.round((screenHeight-height)/2)
+ }
+ });
});
View
@@ -1,3 +1,3 @@
chrome.app.runtime.onLaunched.addListener(function() {
- chrome.app.window.create('index.html', { "width": 1024, "height": 768 });
+ chrome.app.window.create('index.html', { "bounds": { "width": 1024, "height": 768 } });
});
View
@@ -6,7 +6,9 @@
*/
chrome.app.runtime.onLaunched.addListener(function(intentData) {
chrome.app.window.create('index.html', {
- width: 500,
- height: 309
+ bounds: {
+ width: 500,
+ height: 309
+ }
});
});
View
@@ -1,6 +1,8 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
- width: 640,
- height: 480
+ bounds: {
+ width: 640,
+ height: 480
+ }
});
});
View
@@ -3,7 +3,7 @@
chrome.app.runtime.onLaunched.addListener(function(data) {
chrome.app.window.create('page.html',
- {width:900, height:600, minWidth:900, maxWidth: 900, minHeight:600, maxHeight: 600, id:"MGExp"},
+ {bounds: {width:900, height:600}, minWidth:900, maxWidth: 900, minHeight:600, maxHeight: 600, id:"MGExp"},
function(app_win) {
app_win.contentWindow.__MGA__bRestart = false;
}
@@ -13,7 +13,7 @@ chrome.app.runtime.onLaunched.addListener(function(data) {
chrome.app.runtime.onRestarted.addListener(function() {
chrome.app.window.create('page.html',
- {width:900, height:600, minWidth:900, maxWidth: 900, minHeight:600, maxHeight: 600, id:"MGExp"},
+ {bounds: {width:900, height:600}, minWidth:900, maxWidth: 900, minHeight:600, maxHeight: 600, id:"MGExp"},
function(app_win) {
app_win.contentWindow.__MGA__bRestart = true;
}
View
@@ -6,6 +6,6 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html',
- {width: 800, height: 500});
+ {bounds: {width: 800, height: 500}});
});
-//function addExternalMessageListener
+//function addExternalMessageListener
View
@@ -6,6 +6,6 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html',
- {width: 800, height: 500});
+ {bounds: {width: 800, height: 500}});
});
-//function addExternalMessageListener
+//function addExternalMessageListener
@@ -2,7 +2,7 @@ chrome.app.runtime.onLaunched.addListener(function() {
// width 640 for font size 12
// 720 for font size 14
chrome.app.window.create('main.html', {
- frame: 'chrome', width: 720, height: 400, minWidth:720, minHeight: 400
+ frame: 'chrome', bounds: { width: 720, height: 400}, minWidth:720, minHeight: 400
});
});
@@ -15,7 +15,7 @@ chrome.commands.onCommand.addListener(function(command) {
if (command == "cmdNew") {
chrome.app.window.create('main.html', {
- frame: 'chrome', width: 720, height: 400, minWidth:720, minHeight: 400
+ frame: 'chrome', bounds: { width: 720, height: 400}, minWidth:720, minHeight: 400
});
}
});
View
@@ -124,7 +124,7 @@ function handleNewButton() {
editor.setValue("");
} else {
chrome.app.window.create('main.html', {
- frame: 'chrome', width: 720, height: 400
+ frame: 'chrome', bounds: { width: 720, height: 400}
});
}
}
@@ -1,7 +1,9 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('permissions.html', {
id: 'permissions',
- width: 640,
- height: 480
+ bounds: {
+ width: 640,
+ height: 480
+ }
});
})
View
@@ -12,8 +12,10 @@ chrome.app.runtime.onLaunched.addListener(function() {
}, 1000);
chrome.app.window.create('index.html', {
- width: 565,
- height: 400
+ bounds: {
+ width: 565,
+ height: 400
+ }
}, function(createdWindow) {
appWindow = createdWindow.dom;
});
@@ -94,8 +94,10 @@ Counter.prototype.close = function() {
function runApp(counter) {
chrome.app.window.create('main.html', {
id: counter.id + '',
- width: 800,
- height: 600
+ bounds: {
+ width: 800,
+ height: 600
+ }
}, function(win) {
win.contentWindow.onload = function() {
counter.attachToWindow(win, win.contentWindow.document);
@@ -1,3 +1,3 @@
chrome.app.runtime.onLaunched.addListener(function () {
- chrome.app.window.create("window.html", {width:600, height:400});
-});
+ chrome.app.window.create("window.html", {bounds: {width:600, height:400}});
+});
View
@@ -6,5 +6,5 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('mainpage.html',
- {width: 500, height: 309});
+ {bounds: {width: 500, height: 309}});
});
@@ -6,5 +6,5 @@
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('main.html',
- {width: 400, height: 350});
+ {bounds: {width: 400, height: 350}});
});
@@ -1,8 +1,10 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('main.html', {
- top: 0,
- left: 0,
- width: 640,
- height: 720
+ bounds: {
+ top: 0,
+ left: 0,
+ width: 640,
+ height: 720
+ }
});
})
@@ -1,4 +1,4 @@
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('comm.html#inlink',
- {frame: 'custom', width: 343, height: 600});
+ {frame: 'custom', bounds: {width: 343, height: 600}});
});
Oops, something went wrong.

0 comments on commit df33930

Please sign in to comment.