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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 chrome.send('onUserImageAccepted'); | 302 chrome.send('onUserImageAccepted'); |
303 } | 303 } |
304 }, | 304 }, |
305 | 305 |
306 /** | 306 /** |
307 * Appends default images to the image grid. Should only be called once. | 307 * Appends default images to the image grid. Should only be called once. |
308 * @param {Array.<{url: string, author: string, website: string}>} images | 308 * @param {Array.<{url: string, author: string, website: string}>} images |
309 * An array of default images data, including URL, author and website. | 309 * An array of default images data, including URL, author and website. |
310 */ | 310 */ |
311 setDefaultImages: function(imagesData) { | 311 setDefaultImages: function(imagesData) { |
312 var imageGrid = $('user-image-grid'); | 312 $('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_( | 313 this.setSelectedImage_( |
320 this.context.get(CONTEXT_KEY_SELECTED_IMAGE_URL, '')); | 314 this.context.get(CONTEXT_KEY_SELECTED_IMAGE_URL, '')); |
321 chrome.send('screenReady'); | 315 chrome.send('screenReady'); |
322 }, | 316 }, |
323 | 317 |
324 /** | 318 /** |
325 * Selects user image with the given URL. | 319 * Selects user image with the given URL. |
326 * @param {string} url URL of the image to select. | 320 * @param {string} url URL of the image to select. |
327 * @private | 321 * @private |
328 */ | 322 */ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 */ | 368 */ |
375 notifyImageSelected_: function() { | 369 notifyImageSelected_: function() { |
376 var imageGrid = $('user-image-grid'); | 370 var imageGrid = $('user-image-grid'); |
377 chrome.send('selectImage', | 371 chrome.send('selectImage', |
378 [imageGrid.selectedItemUrl, | 372 [imageGrid.selectedItemUrl, |
379 imageGrid.selectionType, | 373 imageGrid.selectionType, |
380 !imageGrid.inProgramSelection]); | 374 !imageGrid.inProgramSelection]); |
381 } | 375 } |
382 }; | 376 }; |
383 }); | 377 }); |
OLD | NEW |