Index: chrome/browser/resources/options2/web_intents_defaults_list.js |
diff --git a/chrome/browser/resources/options2/web_intents_defaults_list.js b/chrome/browser/resources/options2/web_intents_defaults_list.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dd26b52684b72cf25a4da7e39c1ac2603852a059 |
--- /dev/null |
+++ b/chrome/browser/resources/options2/web_intents_defaults_list.js |
@@ -0,0 +1,78 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+cr.define('options', function() { |
+ /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
+ /** @const */ var DeletableItem = options.DeletableItem; |
+ /** @const */ var DeletableItemList = options.DeletableItemList; |
+ |
+ /** |
+ * @constructor |
+ * @extends {DeletableItem} |
+ */ |
+ function ServiceListItem(service) { |
+ var el = cr.doc.createElement('div'); |
+ el.service_ = service; |
+ el.__proto__ = ServiceListItem.prototype; |
+ el.decorate(); |
+ return el; |
+ } |
+ |
+ function createChildDiv(parent, clazz, value) { |
+ var element = document.createElement('div'); |
+ parent.appendChild(element); |
+ element.className = clazz; |
+ if (value) { |
+ element.textContent = value; |
+ } |
+ return element; |
+ } |
+ |
+ ServiceListItem.prototype = { |
+ __proto__: DeletableItem.prototype, |
+ |
+ decorate: function() { |
+ DeletableItem.prototype.decorate.call(this); |
+ |
+ var rowElement = createChildDiv(this.contentElement_, 'intents-row', ''); |
+ |
+ // add favicon for the service URL |
csilv
2012/08/09 18:18:04
this this a TODO...?
|
+ createChildDiv(rowElement, 'intents-preferred-service', |
+ this.service_[0]); |
+ createChildDiv(rowElement, 'intents-service-matching-criteria', |
+ this.service_[1]); |
+ }, |
+ }; |
+ |
+ var ServiceList = cr.ui.define('list'); |
+ |
+ ServiceList.prototype = { |
+ __proto__: DeletableItemList.prototype, |
+ |
+ /** @inheritDoc */ |
+ decorate: function() { |
+ DeletableItemList.prototype.decorate.call(this); |
+ this.autoExpands_ = true; |
+ }, |
+ |
+ /** @inheritDoc */ |
+ createItem: function(service) { |
+ return new ServiceListItem(service); |
+ }, |
+ |
+ /** @inheritDoc */ |
+ deleteItemAtIndex: function(index) { |
+ var service = this.dataModel.item(index); |
+ chrome.send('removeServiceDefaults', service); |
+ }, |
+ |
+ setServices: function(services) { |
+ this.dataModel = new ArrayDataModel(services); |
+ } |
+ }; |
+ |
+ return { |
+ ServiceList: ServiceList |
+ }; |
+}); |