OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Slide mode displays a single image and has a set of controls to navigate | 6 * Slide mode displays a single image and has a set of controls to navigate |
7 * between the images and to edit an image. | 7 * between the images and to edit an image. |
8 * | 8 * |
9 * @param {!HTMLElement} container Main container element. | 9 * @param {!HTMLElement} container Main container element. |
10 * @param {!HTMLElement} content Content container element. | 10 * @param {!HTMLElement} content Content container element. |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 } else if (loadType === ImageView.LoadType.OFFLINE) { | 985 } else if (loadType === ImageView.LoadType.OFFLINE) { |
986 this.errorBanner_.show('GALLERY_IMAGE_OFFLINE'); | 986 this.errorBanner_.show('GALLERY_IMAGE_OFFLINE'); |
987 } | 987 } |
988 | 988 |
989 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('View')); | 989 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('View')); |
990 | 990 |
991 var toMillions = function(number) { | 991 var toMillions = function(number) { |
992 return Math.round(number / (1000 * 1000)); | 992 return Math.round(number / (1000 * 1000)); |
993 }; | 993 }; |
994 | 994 |
995 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MB'), | 995 var metadata = item.getMetadataItem(); |
996 toMillions(item.getMetadataItem().size)); | 996 if (metadata) { |
| 997 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MB'), |
| 998 toMillions(metadata.size)); |
| 999 } |
997 | 1000 |
998 var canvas = this.imageView_.getCanvas(); | 1001 var canvas = this.imageView_.getCanvas(); |
999 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MPix'), | 1002 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MPix'), |
1000 toMillions(canvas.width * canvas.height)); | 1003 toMillions(canvas.width * canvas.height)); |
1001 | 1004 |
1002 var extIndex = entry.name.lastIndexOf('.'); | 1005 var extIndex = entry.name.lastIndexOf('.'); |
1003 var ext = extIndex < 0 ? '' : | 1006 var ext = extIndex < 0 ? '' : |
1004 entry.name.substr(extIndex + 1).toLowerCase(); | 1007 entry.name.substr(extIndex + 1).toLowerCase(); |
1005 if (ext === 'jpeg') ext = 'jpg'; | 1008 if (ext === 'jpeg') ext = 'jpg'; |
1006 ImageUtil.metrics.recordEnum( | 1009 ImageUtil.metrics.recordEnum( |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 var event = assertInstanceof(event, MouseEvent); | 1858 var event = assertInstanceof(event, MouseEvent); |
1856 var viewport = this.slideMode_.getViewport(); | 1859 var viewport = this.slideMode_.getViewport(); |
1857 if (!this.enabled_ || !viewport.isZoomed()) | 1860 if (!this.enabled_ || !viewport.isZoomed()) |
1858 return; | 1861 return; |
1859 this.stopOperation(); | 1862 this.stopOperation(); |
1860 viewport.setOffset( | 1863 viewport.setOffset( |
1861 viewport.getOffsetX() + event.wheelDeltaX, | 1864 viewport.getOffsetX() + event.wheelDeltaX, |
1862 viewport.getOffsetY() + event.wheelDeltaY); | 1865 viewport.getOffsetY() + event.wheelDeltaY); |
1863 this.slideMode_.applyViewportChange(); | 1866 this.slideMode_.applyViewportChange(); |
1864 }; | 1867 }; |
OLD | NEW |