| 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 cr.exportPath('settings_test'); | 5 cr.exportPath('settings_test'); |
| 6 | 6 |
| 7 /** @type {boolean} */ | 7 /** @type {boolean} */ |
| 8 settings_test.changePictureNotifyForTest; | 8 settings_test.changePictureNotifyForTest; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 * True if the user has a plugged-in webcam. | 37 * True if the user has a plugged-in webcam. |
| 38 * @private {boolean} | 38 * @private {boolean} |
| 39 */ | 39 */ |
| 40 cameraPresent_: { | 40 cameraPresent_: { |
| 41 type: Boolean, | 41 type: Boolean, |
| 42 value: false, | 42 value: false, |
| 43 }, | 43 }, |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * The currently selected item. This property is bound to the iron-selector | 46 * The currently selected item. This property is bound to the iron-selector |
| 47 * and never directly assigned. | 47 * and never directly assigned. This may be undefined momentarily as |
| 48 * @private {settings.ChangePictureImageElement} | 48 * the selection changes due to iron-selector implementation details. |
| 49 * @private {?settings.ChangePictureImageElement} |
| 49 */ | 50 */ |
| 50 selectedItem_: { | 51 selectedItem_: Object, |
| 51 type: settings.ChangePictureImageElement, | |
| 52 notify: !!settings_test.changePictureNotifyForTest, | |
| 53 }, | |
| 54 | 52 |
| 55 /** | 53 /** |
| 56 * The url of the 'old' image, which is the existing image sourced from | 54 * The url of the 'old' image, which is the existing image sourced from |
| 57 * the camera, a file, or a deprecated default image. It defaults to an | 55 * the camera, a file, or a deprecated default image. It defaults to an |
| 58 * empty string instead of undefined, because Polymer bindings don't behave | 56 * empty string instead of undefined, because Polymer bindings don't behave |
| 59 * as expected with undefined properties. | 57 * as expected with undefined properties. |
| 60 * @private {string} | 58 * @private {string} |
| 61 */ | 59 */ |
| 62 oldImageUrl_: { | 60 oldImageUrl_: { |
| 63 type: String, | 61 type: String, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 80 defaultImages_: { | 78 defaultImages_: { |
| 81 type: Array, | 79 type: Array, |
| 82 value: function() { return []; }, | 80 value: function() { return []; }, |
| 83 }, | 81 }, |
| 84 | 82 |
| 85 /** | 83 /** |
| 86 * The fallback image to be selected when the user discards the 'old' image. | 84 * The fallback image to be selected when the user discards the 'old' image. |
| 87 * This may be null if the user started with the 'old' image. | 85 * This may be null if the user started with the 'old' image. |
| 88 * @private {?settings.ChangePictureImageElement} | 86 * @private {?settings.ChangePictureImageElement} |
| 89 */ | 87 */ |
| 90 fallbackImage_: { | 88 fallbackImage_: Object, |
| 91 type: settings.ChangePictureImageElement, | |
| 92 value: null, | |
| 93 }, | |
| 94 | 89 |
| 95 /** | 90 /** |
| 96 * Type of the last selected icon. This is used to jump back to the camera | 91 * Type of the last selected icon. This is used to jump back to the camera |
| 97 * after the user discards a newly taken photo. | 92 * after the user discards a newly taken photo. |
| 98 * @private {string} | 93 * @private {string} |
| 99 */ | 94 */ |
| 100 lastSelectedImageType_: { | 95 lastSelectedImageType_: { |
| 101 type: String, | 96 type: String, |
| 102 value: '', | 97 value: '', |
| 103 }, | 98 }, |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 if (this.fallbackImage_ != null) { | 310 if (this.fallbackImage_ != null) { |
| 316 this.selectImage_(this.fallbackImage_); | 311 this.selectImage_(this.fallbackImage_); |
| 317 return; | 312 return; |
| 318 } | 313 } |
| 319 | 314 |
| 320 // If the user has not chosen an image since opening the subpage and | 315 // If the user has not chosen an image since opening the subpage and |
| 321 // discards the current photo, select the first default image. | 316 // discards the current photo, select the first default image. |
| 322 assert(this.defaultImages_.length > 0); | 317 assert(this.defaultImages_.length > 0); |
| 323 this.browserProxy_.selectDefaultImage(this.defaultImages_[0].url); | 318 this.browserProxy_.selectDefaultImage(this.defaultImages_[0].url); |
| 324 | 319 |
| 325 announceAccessibleMessage( | 320 announceAccessibleMessage(this.i18n('photoDiscardAccessibleText')); |
| 326 loadTimeData.getString('photoDiscardAccessibleText')); | |
| 327 }, | 321 }, |
| 328 | 322 |
| 329 /** | 323 /** |
| 330 * @param {string} oldImageUrl | 324 * @param {string} oldImageUrl |
| 331 * @return {boolean} True if there is no old image and the old image icon | 325 * @return {boolean} True if there is no old image and the old image icon |
| 332 * should be hidden. | 326 * should be hidden. |
| 333 * @private | 327 * @private |
| 334 */ | 328 */ |
| 335 isOldImageHidden_: function(oldImageUrl) { return oldImageUrl.length == 0; }, | 329 isOldImageHidden_: function(oldImageUrl) { return oldImageUrl.length == 0; }, |
| 336 | 330 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 */ | 394 */ |
| 401 getAuthorWebsite_: function(selectedItem, defaultImages) { | 395 getAuthorWebsite_: function(selectedItem, defaultImages) { |
| 402 if (!this.isAuthorCreditShown_(selectedItem)) | 396 if (!this.isAuthorCreditShown_(selectedItem)) |
| 403 return ''; | 397 return ''; |
| 404 | 398 |
| 405 assert(selectedItem.dataset.defaultImageIndex !== null && | 399 assert(selectedItem.dataset.defaultImageIndex !== null && |
| 406 selectedItem.dataset.defaultImageIndex < defaultImages.length); | 400 selectedItem.dataset.defaultImageIndex < defaultImages.length); |
| 407 return defaultImages[selectedItem.dataset.defaultImageIndex].website; | 401 return defaultImages[selectedItem.dataset.defaultImageIndex].website; |
| 408 }, | 402 }, |
| 409 }); | 403 }); |
| OLD | NEW |