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

Side by Side Diff: chrome/browser/resources/settings/people_page/manage_profile.js

Issue 1871653002: Settings People Revamp: Update ManageProfileHandler to use Promises. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-manage-profile' is the settings subpage containing controls to 7 * 'settings-manage-profile' is the settings subpage containing controls to
8 * edit a profile's name, icon, and desktop shortcut. 8 * edit a profile's name, icon, and desktop shortcut.
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 26 matching lines...) Expand all
37 */ 37 */
38 browserProxy_: { 38 browserProxy_: {
39 type: Object, 39 type: Object,
40 value: function() { 40 value: function() {
41 return settings.ManageProfileBrowserProxyImpl.getInstance(); 41 return settings.ManageProfileBrowserProxyImpl.getInstance();
42 }, 42 },
43 }, 43 },
44 }, 44 },
45 45
46 /** @override */ 46 /** @override */
47 attached: function() { 47 attached: function() {
dpapad 2016/04/07 20:34:24 Nit (optional): you can reuse the same function tw
tommycli 2016/04/07 20:48:38 I did the first option. I don't think it's racy un
48 this.addWebUIListener('available-icons-changed', function(iconUrls) { 48 this.addWebUIListener('available-icons-changed', function(iconUrls) {
49 this.availableIconUrls = iconUrls; 49 this.availableIconUrls = iconUrls;
50 }.bind(this)); 50 }.bind(this));
51 51
52 this.browserProxy_.getAvailableIcons(); 52 this.browserProxy_.getAvailableIcons().then(function(iconUrls) {
53 this.availableIconUrls = iconUrls;
54 }.bind(this));
53 }, 55 },
54 56
55 /** 57 /**
56 * Handler for when the profile name field is changed, then blurred. 58 * Handler for when the profile name field is changed, then blurred.
57 * @private 59 * @private
58 * @param {!Event} event 60 * @param {!Event} event
59 */ 61 */
60 onProfileNameChanged_: function(event) { 62 onProfileNameChanged_: function(event) {
61 if (event.target.invalid) 63 if (event.target.invalid)
62 return; 64 return;
63 65
64 this.browserProxy_.setProfileIconAndName(this.profileIconUrl, 66 this.browserProxy_.setProfileIconAndName(this.profileIconUrl,
65 event.target.value); 67 event.target.value);
66 }, 68 },
67 69
68 /** 70 /**
69 * Handler for when the an image is activated. 71 * Handler for when the an image is activated.
70 * @param {!Event} event 72 * @param {!Event} event
71 * @private 73 * @private
72 */ 74 */
73 onIconActivate_: function(event) { 75 onIconActivate_: function(event) {
74 /** @type {{iconUrl: string}} */ 76 /** @type {{iconUrl: string}} */
75 var buttonData = event.detail.item.dataset; 77 var buttonData = event.detail.item.dataset;
76 this.browserProxy_.setProfileIconAndName(buttonData.iconUrl, 78 this.browserProxy_.setProfileIconAndName(buttonData.iconUrl,
77 this.profileName); 79 this.profileName);
78 }, 80 },
79 }); 81 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698