diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 14:59:32 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 14:59:32 +0000 |
commit | c6619189d9d7176f62754fce548cdcedf8831bcf (patch) | |
tree | bfec95efed25eadfa1bd3e4f09e9cda686e09cc0 /chrome/test | |
parent | c07e97c914b3defcbf02445a650f01aa57ec04aa (diff) | |
download | chromium_src-c6619189d9d7176f62754fce548cdcedf8831bcf.zip chromium_src-c6619189d9d7176f62754fce548cdcedf8831bcf.tar.gz chromium_src-c6619189d9d7176f62754fce548cdcedf8831bcf.tar.bz2 |
FormatErrorMessage() functions are now publicly available from ExtensionErrorUtils.
ExtensionTabsModule implements a bunch of error_messages.
Extension Calls now always deliver a response to the calling context and route error messages if any to the window.console.error log.
Review URL: http://codereview.chromium.org/113105
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/data/extensions/samples/tabs/tabs_api.html | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/chrome/test/data/extensions/samples/tabs/tabs_api.html b/chrome/test/data/extensions/samples/tabs/tabs_api.html index 56cd878..7a60db7 100644 --- a/chrome/test/data/extensions/samples/tabs/tabs_api.html +++ b/chrome/test/data/extensions/samples/tabs/tabs_api.html @@ -12,7 +12,7 @@ currentWindowId = undefined; function bootStrap() { chrome.windows.getCurrent(function(currentWindow) { currentWindowId = currentWindow.id; - chrome.windows.getFocused(function(focusedWindow) { + chrome.windows.getLastFocused(function(focusedWindow) { focusedWindowId = focusedWindow.id; loadWindowList(); }); @@ -117,6 +117,16 @@ function moveAll() { } } +function removeTab(tabId) { + try { + chrome.tabs.remove(tabId, function() { + appendToLog('tab: ' + tabId + ' removed.'); + }); + } catch (e) { + alert(e); + } +} + function appendToLog(logLine) { var log = document.getElementById('log'); log.innerHTML = '<div> > ' + logLine + '</div>' + log.innerHTML; @@ -197,7 +207,7 @@ function createWindow() { delete args.url; try { - chrome.windows.createWindow(args); + chrome.windows.create(args); } catch(e) { alert(e); } @@ -216,6 +226,16 @@ function refreshWindow(windowId) { }); } +function removeWindow(windowId) { + try { + chrome.windows.remove(windowId, function() { + appendToLog('window: ' + windowId + ' removed.'); + }); + } catch (e) { + alert(e); + } +} + function refreshTab(tabId) { chrome.tabs.get(tabId, function(tab) { var input = new JsExprContext(tab); @@ -276,11 +296,11 @@ function refreshSelectedTab(windowId) { <div><input type="checkbox" jsvalues="checked:selected; id:'selected_' + id" /> Selected</div> </div> <button onclick="updateTab(this.jstdata)" jsvalues=".jstdata:id">Update Tab</button> - <button onclick="chrome.tabs.remove(this.jstdata);" jsvalues=".jstdata:id">Close Tab</button> + <button onclick="removeTab(this.jstdata);" jsvalues=".jstdata:id">Close Tab</button> </div> </div> </div> - <button onclick="chrome.windows.removeWindow(this.jstdata);" jsvalues=".jstdata:id">Close 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> </div> @@ -329,7 +349,7 @@ function refreshSelectedTab(windowId) { <button onclick="updateAll();">Update All</button> <button onclick="moveAll();">Move All</button> <button onclick="clearLog();">-->Clear Log</button> - <button onclick="chrome.windows.createWindow();">New Window</button> + <button onclick="chrome.windows.create();">New Window</button> </div> <div id="log" style="background-color: #EEAAEE; margin: 20px; padding: 8px"> </div> |