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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 }, | 638 }, |
639 | 639 |
640 /** | 640 /** |
641 * Appends default images to the image grid. Should only be called once. | 641 * Appends default images to the image grid. Should only be called once. |
642 * @param {Array.<{url: string, author: string, | 642 * @param {Array<{url: string, author: string, |
643 * website: string, title: string}>} imagesData | 643 * website: string, title: string}>} imagesData |
644 * An array of default images data, including URL, author, title and | 644 * An array of default images data, including URL, author, title and |
645 * website. | 645 * website. |
646 */ | 646 */ |
647 setDefaultImages: function(imagesData) { | 647 setDefaultImages: function(imagesData) { |
648 for (var i = 0, data; data = imagesData[i]; i++) { | 648 for (var i = 0, data; data = imagesData[i]; i++) { |
649 var item = this.addItem(data.url, data.title); | 649 var item = this.addItem(data.url, data.title); |
650 item.type = 'default'; | 650 item.type = 'default'; |
651 item.author = data.author || ''; | 651 item.author = data.author || ''; |
652 item.website = data.website || ''; | 652 item.website = data.website || ''; |
653 } | 653 } |
654 } | 654 } |
655 }; | 655 }; |
656 | 656 |
657 /** | 657 /** |
658 * URLs of special button images. | 658 * URLs of special button images. |
659 * @enum {string} | 659 * @enum {string} |
660 */ | 660 */ |
661 UserImagesGrid.ButtonImages = { | 661 UserImagesGrid.ButtonImages = { |
662 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', | 662 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', |
663 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', | 663 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', |
664 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' | 664 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' |
665 }; | 665 }; |
666 | 666 |
667 return { | 667 return { |
668 UserImagesGrid: UserImagesGrid | 668 UserImagesGrid: UserImagesGrid |
669 }; | 669 }; |
670 }); | 670 }); |
OLD | NEW |