| 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 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| 7 /** @const */ var Grid = cr.ui.Grid; | 7 /** @const */ var Grid = cr.ui.Grid; |
| 8 /** @const */ var GridItem = cr.ui.GridItem; | 8 /** @const */ var GridItem = cr.ui.GridItem; |
| 9 /** @const */ var GridSelectionController = cr.ui.GridSelectionController; | 9 /** @const */ var GridSelectionController = cr.ui.GridSelectionController; |
| 10 /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; | 10 /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 628 |
| 629 /** | 629 /** |
| 630 * Forces re-display, size re-calculation and focuses grid. | 630 * Forces re-display, size re-calculation and focuses grid. |
| 631 */ | 631 */ |
| 632 updateAndFocus: function() { | 632 updateAndFocus: function() { |
| 633 // Recalculate the measured item size. | 633 // Recalculate the measured item size. |
| 634 this.measured_ = null; | 634 this.measured_ = null; |
| 635 this.columns = 0; | 635 this.columns = 0; |
| 636 this.redraw(); | 636 this.redraw(); |
| 637 this.focus(); | 637 this.focus(); |
| 638 }, |
| 639 |
| 640 /** |
| 641 * Appends default images to the image grid. Should only be called once. |
| 642 * @param {Array.<{url: string, author: string, |
| 643 * website: string, title: string}>} imagesData |
| 644 * An array of default images data, including URL, author, title and |
| 645 * website. |
| 646 */ |
| 647 setDefaultImages: function(imagesData) { |
| 648 for (var i = 0, data; data = imagesData[i]; i++) { |
| 649 var item = this.addItem(data.url, data.title); |
| 650 item.type = 'default'; |
| 651 item.author = data.author || ''; |
| 652 item.website = data.website || ''; |
| 653 } |
| 638 } | 654 } |
| 639 }; | 655 }; |
| 640 | 656 |
| 641 /** | 657 /** |
| 642 * URLs of special button images. | 658 * URLs of special button images. |
| 643 * @enum {string} | 659 * @enum {string} |
| 644 */ | 660 */ |
| 645 UserImagesGrid.ButtonImages = { | 661 UserImagesGrid.ButtonImages = { |
| 646 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', | 662 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', |
| 647 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', | 663 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', |
| 648 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' | 664 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' |
| 649 }; | 665 }; |
| 650 | 666 |
| 651 return { | 667 return { |
| 652 UserImagesGrid: UserImagesGrid | 668 UserImagesGrid: UserImagesGrid |
| 653 }; | 669 }; |
| 654 }); | 670 }); |
| OLD | NEW |