Index: chrome/test/data/extensions/samples/tabs/tabs_api.html |
diff --git a/chrome/test/data/extensions/samples/tabs/tabs_api.html b/chrome/test/data/extensions/samples/tabs/tabs_api.html |
index 7a60db7104a92692d63dccf9784e522f7e527251..a0b2dd232de0d19158d1ef2a682ebd8ae4626265 100644 |
--- a/chrome/test/data/extensions/samples/tabs/tabs_api.html |
+++ b/chrome/test/data/extensions/samples/tabs/tabs_api.html |
@@ -19,6 +19,10 @@ function bootStrap() { |
}); |
} |
+function isInt(i) { |
+ return (typeof i == "number") && !(i % 1) && !isNaN(i); |
+} |
+ |
function loadWindowList() { |
chrome.windows.getAll(true, function(windowList) { |
tabs = {}; |
@@ -54,8 +58,7 @@ function updateTab(id){ |
} catch (e) { |
alert(e); |
} |
-} |
- |
+} |
function moveTabData(id) { |
return { |
@@ -182,10 +185,6 @@ chrome.tabs.onRemoved.addListener(function(tabId) { |
loadWindowList(); |
}); |
-function isInt(i) { |
- return (typeof i == "number") && !(i % 1) && !isNaN(i); |
-} |
- |
function createWindow() { |
var args = { |
'left': parseInt(document.getElementById('new_window_left').value), |
@@ -226,6 +225,34 @@ function refreshWindow(windowId) { |
}); |
} |
+function updateWindowData(id) { |
+ var retval = { |
+ left: parseInt(document.getElementById('left_' + id).value), |
+ top: parseInt(document.getElementById('top_' + id).value), |
+ width: parseInt(document.getElementById('width_' + id).value), |
+ height: parseInt(document.getElementById('height_' + id).value) |
+ } |
+ |
+ if (!isInt(retval.left)) |
+ delete retval.left; |
+ if (!isInt(retval.top)) |
+ delete retval.top; |
+ if (!isInt(retval.width)) |
+ delete retval.width; |
+ if (!isInt(retval.height)) |
+ delete retval.height; |
+ |
+ return retval; |
+} |
+ |
+function updateWindow(id){ |
+ try { |
+ chrome.windows.update(id, updateWindowData(id)); |
+ } catch (e) { |
+ alert(e); |
+ } |
+} |
+ |
function removeWindow(windowId) { |
try { |
chrome.windows.remove(windowId, function() { |
@@ -300,6 +327,7 @@ function refreshSelectedTab(windowId) { |
</div> |
</div> |
</div> |
+ <button onclick="updateWindow(this.jstdata);" jsvalues=".jstdata:id">Update Window</button> |
<button onclick="removeWindow(this.jstdata);" jsvalues=".jstdata:id">Close Window</button> |
<button onclick="refreshSelectedTab(this.jstdata);" jsvalues=".jstdata:id">Refresh Selected Tab</button> |
</div> |