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

Side by Side Diff: chrome/browser/resources/file_manager/js/image_editor/image_encoder.js

Issue 8394046: [filebrowser] More reliable file saving in Photo Editor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 * A namespace class for image encoding functions. All methods are static. 6 * A namespace class for image encoding functions. All methods are static.
7 */ 7 */
8 function ImageEncoder() {} 8 function ImageEncoder() {}
9 9
10 ImageEncoder.MAX_THUMBNAIL_DIMENSION = 320; 10 ImageEncoder.MAX_THUMBNAIL_DIMENSION = 320;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 /** 150 /**
151 * A base class for a metadata encoder. 151 * A base class for a metadata encoder.
152 * 152 *
153 * Serves as a default metadata encoder for images that none of the metadata 153 * Serves as a default metadata encoder for images that none of the metadata
154 * parsers recognized. 154 * parsers recognized.
155 * 155 *
156 * @param {Object} original_metadata 156 * @param {Object} original_metadata
157 */ 157 */
158 ImageEncoder.MetadataEncoder = function(original_metadata) { 158 ImageEncoder.MetadataEncoder = function(original_metadata) {
159 this.metadata_ = ImageUtil.deepCopy(original_metadata) || {}; 159 this.metadata_ = ImageUtil.deepCopy(original_metadata) || {};
160 if (!this.metadata_.mimeType) { 160 if (this.metadata_.mimeType != 'image/jpeg') {
161 // For the purposes saving to a file and thumbnail generation we assume 161 // Chrome can only encode JPEG and PNG. Force PNG mime type so that we
162 // it is a png. 162 // can save to file and generate a thumbnail.
163 this.metadata_.mimeType = 'image/png'; 163 this.metadata_.mimeType = 'image/png';
164 } 164 }
165 }; 165 };
166 166
167 ImageEncoder.MetadataEncoder.prototype.getMetadata = function() { 167 ImageEncoder.MetadataEncoder.prototype.getMetadata = function() {
168 return this.metadata_; 168 return this.metadata_;
169 }; 169 };
170 170
171 /** 171 /**
172 * @param {HTMLCanvasElement|Object} canvas Canvas or or anything with 172 * @param {HTMLCanvasElement|Object} canvas Canvas or or anything with
(...skipping 23 matching lines...) Expand all
196 findInsertionRange = function(encodedImage) { return {from: 0, to: 0} }; 196 findInsertionRange = function(encodedImage) { return {from: 0, to: 0} };
197 197
198 /** 198 /**
199 * Return serialized metadata ready to write to an image file. 199 * Return serialized metadata ready to write to an image file.
200 * The return type is optimized for passing to Blob.append. 200 * The return type is optimized for passing to Blob.append.
201 * @return {ArrayBuffer} 201 * @return {ArrayBuffer}
202 */ 202 */
203 ImageEncoder.MetadataEncoder.prototype.encode = function() { 203 ImageEncoder.MetadataEncoder.prototype.encode = function() {
204 return new Uint8Array(0).buffer; 204 return new Uint8Array(0).buffer;
205 }; 205 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/id3_parser.js ('k') | chrome/browser/resources/file_manager/js/image_parsers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698