Index: chrome/browser/resources/options/origin_resources_list.js |
diff --git a/chrome/browser/resources/options/origin_resources_list.js b/chrome/browser/resources/options/origin_resources_list.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0827912fd445d2a4a497d42927b649c837f364e6 |
--- /dev/null |
+++ b/chrome/browser/resources/options/origin_resources_list.js |
@@ -0,0 +1,63 @@ |
+// Copyright 2014 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 */ List = cr.ui.List; |
+ /** @const */ ListItem = cr.ui.ListItem; |
+ /** @const */ ArrayDataModel = cr.ui.ArrayDataModel; |
Dan Beam
2014/07/10 02:57:23
ArrayDataModel, InlineEditeableItem{,List} are unu
Daniel Nishi
2014/07/10 19:00:07
Whoops. Removed the holdovers from a previous impl
|
+ var InlineEditableItemList = options.InlineEditableItemList; |
+ var InlineEditableItem = options.InlineEditableItem; |
+ |
+ function OriginListItem(origin) { |
+ var el = cr.doc.createElement('div'); |
Dan Beam
2014/07/10 02:57:23
why can't you just do
var listItem = new Origin
Daniel Nishi
2014/07/10 19:00:08
That would cause an infinite loop calling the cons
|
+ el.origin_ = origin; |
+ OriginListItem.decorate(el); |
+ return el; |
+ }; |
Dan Beam
2014/07/10 02:57:23
}; -> }
Daniel Nishi
2014/07/10 19:00:08
Done.
|
+ |
+ OriginListItem.decorate = function(el) { |
+ el.__proto__ = OriginListItem.prototype; |
+ el.decorate(); |
+ } |
Dan Beam
2014/07/10 02:57:23
};
Dan Beam
2014/07/10 02:57:23
indent off
Daniel Nishi
2014/07/10 19:00:07
Done.
Daniel Nishi
2014/07/10 19:00:08
Done.
|
+ |
+ OriginListItem.prototype = { |
+ __proto__: ListItem.prototype, |
+ |
Dan Beam
2014/07/10 02:57:23
does this need /** @override */?
Daniel Nishi
2014/07/10 19:00:08
I think so.
Done.
|
+ decorate: function() { |
+ ListItem.prototype.decorate.call(this); |
+ |
+ this.classList.add('deletable-item'); |
+ |
+ this.contentElement_ = this.ownerDocument.createElement('div'); |
+ this.appendChild(this.contentElement_); |
+ |
+ var container = this.ownerDocument.createElement('div'); |
Dan Beam
2014/07/10 02:57:23
inline |container| or at least move lower
Bernhard Bauer
2014/07/10 08:47:42
Yeah, it doesn't really seem to be used at all.
Daniel Nishi
2014/07/10 19:00:07
Removed the container.
Daniel Nishi
2014/07/10 19:00:08
Done.
|
+ |
+ var titleEl = this.ownerDocument.createElement('div'); |
+ titleEl.className = 'title'; |
Dan Beam
2014/07/10 02:57:23
titleEl.className = 'title favicon-cell weakrtl';
Daniel Nishi
2014/07/10 19:00:08
Done.
|
+ titleEl.classList.add('favicon-cell'); |
+ titleEl.classList.add('weakrtl'); |
+ titleEl.textContent = this.origin_; |
+ titleEl.style.backgroundImage = getFaviconImageSet(this.origin_); |
+ this.contentElement_.appendChild(titleEl); |
+ this.contentElement_.appendChild(container); |
+ } |
+ }; |
+ |
+ var OriginList = cr.ui.define('list'); |
+ |
+ OriginList.prototype = { |
+ __proto__: List.prototype, |
+ |
+ /** @override */ |
+ createItem: function(entry) { |
+ return new OriginListItem(entry); |
+ }, |
+ }; |
+ |
+ return { |
+ OriginListItem: OriginListItem, |
+ OriginList: OriginList, |
+ }; |
+}); |