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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Loads and resizes an image. | 8 * Loads and resizes an image. |
9 * @constructor | 9 * @constructor |
10 */ | 10 */ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 }.bind(this)); | 69 }.bind(this)); |
70 } | 70 } |
71 | 71 |
72 /** | 72 /** |
73 * List of extensions allowed to perform image requests. | 73 * List of extensions allowed to perform image requests. |
74 * | 74 * |
75 * @const | 75 * @const |
76 * @type {Array.<string>} | 76 * @type {Array.<string>} |
77 */ | 77 */ |
78 ImageLoader.ALLOWED_CLIENTS = | 78 ImageLoader.ALLOWED_CLIENTS = [ |
79 ['hhaomjibdihmijegdhdafkllkbggdgoj']; // File Manager's extension id. | 79 'hhaomjibdihmijegdhdafkllkbggdgoj', // File Manager's extension id. |
| 80 'nlkncpkkdoccmpiclbokaimcnedabhhm' // Gallery extension id. |
| 81 ]; |
80 | 82 |
81 /** | 83 /** |
82 * Handles a request. Depending on type of the request, starts or stops | 84 * Handles a request. Depending on type of the request, starts or stops |
83 * an image task. | 85 * an image task. |
84 * | 86 * |
85 * @param {string} senderId Sender's extension id. | 87 * @param {string} senderId Sender's extension id. |
86 * @param {Object} request Request message as a hash array. | 88 * @param {Object} request Request message as a hash array. |
87 * @param {function} callback Callback to be called to return response. | 89 * @param {function} callback Callback to be called to return response. |
88 * @return {boolean} True if the message channel should stay alive until the | 90 * @return {boolean} True if the message channel should stay alive until the |
89 * callback is called. | 91 * callback is called. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 targetContext.translate(target.width / 2, target.height / 2); | 227 targetContext.translate(target.width / 2, target.height / 2); |
226 targetContext.rotate(orientation * Math.PI / 2); | 228 targetContext.rotate(orientation * Math.PI / 2); |
227 targetContext.drawImage( | 229 targetContext.drawImage( |
228 source, | 230 source, |
229 0, 0, | 231 0, 0, |
230 source.width, source.height, | 232 source.width, source.height, |
231 -drawImageWidth / 2, -drawImageHeight / 2, | 233 -drawImageWidth / 2, -drawImageHeight / 2, |
232 drawImageWidth, drawImageHeight); | 234 drawImageWidth, drawImageHeight); |
233 targetContext.restore(); | 235 targetContext.restore(); |
234 }; | 236 }; |
OLD | NEW |