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

Unified Diff: chrome/test/data/extensions/test/TabsAPI/1/tabs_api.html

Issue 62178: Flesh out more extensions tab api (added removeTab, updateTab) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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
Index: chrome/test/data/extensions/test/TabsAPI/1/tabs_api.html
===================================================================
--- chrome/test/data/extensions/test/TabsAPI/1/tabs_api.html (revision 0)
+++ chrome/test/data/extensions/test/TabsAPI/1/tabs_api.html (revision 0)
@@ -0,0 +1,69 @@
+<html>
+<head>
+<script src="jstemplate_compiled.js" type="text/javascript"></script>
+<script>
+var tabs = {};
+
+function loadTabList() {
+ chromium.tabs.getTabsForWindow(function(tabList) {
+ tabs = tabList;
+
+ var input = new JsExprContext(tabList);
+ var output = document.getElementById('tabList');
+ jstProcess(input, output);
+ });
+}
+
+function getTabData(id) {
+ return {
+ 'id': id,
+ 'index': parseInt(document.getElementById('index_' + id).value),
+ 'windowId': document.getElementById('windowId_' + id).value,
+ 'title': document.getElementById('title_' + id).value,
+ 'url': document.getElementById('url_' + id).value,
+ 'selected': document.getElementById('selected_' + id).value ? true : false
+ }
+}
+
+function updateTab(id){
+ chromium.tabs.updateTab(getTabData(id));
+}
+
+function createTab() {
+ chromium.tabs.createTab(getTabData('new'));
+}
+
+function updateAll() {
+ for (var i = 0; i < tabs.length; i++) {
+ chromium.tabs.updateTab(getTabData(tabs[i].id));
+ }
+}
+</script>
+</head>
+ <body onload="loadTabList();">
+ <div id="tabList">
+ <div style="background-color: #EEEEEE; margin: 8px; padding: 4px" jsselect="$this">
+ <div jscontent="'TabId: ' + id"></div>
+ <div> index: <input style="width: 90%" type="text" jsvalues="value:$this.index;id:'index_' + id" /></div>
+ <div> windowId: <input style="width: 40px" type="text" jsvalues="value:windowId;id:'windowId_' + id" /></div>
+ <div> title: <input style="width: 90%" type="text" jsvalues="value:title;id:'title_' + id" /></div>
+ <div> url: <input style="width: 90%" type="text" jsvalues="value:url;id:'url_' + id" /></div>
+ <div jscontent="url"></div>
+ <div> <input type="checkbox" jsvalues="checked:selected; id:'selected_' + id" /> Selected</div>
+ <button onclick="updateTab(this.jstdata)" jsvalues=".jstdata:id">Update Tab</button>
+ <button onclick="chromium.tabs.removeTab(this.jstdata);" jsvalues=".jstdata:id">Close Tab</button>
+ </div>
+ </div>
+ <div style="background-color: #9999EE; margin: 8px; padding: 4px">
+ <div> index: <input style="width: 90%" type="text" id="index_new" /></div>
+ <div> windowId: <input style="width: 40px" type="text" id="windowId_new" /></div>
+ <div> title: <input style="width: 90%" type="text" id="title_new" /></div>
+ <div> url: <input style="width: 90%" type="text" id="url_new" /></div>
+ <div> <input type="checkbox" id="selected_new" /> Selected</div>
+ <button onclick="createTab();">Create Tab</button>
+ </div>
+ <button onclick="loadTabList();">Refresh</button>
+ <button onclick="updateAll();">Update All</button>
+ </body>
+</html>
+
« no previous file with comments | « chrome/test/data/extensions/test/TabsAPI/1/manifest.json ('k') | chrome/test/data/extensions/test/TabsAPI/Current Version » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698