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

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: profiles_icon_list.js -> profiles_icon_grid.js 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 };
64
65 var ProfileList = cr.ui.define('list');
66
67 ProfileList.prototype = {
68 __proto__: DeletableItemList.prototype,
69
70 /** @inheritDoc */
71 decorate: function() {
72 DeletableItemList.prototype.decorate.call(this);
73 this.selectionModel = new ListSingleSelectionModel();
74 },
75
76 /** @inheritDoc */
77 createItem: function(pageInfo) {
78 var item = new ProfileListItem(pageInfo);
79 return item;
80 },
81
82 /** @inheritDoc */
83 deleteItemAtIndex: function(index) {
84 ManageProfileOverlay.showDeleteDialog(this.dataModel.item(index));
85 },
86 };
87
88 return {
89 ProfileList: ProfileList
90 };
91 });
92
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/personal_options.js ('k') | chrome/browser/resources/options/profiles_icon_grid.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698