OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 Oobe user image screen implementation. | 6 * @fileoverview Oobe user image screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('oobe', function() { | 9 cr.define('oobe', function() { |
10 | 10 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 * True if the Profile image is being loaded. | 121 * True if the Profile image is being loaded. |
122 * @type {boolean} | 122 * @type {boolean} |
123 */ | 123 */ |
124 get profileImageLoading() { | 124 get profileImageLoading() { |
125 return this.profileImageLoading_; | 125 return this.profileImageLoading_; |
126 }, | 126 }, |
127 set profileImageLoading(value) { | 127 set profileImageLoading(value) { |
128 this.profileImageLoading_ = value; | 128 this.profileImageLoading_ = value; |
129 $('user-image-screen-main').classList[ | 129 $('user-image-screen-main').classList[ |
130 value ? 'add' : 'remove']('profile-image-loading'); | 130 value ? 'add' : 'remove']('profile-image-loading'); |
131 this.profileImageCaption = localStrings.getString( | 131 this.updateProfileImageCaption_(); |
132 value ? 'profilePhotoLoading' : 'profilePhoto'); | |
133 }, | 132 }, |
134 | 133 |
135 /** | 134 /** |
136 * True when a default image is selected (including button images). | 135 * True when a default image is selected (including button images). |
137 * @type {boolean} | 136 * @type {boolean} |
138 */ | 137 */ |
139 set defaultImageSelected(value) { | 138 set defaultImageSelected(value) { |
140 $('user-image-preview').classList[ | 139 $('user-image-preview').classList[ |
141 value ? 'add' : 'remove']('default-image'); | 140 value ? 'add' : 'remove']('default-image'); |
142 }, | 141 }, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 imageGrid.focus(); | 311 imageGrid.focus(); |
313 }, | 312 }, |
314 | 313 |
315 /** | 314 /** |
316 * Updates the image preview caption. | 315 * Updates the image preview caption. |
317 * @private | 316 * @private |
318 */ | 317 */ |
319 updateCaption_: function() { | 318 updateCaption_: function() { |
320 $('user-image-preview-caption').textContent = | 319 $('user-image-preview-caption').textContent = |
321 this.profileImageSelected ? this.profileImageCaption : ''; | 320 this.profileImageSelected ? this.profileImageCaption : ''; |
| 321 }, |
| 322 |
| 323 /** |
| 324 * Updates localized content of the screen that is not updated via template. |
| 325 * @public |
| 326 */ |
| 327 updateLocalizedContent: function() { |
| 328 this.updateProfileImageCaption_(); |
| 329 }, |
| 330 |
| 331 /** |
| 332 * Updates profile image caption. |
| 333 * @private |
| 334 */ |
| 335 updateProfileImageCaption_: function() { |
| 336 this.profileImageCaption = localStrings.getString( |
| 337 this.profileImageLoading_ ? 'profilePhotoLoading' : 'profilePhoto'); |
322 } | 338 } |
323 }; | 339 }; |
324 | 340 |
325 // Forward public APIs to private implementations. | 341 // Forward public APIs to private implementations. |
326 [ | 342 [ |
327 'setCameraPresent', | 343 'setCameraPresent', |
328 'setProfileImage', | 344 'setProfileImage', |
329 'setSelectedImage', | 345 'setSelectedImage', |
330 'setUserImages', | 346 'setUserImages', |
331 'setUserPhoto', | 347 'setUserPhoto', |
332 ].forEach(function(name) { | 348 ].forEach(function(name) { |
333 UserImageScreen[name] = function(value) { | 349 UserImageScreen[name] = function(value) { |
334 $('user-image')[name + '_'](value); | 350 $('user-image')[name + '_'](value); |
335 }; | 351 }; |
336 }); | 352 }); |
337 | 353 |
338 return { | 354 return { |
339 UserImageScreen: UserImageScreen | 355 UserImageScreen: UserImageScreen |
340 }; | 356 }; |
341 }); | 357 }); |
OLD | NEW |