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

Unified Diff: chrome/browser/resources/options/autofill_options_list.js

Issue 6034005: DOMUI: Implement the new-style Autofill options page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes 2. Created 10 years 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/options/autofill_options_list.js
diff --git a/chrome/browser/resources/options/autofill_options_list.js b/chrome/browser/resources/options/autofill_options_list.js
new file mode 100644
index 0000000000000000000000000000000000000000..4d2dba79265683903b1d0d7ffa699632eb85bdc8
--- /dev/null
+++ b/chrome/browser/resources/options/autofill_options_list.js
@@ -0,0 +1,93 @@
+// Copyright (c) 2010 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.autoFillOptions', function() {
+ const DeletableItemList = options.DeletableItemList;
+ const DeletableItem = options.DeletableItem;
+ const List = cr.ui.List;
+
+ /**
+ * Creates a new AutoFill list item.
+ * @param {Array} entry An array of the form [guid, label].
+ * @constructor
+ * @extends {options.DeletableItem}
+ */
+ function AutoFillListItem(entry) {
+ var el = cr.doc.createElement('div');
+ el.guid = entry[0];
+ el.label = entry[1];
+ el.__proto__ = AutoFillListItem.prototype;
+ el.decorate();
+
+ return el;
+ }
+
+ AutoFillListItem.prototype = {
+ __proto__: DeletableItem.prototype,
+
+ /** @inheritDoc */
+ decorate: function() {
+ DeletableItem.prototype.decorate.call(this);
+
+ // The stored label.
+ var label = this.ownerDocument.createElement('div');
+ label.className = 'autofill-list-item';
+ label.textContent = this.label;
+ this.contentElement.appendChild(label);
+ },
+
+ /**
+ * Get and set the GUID for the entry.
+ * @type {string}
+ */
+ get guid() {
arv (Not doing code reviews) 2010/12/22 23:00:35 No need for getter and setters for these since the
James Hawkins 2010/12/22 23:13:08 Done.
+ return this.guid;
arv (Not doing code reviews) 2010/12/22 23:00:35 This will not work. It will cause infinite recursi
James Hawkins 2010/12/22 23:13:08 Done.
+ },
+ set guid(guid) {
+ this.guid = guid;
+ },
+
+ /**
+ * Get and set the label for the entry.
+ * @type {string}
+ */
+ get label() {
+ return this.label;
+ },
+ set label(label) {
+ this.label = label;
+ },
+ };
+
+ /**
+ * Create a new AutoFill list.
+ * @constructor
+ * @extends {options.DeletableItemList}
+ */
+ var AutoFillList = cr.ui.define('list');
+
+ AutoFillList.prototype = {
+ __proto__: DeletableItemList.prototype,
+
+ /** @inheritDoc */
+ createItem: function(entry) {
+ return new AutoFillListItem(entry);
+ },
+
+ /** @inheritDoc */
+ activateItemAtIndex: function(index) {
+ AutoFillOptions.loadProfileEditor(this.dataModel.item(index)[0]);
+ },
+
+ /** @inheritDoc */
+ deleteItemAtIndex: function(index) {
+ AutoFillOptions.removeAutoFillProfile(this.dataModel.item(index)[0]);
+ },
+ };
+
+ return {
+ AutoFillListItem: AutoFillListItem,
+ AutoFillList: AutoFillList,
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698