OLD | NEW |
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 Loading... |
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 Loading... |
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 }); |
OLD | NEW |