Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 login.createScreen('UserImageScreen', 'user-image', function() { | 9 login.createScreen('UserImageScreen', 'user-image', function() { |
| 10 var CONTEXT_KEY_IS_CAMERA_PRESENT = 'isCameraPresent'; | 10 var CONTEXT_KEY_IS_CAMERA_PRESENT = 'isCameraPresent'; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 acceptImage_: function() { | 296 acceptImage_: function() { |
| 297 var okButton = $('ok-button'); | 297 var okButton = $('ok-button'); |
| 298 if (!okButton.disabled) { | 298 if (!okButton.disabled) { |
| 299 // This ensures that #ok-button won't be re-enabled again. | 299 // This ensures that #ok-button won't be re-enabled again. |
| 300 $('user-image-grid').disabled = true; | 300 $('user-image-grid').disabled = true; |
| 301 okButton.disabled = true; | 301 okButton.disabled = true; |
| 302 chrome.send('onUserImageAccepted'); | 302 chrome.send('onUserImageAccepted'); |
| 303 } | 303 } |
| 304 }, | 304 }, |
| 305 | 305 |
| 306 | |
|
Daniel Erat
2015/02/12 14:18:10
nit: delete extra blank line
merkulova
2015/02/12 14:33:06
Done.
| |
| 306 /** | 307 /** |
| 307 * Appends default images to the image grid. Should only be called once. | 308 * Appends default images to the image grid. Should only be called once. |
| 308 * @param {Array.<{url: string, author: string, website: string}>} images | 309 * @param {Array.<{url: string, author: string, website: string}>} images |
| 309 * An array of default images data, including URL, author and website. | 310 * An array of default images data, including URL, author and website. |
| 310 */ | 311 */ |
| 311 setDefaultImages: function(imagesData) { | 312 setDefaultImages: function(imagesData) { |
| 312 var imageGrid = $('user-image-grid'); | 313 $('user-image-grid').setDefaultImages(imagesData); |
| 313 for (var i = 0, data; data = imagesData[i]; i++) { | |
| 314 var item = imageGrid.addItem(data.url, data.title); | |
| 315 item.type = 'default'; | |
| 316 item.author = data.author || ''; | |
| 317 item.website = data.website || ''; | |
| 318 } | |
| 319 this.setSelectedImage_( | 314 this.setSelectedImage_( |
| 320 this.context.get(CONTEXT_KEY_SELECTED_IMAGE_URL, '')); | 315 this.context.get(CONTEXT_KEY_SELECTED_IMAGE_URL, '')); |
| 321 chrome.send('screenReady'); | 316 chrome.send('screenReady'); |
| 322 }, | 317 }, |
| 323 | 318 |
| 324 /** | 319 /** |
| 325 * Selects user image with the given URL. | 320 * Selects user image with the given URL. |
| 326 * @param {string} url URL of the image to select. | 321 * @param {string} url URL of the image to select. |
| 327 * @private | 322 * @private |
| 328 */ | 323 */ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 */ | 369 */ |
| 375 notifyImageSelected_: function() { | 370 notifyImageSelected_: function() { |
| 376 var imageGrid = $('user-image-grid'); | 371 var imageGrid = $('user-image-grid'); |
| 377 chrome.send('selectImage', | 372 chrome.send('selectImage', |
| 378 [imageGrid.selectedItemUrl, | 373 [imageGrid.selectedItemUrl, |
| 379 imageGrid.selectionType, | 374 imageGrid.selectionType, |
| 380 !imageGrid.inProgramSelection]); | 375 !imageGrid.inProgramSelection]); |
| 381 } | 376 } |
| 382 }; | 377 }; |
| 383 }); | 378 }); |
| OLD | NEW |