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, website: string}>} | |
Daniel Erat
2015/02/12 14:18:10
this comment doesn't mention a "title" property, b
| |
643 * imagesData | |
644 * An array of default images data, including URL, author and website. | |
645 */ | |
646 setDefaultImages: function(imagesData) { | |
647 for (var i = 0, data; data = imagesData[i]; i++) { | |
648 var item = this.addItem(data.url, data.title); | |
649 item.type = 'default'; | |
650 item.author = data.author || ''; | |
651 item.website = data.website || ''; | |
652 } | |
638 } | 653 } |
639 }; | 654 }; |
640 | 655 |
641 /** | 656 /** |
642 * URLs of special button images. | 657 * URLs of special button images. |
643 * @enum {string} | 658 * @enum {string} |
644 */ | 659 */ |
645 UserImagesGrid.ButtonImages = { | 660 UserImagesGrid.ButtonImages = { |
646 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', | 661 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', |
647 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', | 662 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', |
648 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' | 663 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' |
649 }; | 664 }; |
650 | 665 |
651 return { | 666 return { |
652 UserImagesGrid: UserImagesGrid | 667 UserImagesGrid: UserImagesGrid |
653 }; | 668 }; |
654 }); | 669 }); |
OLD | NEW |