Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/resources/chromeos/user_images_grid.js

Issue 10830341: options image grid: Make sure the images are requested with the appropriate scale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 var scheme = 'chrome://';
68 if (this.dataItem.url.slice(0, scheme.length) == scheme)
Ivan Korotkov 2012/08/16 17:47:53 Optional: using a regexp or url.indexOf(scheme) ==
sadrul 2012/08/16 19:36:16 I considered using indexOf at first. But since thi
Ivan Korotkov 2012/08/17 08:01:43 Right, makes sense.
69 imageEl.src = this.dataItem.url + '@' + window.devicePixelRatio + 'x';
70 else
71 imageEl.src = this.dataItem.url;
68 imageEl.title = this.dataItem.title || ''; 72 imageEl.title = this.dataItem.title || '';
69 if (typeof this.dataItem.clickHandler == 'function') 73 if (typeof this.dataItem.clickHandler == 'function')
70 imageEl.addEventListener('mousedown', this.dataItem.clickHandler); 74 imageEl.addEventListener('mousedown', this.dataItem.clickHandler);
71 // Remove any garbage added by GridItem and ListItem decorators. 75 // Remove any garbage added by GridItem and ListItem decorators.
72 this.textContent = ''; 76 this.textContent = '';
73 this.appendChild(imageEl); 77 this.appendChild(imageEl);
74 if (typeof this.dataItem.decorateFn == 'function') 78 if (typeof this.dataItem.decorateFn == 'function')
75 this.dataItem.decorateFn(this); 79 this.dataItem.decorateFn(this);
76 this.setAttribute('role', 'option'); 80 this.setAttribute('role', 'option');
77 } 81 }
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 UserImagesGrid.ButtonImages = { 669 UserImagesGrid.ButtonImages = {
666 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', 670 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO',
667 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', 671 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE',
668 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' 672 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING'
669 }; 673 };
670 674
671 return { 675 return {
672 UserImagesGrid: UserImagesGrid 676 UserImagesGrid: UserImagesGrid
673 }; 677 };
674 }); 678 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698