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

Side by Side Diff: ui/file_manager/gallery/js/slide_mode.js

Issue 1608143002: support animated GIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 var toMillions = function(number) { 1034 var toMillions = function(number) {
1035 return Math.round(number / (1000 * 1000)); 1035 return Math.round(number / (1000 * 1000));
1036 }; 1036 };
1037 1037
1038 var metadata = item.getMetadataItem(); 1038 var metadata = item.getMetadataItem();
1039 if (metadata) { 1039 if (metadata) {
1040 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MB'), 1040 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MB'),
1041 toMillions(metadata.size)); 1041 toMillions(metadata.size));
1042 } 1042 }
1043 1043
1044 var canvas = this.imageView_.getCanvas(); 1044 var image = this.imageView_.getImage();
1045 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MPix'), 1045 ImageUtil.metrics.recordSmallCount(ImageUtil.getMetricName('Size.MPix'),
1046 toMillions(canvas.width * canvas.height)); 1046 toMillions(image.width * image.height));
1047 1047
1048 var extIndex = entry.name.lastIndexOf('.'); 1048 var extIndex = entry.name.lastIndexOf('.');
1049 var ext = extIndex < 0 ? '' : 1049 var ext = extIndex < 0 ? '' :
1050 entry.name.substr(extIndex + 1).toLowerCase(); 1050 entry.name.substr(extIndex + 1).toLowerCase();
1051 if (ext === 'jpeg') ext = 'jpg'; 1051 if (ext === 'jpeg') ext = 'jpg';
1052 ImageUtil.metrics.recordEnum( 1052 ImageUtil.metrics.recordEnum(
1053 ImageUtil.getMetricName('FileType'), ext, ImageUtil.FILE_TYPES); 1053 ImageUtil.getMetricName('FileType'), ext, ImageUtil.FILE_TYPES);
1054 1054
1055 // Enable or disable buttons for editing and printing. 1055 // Enable or disable buttons for editing and printing.
1056 if (opt_error) { 1056 if (opt_error) {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 * @param {!GalleryItem} item Item to save the image. 1292 * @param {!GalleryItem} item Item to save the image.
1293 * @param {function()} callback Callback. 1293 * @param {function()} callback Callback.
1294 * @private 1294 * @private
1295 */ 1295 */
1296 SlideMode.prototype.saveCurrentImage_ = function(item, callback) { 1296 SlideMode.prototype.saveCurrentImage_ = function(item, callback) {
1297 this.showSpinner_(true); 1297 this.showSpinner_(true);
1298 1298
1299 var savedPromise = this.dataModel_.saveItem( 1299 var savedPromise = this.dataModel_.saveItem(
1300 this.volumeManager_, 1300 this.volumeManager_,
1301 item, 1301 item,
1302 this.imageView_.getCanvas(), 1302 this.imageView_.getImage(),
yawano 2016/01/20 06:23:09 Please add assertInstanceOf(, CanvasElement). Gall
ryoh 2016/01/21 03:19:55 Done.
1303 this.overwriteOriginalCheckbox_.checked); 1303 this.overwriteOriginalCheckbox_.checked);
1304 1304
1305 savedPromise.then(function() { 1305 savedPromise.then(function() {
1306 this.showSpinner_(false); 1306 this.showSpinner_(false);
1307 this.flashSavedLabel_(); 1307 this.flashSavedLabel_();
1308 1308
1309 // Record UMA for the first edit. 1309 // Record UMA for the first edit.
1310 if (this.imageView_.getContentRevision() === 1) 1310 if (this.imageView_.getContentRevision() === 1)
1311 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('Edit')); 1311 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('Edit'));
1312 1312
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 var event = assertInstanceof(event, MouseEvent); 2050 var event = assertInstanceof(event, MouseEvent);
2051 var viewport = this.slideMode_.getViewport(); 2051 var viewport = this.slideMode_.getViewport();
2052 if (!this.enabled_ || !viewport.isZoomed()) 2052 if (!this.enabled_ || !viewport.isZoomed())
2053 return; 2053 return;
2054 this.stopOperation(); 2054 this.stopOperation();
2055 viewport.setOffset( 2055 viewport.setOffset(
2056 viewport.getOffsetX() + event.wheelDeltaX, 2056 viewport.getOffsetX() + event.wheelDeltaX,
2057 viewport.getOffsetY() + event.wheelDeltaY); 2057 viewport.getOffsetY() + event.wheelDeltaY);
2058 this.slideMode_.applyViewportChange(); 2058 this.slideMode_.applyViewportChange();
2059 }; 2059 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698