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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 return el; | 57 return el; |
58 } | 58 } |
59 | 59 |
60 UserImagesGridItem.prototype = { | 60 UserImagesGridItem.prototype = { |
61 __proto__: GridItem.prototype, | 61 __proto__: GridItem.prototype, |
62 | 62 |
63 /** @inheritDoc */ | 63 /** @inheritDoc */ |
64 decorate: function() { | 64 decorate: function() { |
65 GridItem.prototype.decorate.call(this); | 65 GridItem.prototype.decorate.call(this); |
66 var imageEl = cr.doc.createElement('img'); | 66 var imageEl = cr.doc.createElement('img'); |
67 imageEl.src = this.dataItem.url; | 67 imageEl.src = this.dataItem.url + '@' + window.devicePixelRatio + 'x'; |
Ivan Korotkov
2012/08/16 08:31:51
This wouldn't work with all URLs in this grid (the
| |
68 imageEl.title = this.dataItem.title || ''; | 68 imageEl.title = this.dataItem.title || ''; |
69 if (typeof this.dataItem.clickHandler == 'function') | 69 if (typeof this.dataItem.clickHandler == 'function') |
70 imageEl.addEventListener('mousedown', this.dataItem.clickHandler); | 70 imageEl.addEventListener('mousedown', this.dataItem.clickHandler); |
71 // Remove any garbage added by GridItem and ListItem decorators. | 71 // Remove any garbage added by GridItem and ListItem decorators. |
72 this.textContent = ''; | 72 this.textContent = ''; |
73 this.appendChild(imageEl); | 73 this.appendChild(imageEl); |
74 if (typeof this.dataItem.decorateFn == 'function') | 74 if (typeof this.dataItem.decorateFn == 'function') |
75 this.dataItem.decorateFn(this); | 75 this.dataItem.decorateFn(this); |
76 this.setAttribute('role', 'option'); | 76 this.setAttribute('role', 'option'); |
77 } | 77 } |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 UserImagesGrid.ButtonImages = { | 665 UserImagesGrid.ButtonImages = { |
666 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', | 666 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', |
667 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', | 667 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', |
668 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' | 668 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' |
669 }; | 669 }; |
670 | 670 |
671 return { | 671 return { |
672 UserImagesGrid: UserImagesGrid | 672 UserImagesGrid: UserImagesGrid |
673 }; | 673 }; |
674 }); | 674 }); |
OLD | NEW |