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 * 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 * TODO(kaznacheev): Introduce a parameter object. | 9 * TODO(kaznacheev): Introduce a parameter object. |
10 * | 10 * |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 } | 638 } |
639 | 639 |
640 if (video) { | 640 if (video) { |
641 // The editor toolbar does not make sense for video, hide it. | 641 // The editor toolbar does not make sense for video, hide it. |
642 this.stopEditing_(); | 642 this.stopEditing_(); |
643 this.mediaControls_.attachMedia(this.imageView_.getVideo()); | 643 this.mediaControls_.attachMedia(this.imageView_.getVideo()); |
644 //TODO(kaznacheev): Add metrics for video playback. | 644 //TODO(kaznacheev): Add metrics for video playback. |
645 } else { | 645 } else { |
646 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('View')); | 646 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('View')); |
647 | 647 |
648 function toMillions(number) { return Math.round(number / (1000 * 1000)) } | 648 var toMillions = function(number) { |
| 649 return Math.round(number / (1000 * 1000)); |
| 650 }; |
649 | 651 |
650 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MB'), | 652 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MB'), |
651 toMillions(metadata.filesystem.size)); | 653 toMillions(metadata.filesystem.size)); |
652 | 654 |
653 var canvas = this.imageView_.getCanvas(); | 655 var canvas = this.imageView_.getCanvas(); |
654 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MPix'), | 656 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MPix'), |
655 toMillions(canvas.width * canvas.height)); | 657 toMillions(canvas.width * canvas.height)); |
656 | 658 |
657 var extIndex = url.lastIndexOf('.'); | 659 var extIndex = url.lastIndexOf('.'); |
658 var ext = extIndex < 0 ? '' : url.substr(extIndex + 1).toLowerCase(); | 660 var ext = extIndex < 0 ? '' : url.substr(extIndex + 1).toLowerCase(); |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 done = true; | 1263 done = true; |
1262 } | 1264 } |
1263 }.bind(this); | 1265 }.bind(this); |
1264 }; | 1266 }; |
1265 | 1267 |
1266 /** | 1268 /** |
1267 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD | 1269 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD |
1268 * horizontally it's considered as a swipe gesture (change the current image). | 1270 * horizontally it's considered as a swipe gesture (change the current image). |
1269 */ | 1271 */ |
1270 SwipeOverlay.SWIPE_THRESHOLD = 100; | 1272 SwipeOverlay.SWIPE_THRESHOLD = 100; |
OLD | NEW |