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

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

Issue 12212127: [cleanup] Files.app: Remove Function declarations within blocks #3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
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 * The overlay displaying the image. 6 * The overlay displaying the image.
7 * @param {HTMLElement} container The container element. 7 * @param {HTMLElement} container The container element.
8 * @param {Viewport} viewport The viewport. 8 * @param {Viewport} viewport The viewport.
9 * @param {MetadataCache} metadataCache The metadataCache. 9 * @param {MetadataCache} metadataCache The metadataCache.
10 */ 10 */
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 var loadingVideo = FileType.getMediaType(url) == 'video'; 321 var loadingVideo = FileType.getMediaType(url) == 'video';
322 if (loadingVideo) { 322 if (loadingVideo) {
323 var video = this.document_.createElement('video'); 323 var video = this.document_.createElement('video');
324 var videoPreview = !!(metadata.thumbnail && metadata.thumbnail.url); 324 var videoPreview = !!(metadata.thumbnail && metadata.thumbnail.url);
325 if (videoPreview) { 325 if (videoPreview) {
326 video.setAttribute('poster', metadata.thumbnail.url); 326 video.setAttribute('poster', metadata.thumbnail.url);
327 this.replace(video, effect); // Show the poster immediately. 327 this.replace(video, effect); // Show the poster immediately.
328 if (displayCallback) displayCallback(); 328 if (displayCallback) displayCallback();
329 } 329 }
330 330
331 function onVideoLoad(error) { 331 var onVideoLoad = function(error) {
332 video.removeEventListener('loadedmetadata', onVideoLoadSuccess); 332 video.removeEventListener('loadedmetadata', onVideoLoadSuccess);
333 video.removeEventListener('error', onVideoLoadError); 333 video.removeEventListener('error', onVideoLoadError);
334 displayMainImage(ImageView.LOAD_TYPE_VIDEO_FILE, videoPreview, video, 334 displayMainImage(ImageView.LOAD_TYPE_VIDEO_FILE, videoPreview, video,
335 error); 335 error);
336 } 336 };
337 var onVideoLoadError = onVideoLoad.bind(this, 'VIDEO_ERROR'); 337 var onVideoLoadError = onVideoLoad.bind(this, 'VIDEO_ERROR');
338 var onVideoLoadSuccess = onVideoLoad.bind(this, null); 338 var onVideoLoadSuccess = onVideoLoad.bind(this, null);
339 339
340 video.addEventListener('loadedmetadata', onVideoLoadSuccess); 340 video.addEventListener('loadedmetadata', onVideoLoadSuccess);
341 video.addEventListener('error', onVideoLoadError); 341 video.addEventListener('error', onVideoLoadError);
342 342
343 // Do not try no stream when offline. 343 // Do not try no stream when offline.
344 video.src = (navigator.onLine && metadata.streaming && 344 video.src = (navigator.onLine && metadata.streaming &&
345 metadata.streaming.url) || url; 345 metadata.streaming.url) || url;
346 video.load(); 346 video.load();
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1043
1044 /** 1044 /**
1045 * @param {HTMLCanvasElement|HTMLVideoElement} element Element. 1045 * @param {HTMLCanvasElement|HTMLVideoElement} element Element.
1046 * @return {string} Transform string. 1046 * @return {string} Transform string.
1047 */ 1047 */
1048 ImageView.Effect.Rotate.prototype.transform = function(element) { 1048 ImageView.Effect.Rotate.prototype.transform = function(element) {
1049 var ratio = ImageView.Effect.getPixelRatio_(element); 1049 var ratio = ImageView.Effect.getPixelRatio_(element);
1050 return 'rotate(' + (this.rotate90_ * 90) + 'deg) ' + 1050 return 'rotate(' + (this.rotate90_ * 90) + 'deg) ' +
1051 'scale(' + (this.scale_ / ratio) + ')'; 1051 'scale(' + (this.scale_ / ratio) + ')';
1052 }; 1052 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698