Chromium Code Reviews| 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 * Object representing an image item (a photo). | 6 * Object representing an image item (a photo). |
| 7 * | 7 * |
| 8 * @param {!FileEntry} entry Image entry. | 8 * @param {!FileEntry} entry Image entry. |
| 9 * @param {!EntryLocation} locationInfo Entry location information. | 9 * @param {!EntryLocation} locationInfo Entry location information. |
| 10 * @param {MetadataItem} metadataItem | 10 * @param {MetadataItem} metadataItem |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 return Promise.reject(str('GALLERY_FILE_EXISTS')); | 433 return Promise.reject(str('GALLERY_FILE_EXISTS')); |
| 434 }, function() { | 434 }, function() { |
| 435 return new Promise( | 435 return new Promise( |
| 436 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); | 436 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); |
| 437 }.bind(this)); | 437 }.bind(this)); |
| 438 }.bind(this)); | 438 }.bind(this)); |
| 439 }.bind(this)).then(function(entry) { | 439 }.bind(this)).then(function(entry) { |
| 440 this.entry_ = entry; | 440 this.entry_ = entry; |
| 441 }.bind(this)); | 441 }.bind(this)); |
| 442 }; | 442 }; |
| 443 | |
| 444 /** | |
| 445 * The threshold size of an image in pixels, which we always use thumbnail | |
| 446 * image for slide-in animation above this. This is a hack to avoid an UI | |
| 447 * unresponsiveness when switching between images. | |
| 448 * @type {number} | |
| 449 * @const | |
| 450 * @private | |
|
yamaguchi
2017/01/13 12:25:39
Changed to private & const
oka
2017/01/16 02:23:39
Nit: add a trailing _ if it's private?
yamaguchi
2017/01/16 11:36:20
Now I found we don't use @private for this kind of
| |
| 451 */ | |
| 452 GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS = 4000 * 3000; | |
| 453 | |
| 454 /** | |
| 455 * Whether the image requires long rendering time. | |
| 456 * | |
| 457 * @return {boolean} | |
| 458 */ | |
| 459 GalleryItem.prototype.requireLongRenderingTime = function() { | |
| 460 // Check for undefined values. | |
| 461 if (!this.metadataItem_ || | |
| 462 !this.metadataItem_.imageHeight || !this.metadataItem_.imageWidth) | |
| 463 return false; | |
| 464 var numPixels = this.metadataItem_.imageHeight * | |
| 465 this.metadataItem_.imageWidth; | |
| 466 return numPixels > GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS; | |
| 467 }; | |
| OLD | NEW |