| 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
| 8 var UserImagesGrid = options.UserImagesGrid; | 8 var UserImagesGrid = options.UserImagesGrid; |
| 9 var ButtonImages = UserImagesGrid.ButtonImages; | 9 var ButtonImages = UserImagesGrid.ButtonImages; |
| 10 | 10 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 }, | 302 }, |
| 303 | 303 |
| 304 /** | 304 /** |
| 305 * Appends default images to the image grid. Should only be called once. | 305 * Appends default images to the image grid. Should only be called once. |
| 306 * @param {Array.<{url: string, author: string, website: string}>} | 306 * @param {Array.<{url: string, author: string, website: string}>} |
| 307 * imagesData An array of default images data, including URL, author and | 307 * imagesData An array of default images data, including URL, author and |
| 308 * website. | 308 * website. |
| 309 * @private | 309 * @private |
| 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 }, | 313 }, |
| 320 }; | 314 }; |
| 321 | 315 |
| 322 // Forward public APIs to private implementations. | 316 // Forward public APIs to private implementations. |
| 323 cr.makePublic(ChangePictureOptions, [ | 317 cr.makePublic(ChangePictureOptions, [ |
| 324 'closeOverlay', | 318 'closeOverlay', |
| 325 'setCameraPresent', | 319 'setCameraPresent', |
| 326 'setDefaultImages', | 320 'setDefaultImages', |
| 327 'setOldImage', | 321 'setOldImage', |
| 328 'setProfileImage', | 322 'setProfileImage', |
| 329 'setSelectedImage', | 323 'setSelectedImage', |
| 330 ]); | 324 ]); |
| 331 | 325 |
| 332 // Export | 326 // Export |
| 333 return { | 327 return { |
| 334 ChangePictureOptions: ChangePictureOptions | 328 ChangePictureOptions: ChangePictureOptions |
| 335 }; | 329 }; |
| 336 | 330 |
| 337 }); | 331 }); |
| OLD | NEW |