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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 var mediaType = FileType.getMediaType(this.url_); | 1177 var mediaType = FileType.getMediaType(this.url_); |
1178 | 1178 |
1179 if (metadata.thumbnailURL) { | 1179 if (metadata.thumbnailURL) { |
1180 url = metadata.thumbnailURL; | 1180 url = metadata.thumbnailURL; |
1181 transform = metadata.thumbnailTransform; | 1181 transform = metadata.thumbnailTransform; |
1182 } else if (mediaType == 'image' && | 1182 } else if (mediaType == 'image' && |
1183 FileType.canUseImageUrlForPreview(metadata)) { | 1183 FileType.canUseImageUrlForPreview(metadata)) { |
1184 url = this.url_; | 1184 url = this.url_; |
1185 transform = metadata.imageTransform; | 1185 transform = metadata.imageTransform; |
1186 } else { | 1186 } else { |
1187 url = '../../' + FileType.getPreviewArt(mediaType); | 1187 url = FileType.getPreviewArt(mediaType); |
1188 } | 1188 } |
1189 | 1189 |
1190 function percent(ratio) { return Math.round(ratio * 100) + '%' } | 1190 function percent(ratio) { return Math.round(ratio * 100) + '%' } |
1191 | 1191 |
1192 function resizeToFill(img, aspect) { | 1192 function resizeToFill(img, aspect) { |
1193 if ((aspect > 1)) { | 1193 if ((aspect > 1)) { |
1194 img.style.height = percent(1); | 1194 img.style.height = percent(1); |
1195 img.style.width = percent(aspect); | 1195 img.style.width = percent(aspect); |
1196 img.style.marginLeft = percent((1 - aspect) / 2); | 1196 img.style.marginLeft = percent((1 - aspect) / 2); |
1197 img.style.marginTop = 0; | 1197 img.style.marginTop = 0; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 ShareMode.prototype.setUp = function() { | 1275 ShareMode.prototype.setUp = function() { |
1276 ImageEditor.Mode.prototype.setUp.apply(this, arguments); | 1276 ImageEditor.Mode.prototype.setUp.apply(this, arguments); |
1277 ImageUtil.setAttribute(this.menu_, 'hidden', false); | 1277 ImageUtil.setAttribute(this.menu_, 'hidden', false); |
1278 ImageUtil.setAttribute(this.button_, 'pressed', false); | 1278 ImageUtil.setAttribute(this.button_, 'pressed', false); |
1279 }; | 1279 }; |
1280 | 1280 |
1281 ShareMode.prototype.cleanUpUI = function() { | 1281 ShareMode.prototype.cleanUpUI = function() { |
1282 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); | 1282 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); |
1283 ImageUtil.setAttribute(this.menu_, 'hidden', true); | 1283 ImageUtil.setAttribute(this.menu_, 'hidden', true); |
1284 }; | 1284 }; |
OLD | NEW |