From fa0ab6112e707a85decda8774c30d7c937674014 Mon Sep 17 00:00:00 2001 From: Thomas Wilburn Date: Sun, 24 Nov 2013 21:08:18 -0500 Subject: [PATCH] Use Chrome's window position memory instead of manually restoring position. --- background.js | 39 ++++++++++++++++----------------------- js/main.js | 6 ------ 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/background.js b/background.js index 246b747..6a02fd3 100644 --- a/background.js +++ b/background.js @@ -18,30 +18,23 @@ var openWindow = function() { } //otherwise, open a new window - chrome.storage.local.get("bounds", function(data) { - var defaults = { - width: 800, - height: 600, - left: 50, - top: 50 - }; - var bounds = data.bounds || defaults; - //sanity check the bounds information -- also need to add maximums - if (bounds.left < 0 || bounds.top < 0 || bounds.width < 0 || bounds.height < 0) { - bounds = defaults; - } - chrome.app.window.create("main.html", { - bounds: bounds - }, function(win) { - mainWindow = win; - win.contentWindow.launchData = files; - mainWindow.onClosed.addListener(function() { - mainWindow = null; - }); - files = []; - timeout = null; + var defaults = { + width: 800, + height: 600, + left: 50, + top: 50 + }; + chrome.app.window.create("main.html", { + bounds: defaults, + id: "caret:main" + }, function(win) { + mainWindow = win; + win.contentWindow.launchData = files; + mainWindow.onClosed.addListener(function() { + mainWindow = null; }); - + files = []; + timeout = null; }); } diff --git a/js/main.js b/js/main.js index 80e3b5e..6b487a8 100644 --- a/js/main.js +++ b/js/main.js @@ -12,12 +12,6 @@ require([ var frame = chrome.app.window.current(); - //store window dimensions on resize - frame.onBoundsChanged.addListener(function() { - var bounds = frame.getBounds(); - chrome.storage.local.set({bounds: bounds}); - }); - command.on("app:exit", function() { frame.close(); });