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

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

Issue 2626733002: MD Settings People: Fix ChromeOS Change Picture selected image bug (Closed)
Patch Set: fix indent Created 3 years, 11 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/test/data/webui/settings/people_page_change_picture_test.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 * Contains the possible types of Change Picture selections. 6 * Contains the possible types of Change Picture selections.
7 * @enum {string} 7 * @enum {string}
8 */ 8 */
9 var ChangePictureSelectionTypes = { 9 var ChangePictureSelectionTypes = {
10 CAMERA: 'camera', 10 CAMERA: 'camera',
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 this.receiveOldImage_.bind(this)); 131 this.receiveOldImage_.bind(this));
132 this.addWebUIListener('profile-image-changed', 132 this.addWebUIListener('profile-image-changed',
133 this.receiveProfileImage_.bind(this)); 133 this.receiveProfileImage_.bind(this));
134 this.addWebUIListener('camera-presence-changed', 134 this.addWebUIListener('camera-presence-changed',
135 this.receiveCameraPresence_.bind(this)); 135 this.receiveCameraPresence_.bind(this));
136 }, 136 },
137 137
138 138
139 /** @protected */ 139 /** @protected */
140 currentRouteChanged: function(newRoute) { 140 currentRouteChanged: function(newRoute) {
141 // Reset the selection state when we navigate to this page.
142 if (newRoute == settings.Route.CHANGE_PICTURE) { 141 if (newRoute == settings.Route.CHANGE_PICTURE) {
143 this.browserProxy_.initialize(); 142 this.browserProxy_.initialize();
143
144 // This in needed because we manually clear the selectedItem_ property
145 // when navigating away. The selector element doesn't fire its upward
146 // data binding unless its selected item has changed.
147 this.selectedItem_ = this.$.selector.selectedItem;
144 } else { 148 } else {
145 // Ensure we deactivate the camera when we navigate away. 149 // Ensure we deactivate the camera when we navigate away.
146 this.selectedItem_ = null; 150 this.selectedItem_ = null;
147 } 151 }
148 }, 152 },
149 153
150 /** 154 /**
151 * Handler for the 'default-images-changed' event. 155 * Handler for the 'default-images-changed' event.
152 * @param {!Array<!settings.DefaultImage>} images 156 * @param {!Array<!settings.DefaultImage>} images
153 * @private 157 * @private
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 */ 438 */
435 getAuthorWebsite_: function(selectedItem, defaultImages) { 439 getAuthorWebsite_: function(selectedItem, defaultImages) {
436 if (!this.isAuthorCreditShown_(selectedItem)) 440 if (!this.isAuthorCreditShown_(selectedItem))
437 return ''; 441 return '';
438 442
439 assert(selectedItem.dataset.defaultImageIndex !== null && 443 assert(selectedItem.dataset.defaultImageIndex !== null &&
440 selectedItem.dataset.defaultImageIndex < defaultImages.length); 444 selectedItem.dataset.defaultImageIndex < defaultImages.length);
441 return defaultImages[selectedItem.dataset.defaultImageIndex].website; 445 return defaultImages[selectedItem.dataset.defaultImageIndex].website;
442 }, 446 },
443 }); 447 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/people_page_change_picture_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698