Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1279)

Unified Diff: chrome/test/data/extensions/samples/tabs/tabs_api.html

Issue 115337: TBR Revert "Revert "implemented extensions api windows.update()."" (Closed)
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/resources/extension_process_bindings.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « chrome/renderer/resources/extension_process_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698