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 /* | 5 /* |
6 * Base class that Ribbon uses to display photos. | 6 * Base class that Ribbon uses to display photos. |
7 */ | 7 */ |
8 | 8 |
9 function RibbonClient() {} | 9 function RibbonClient() {} |
10 | 10 |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 var mediaType = FileType.getMediaType(this.url_); | 1159 var mediaType = FileType.getMediaType(this.url_); |
1160 | 1160 |
1161 if (metadata.thumbnailURL) { | 1161 if (metadata.thumbnailURL) { |
1162 url = metadata.thumbnailURL; | 1162 url = metadata.thumbnailURL; |
1163 transform = metadata.thumbnailTransform; | 1163 transform = metadata.thumbnailTransform; |
1164 } else if (mediaType == 'image' && | 1164 } else if (mediaType == 'image' && |
1165 FileType.canUseImageUrlForPreview(metadata)) { | 1165 FileType.canUseImageUrlForPreview(metadata)) { |
1166 url = this.url_; | 1166 url = this.url_; |
1167 transform = metadata.imageTransform; | 1167 transform = metadata.imageTransform; |
1168 } else { | 1168 } else { |
1169 url = '../../' + FileType.getPreviewArt(mediaType); | 1169 url = FileType.getPreviewArt(mediaType); |
1170 } | 1170 } |
1171 | 1171 |
1172 function percent(ratio) { return Math.round(ratio * 100) + '%' } | 1172 function percent(ratio) { return Math.round(ratio * 100) + '%' } |
1173 | 1173 |
1174 function resizeToFill(img, aspect) { | 1174 function resizeToFill(img, aspect) { |
1175 if ((aspect > 1)) { | 1175 if ((aspect > 1)) { |
1176 img.style.height = percent(1); | 1176 img.style.height = percent(1); |
1177 img.style.width = percent(aspect); | 1177 img.style.width = percent(aspect); |
1178 img.style.marginLeft = percent((1 - aspect) / 2); | 1178 img.style.marginLeft = percent((1 - aspect) / 2); |
1179 img.style.marginTop = 0; | 1179 img.style.marginTop = 0; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 ShareMode.prototype.setUp = function() { | 1257 ShareMode.prototype.setUp = function() { |
1258 ImageEditor.Mode.prototype.setUp.apply(this, arguments); | 1258 ImageEditor.Mode.prototype.setUp.apply(this, arguments); |
1259 ImageUtil.setAttribute(this.menu_, 'hidden', false); | 1259 ImageUtil.setAttribute(this.menu_, 'hidden', false); |
1260 ImageUtil.setAttribute(this.button_, 'pressed', false); | 1260 ImageUtil.setAttribute(this.button_, 'pressed', false); |
1261 }; | 1261 }; |
1262 | 1262 |
1263 ShareMode.prototype.cleanUpUI = function() { | 1263 ShareMode.prototype.cleanUpUI = function() { |
1264 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); | 1264 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); |
1265 ImageUtil.setAttribute(this.menu_, 'hidden', true); | 1265 ImageUtil.setAttribute(this.menu_, 'hidden', true); |
1266 }; | 1266 }; |
OLD | NEW |