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

Unified Diff: chrome/browser/resources/options2/web_intents_defaults_list.js

Issue 10808092: Add settings UI for managing defaults (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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/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
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698