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

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
« no previous file with comments | « no previous file | chrome/browser/resources/settings/people_page/manage_profile_browser_proxy.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
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() {
48 this.addWebUIListener('available-icons-changed', function(iconUrls) { 48 var setIcons = function(iconUrls) {
49 this.availableIconUrls = iconUrls; 49 this.availableIconUrls = iconUrls;
50 }.bind(this)); 50 }.bind(this);
51 51
52 this.browserProxy_.getAvailableIcons(); 52 this.addWebUIListener('available-icons-changed', setIcons);
53 this.browserProxy_.getAvailableIcons().then(setIcons);
53 }, 54 },
54 55
55 /** 56 /**
56 * Handler for when the profile name field is changed, then blurred. 57 * Handler for when the profile name field is changed, then blurred.
57 * @private 58 * @private
58 * @param {!Event} event 59 * @param {!Event} event
59 */ 60 */
60 onProfileNameChanged_: function(event) { 61 onProfileNameChanged_: function(event) {
61 if (event.target.invalid) 62 if (event.target.invalid)
62 return; 63 return;
63 64
64 this.browserProxy_.setProfileIconAndName(this.profileIconUrl, 65 this.browserProxy_.setProfileIconAndName(this.profileIconUrl,
65 event.target.value); 66 event.target.value);
66 }, 67 },
67 68
68 /** 69 /**
69 * Handler for when the an image is activated. 70 * Handler for when the an image is activated.
70 * @param {!Event} event 71 * @param {!Event} event
71 * @private 72 * @private
72 */ 73 */
73 onIconActivate_: function(event) { 74 onIconActivate_: function(event) {
74 /** @type {{iconUrl: string}} */ 75 /** @type {{iconUrl: string}} */
75 var buttonData = event.detail.item.dataset; 76 var buttonData = event.detail.item.dataset;
76 this.browserProxy_.setProfileIconAndName(buttonData.iconUrl, 77 this.browserProxy_.setProfileIconAndName(buttonData.iconUrl,
77 this.profileName); 78 this.profileName);
78 }, 79 },
79 }); 80 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/settings/people_page/manage_profile_browser_proxy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698