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

Unified Diff: chrome/common/extensions/docs/examples/extensions/plugin_settings/domui/js/cr/ui/list_item.js

Issue 8396001: Add sample extension that allows setting plugin-specific content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update docs Created 9 years, 1 month 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/common/extensions/docs/examples/extensions/plugin_settings/domui/js/cr/ui/list_item.js
diff --git a/chrome/common/extensions/docs/examples/extensions/plugin_settings/domui/js/cr/ui/list_item.js b/chrome/common/extensions/docs/examples/extensions/plugin_settings/domui/js/cr/ui/list_item.js
new file mode 100644
index 0000000000000000000000000000000000000000..68431bc0d9f2e4288bdfca07b61c3261db150d45
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/plugin_settings/domui/js/cr/ui/list_item.js
@@ -0,0 +1,75 @@
+// Copyright (c) 2011 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('cr.ui', function() {
+
+ /**
+ * Creates a new list item element.
+ * @param {string} opt_label The text label for the item.
+ * @constructor
+ * @extends {HTMLLIElement}
+ */
+ var ListItem = cr.ui.define('li');
+
+ ListItem.prototype = {
+ __proto__: HTMLLIElement.prototype,
+
+ /**
+ * Plain text label.
+ * @type {string}
+ */
+ get label() {
+ return this.textContent;
+ },
+ set label(label) {
+ this.textContent = label;
+ },
+
+ /**
+ * This item's index in the containing list.
+ * @type {number}
+ */
+ listIndex_: -1,
+
+ /**
+ * Called when an element is decorated as a list item.
+ */
+ decorate: function() {
+ this.setAttribute('role', 'listitem');
+ },
+
+ /**
+ * Called when the selection state of this element changes.
+ */
+ selectionChanged: function() {
+ },
+ };
+
+ /**
+ * Whether the item is selected. Setting this does not update the underlying
+ * selection model. This is only used for display purpose.
+ * @type {boolean}
+ */
+ cr.defineProperty(ListItem, 'selected', cr.PropertyKind.BOOL_ATTR,
+ function() {
+ this.selectionChanged();
+ });
+
+ /**
+ * Whether the item is the lead in a selection. Setting this does not update
+ * the underlying selection model. This is only used for display purpose.
+ * @type {boolean}
+ */
+ cr.defineProperty(ListItem, 'lead', cr.PropertyKind.BOOL_ATTR);
+
+ /**
+ * This item's index in the containing list.
+ * @type {number}
+ */
+ cr.defineProperty(ListItem, 'listIndex');
+
+ return {
+ ListItem: ListItem
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698