| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * Loads and resizes an image. | 6 * Loads and resizes an image. |
| 7 * @constructor | 7 * @constructor |
| 8 */ | 8 */ |
| 9 function ImageLoader() { | 9 function ImageLoader() { |
| 10 /** | 10 /** |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 try { | 64 try { |
| 65 sendResponse(response); | 65 sendResponse(response); |
| 66 } | 66 } |
| 67 catch (e) { | 67 catch (e) { |
| 68 // Ignore the error. | 68 // Ignore the error. |
| 69 } | 69 } |
| 70 }; | 70 }; |
| 71 if (typeof request.orientation === 'number') { | 71 if (typeof request.orientation === 'number') { |
| 72 request.orientation = | 72 request.orientation = |
| 73 ImageOrientation.fromDriveOrientation(request.orientation); | 73 ImageOrientation.fromDriveOrientation(request.orientation); |
| 74 } else if (request.orientation) { |
| 75 request.orientation = |
| 76 ImageOrientation.fromRotationAndScale(request.orientation); |
| 74 } else { | 77 } else { |
| 75 request.orientation = new ImageOrientation(1, 0, 0, 1); | 78 request.orientation = new ImageOrientation(1, 0, 0, 1); |
| 76 } | 79 } |
| 77 return this.onMessage_(sender.id, | 80 return this.onMessage_(sender.id, |
| 78 /** @type {LoadImageRequest} */ (request), | 81 /** @type {LoadImageRequest} */ (request), |
| 79 failSafeSendResponse); | 82 failSafeSendResponse); |
| 80 } | 83 } |
| 81 }.bind(this)); | 84 }.bind(this)); |
| 82 } | 85 } |
| 83 | 86 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 }; | 123 }; |
| 121 | 124 |
| 122 /** | 125 /** |
| 123 * Returns the singleton instance. | 126 * Returns the singleton instance. |
| 124 * @return {ImageLoader} ImageLoader object. | 127 * @return {ImageLoader} ImageLoader object. |
| 125 */ | 128 */ |
| 126 ImageLoader.getInstance = function() { | 129 ImageLoader.getInstance = function() { |
| 127 if (!ImageLoader.instance_) | 130 if (!ImageLoader.instance_) |
| 128 ImageLoader.instance_ = new ImageLoader(); | 131 ImageLoader.instance_ = new ImageLoader(); |
| 129 return ImageLoader.instance_; | 132 return ImageLoader.instance_; |
| 130 }; | 133 }; |
| OLD | NEW |