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

Side by Side Diff: chrome/browser/resources/options/personal_options_profile_list.js

Issue 7400032: Multi-profile WebUI settings (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Notify when deleting profile from cache Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('options.personal_options', function() {
6 const DeletableItem = options.DeletableItem;
7 const DeletableItemList = options.DeletableItemList;
8 const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
9
10 var localStrings = new LocalStrings();
11
12 /**
13 * Creates a new profile list item.
14 * @param {Object} profileInfo The profile this item respresents.
15 * @constructor
16 * @extends {cr.ui.DeletableItem}
17 */
18 function ProfileListItem(profileInfo) {
19 var el = cr.doc.createElement('div');
20 el.profileInfo_ = profileInfo;
21 ProfileListItem.decorate(el);
22 return el;
23 }
24
25 /**
26 * Decorates an element as a profile list item.
27 * @param {!HTMLElement} el The element to decorate.
28 */
29 ProfileListItem.decorate = function(el) {
30 el.__proto__ = ProfileListItem.prototype;
31 el.decorate();
32 };
33
34 ProfileListItem.prototype = {
35 __proto__: DeletableItem.prototype,
36
37 /**
38 * Get the filepath for this profile list item.
39 * @return the file path of this item.
40 */
41 get profilePath() {
42 return this.profileInfo_.filePath;
43 },
44
45 /** @inheritDoc */
46 decorate: function() {
47 DeletableItem.prototype.decorate.call(this);
48
49 var profileInfo = this.profileInfo_;
50
51 var nameEl = this.contentElement;
52 nameEl.className = 'profile-item';
53 if (profileInfo.isCurrentProfile)
54 nameEl.classList.add('profile-item-current');
55
56 var displayName = profileInfo.name;
57 if (profileInfo.isCurrentProfile)
58 displayName = localStrings.getStringF(
59 'profilesListItemCurrent',
60 profileInfo.name)
61 nameEl.textContent = displayName;
62
63 this.addEventListener('dblclick', this.onDblClick_);
64 },
65
66 /**
67 */
68 onDblClick_: function(e) {
69 },
70
71 };
72
73 var ProfileList = cr.ui.define('list');
74
75 ProfileList.prototype = {
76 __proto__: DeletableItemList.prototype,
77
78 /** @inheritDoc */
79 decorate: function() {
80 DeletableItemList.prototype.decorate.call(this);
81 this.selectionModel = new ListSingleSelectionModel();
82 },
83
84 /** @inheritDoc */
85 createItem: function(pageInfo) {
86 var item = new ProfileListItem(pageInfo);
87 return item;
88 },
89
90 /** @inheritDoc */
91 deleteItemAtIndex: function(index) {
92 ProfilesManageOverlay.showDeleteDialog(this.dataModel.item(index));
93 },
94 };
95
96 return {
97 ProfileList: ProfileList
98 };
99 });
100
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698