| Index: chrome/browser/resources/options/profiles_icon_list.js
|
| diff --git a/chrome/browser/resources/options/profiles_icon_list.js b/chrome/browser/resources/options/profiles_icon_list.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..eaae7377395cb98950cec35217b1e92f0d949c07
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/options/profiles_icon_list.js
|
| @@ -0,0 +1,68 @@
|
| +// 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('options', function() {
|
| + const ListItem = cr.ui.ListItem;
|
| + const List = cr.ui.List;
|
| + const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
|
| +
|
| + /**
|
| + * Creates a new profile icon list item.
|
| + * @param {Object} iconURL The profile icon URL.
|
| + * @constructor
|
| + * @extends {cr.ui.ListItem}
|
| + */
|
| + function ProfilesIconListItem(iconURL) {
|
| + var el = cr.doc.createElement('div');
|
| + el.iconURL_ = iconURL;
|
| + ProfilesIconListItem.decorate(el);
|
| + return el;
|
| + }
|
| +
|
| + /**
|
| + * Decorates an element as a profile list item.
|
| + * @param {!HTMLElement} el The element to decorate.
|
| + */
|
| + ProfilesIconListItem.decorate = function(el) {
|
| + el.__proto__ = ProfilesIconListItem.prototype;
|
| + el.decorate();
|
| + };
|
| +
|
| + ProfilesIconListItem.prototype = {
|
| + __proto__: ListItem.prototype,
|
| +
|
| + /** @inheritDoc */
|
| + decorate: function() {
|
| + ListItem.prototype.decorate.call(this);
|
| + var imageEl = cr.doc.createElement('img');
|
| + imageEl.className = 'profile-icon';
|
| + imageEl.src = this.iconURL_;
|
| + this.appendChild(imageEl);
|
| +
|
| + this.className = 'profile-icon-list-item';
|
| + },
|
| + };
|
| +
|
| + var ProfilesIconList = cr.ui.define('list');
|
| +
|
| + ProfilesIconList.prototype = {
|
| + __proto__: List.prototype,
|
| +
|
| + /** @inheritDoc */
|
| + decorate: function() {
|
| + List.prototype.decorate.call(this);
|
| + this.selectionModel = new ListSingleSelectionModel();
|
| + },
|
| +
|
| + /** @inheritDoc */
|
| + createItem: function(iconURL) {
|
| + return new ProfilesIconListItem(iconURL);
|
| + },
|
| + };
|
| +
|
| + return {
|
| + ProfilesIconList: ProfilesIconList
|
| + };
|
| +});
|
| +
|
|
|