| 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 18 matching lines...) Expand all Loading... |
| 29 var initPromises = volumeMetadataList.map(function(volumeMetadata) { | 29 var initPromises = volumeMetadataList.map(function(volumeMetadata) { |
| 30 var requestPromise = new Promise(function(callback) { | 30 var requestPromise = new Promise(function(callback) { |
| 31 chrome.fileBrowserPrivate.requestFileSystem( | 31 chrome.fileBrowserPrivate.requestFileSystem( |
| 32 volumeMetadata.volumeId, | 32 volumeMetadata.volumeId, |
| 33 callback); | 33 callback); |
| 34 }); | 34 }); |
| 35 return requestPromise; | 35 return requestPromise; |
| 36 }); | 36 }); |
| 37 initPromises.push(new Promise(this.cache_.initialize.bind(this.cache_))); | 37 initPromises.push(new Promise(this.cache_.initialize.bind(this.cache_))); |
| 38 | 38 |
| 39 // After all initializatino promises are done, start the worker. | 39 // After all initialization promises are done, start the worker. |
| 40 Promise.all(initPromises).then(this.worker_.start.bind(this.worker_)); | 40 Promise.all(initPromises).then(this.worker_.start.bind(this.worker_)); |
| 41 | 41 |
| 42 // Listen for mount events, and grant permissions to volumes being mounted. | 42 // Listen for mount events, and grant permissions to volumes being mounted. |
| 43 chrome.fileBrowserPrivate.onMountCompleted.addListener( | 43 chrome.fileBrowserPrivate.onMountCompleted.addListener( |
| 44 function(event) { | 44 function(event) { |
| 45 if (event.eventType == 'mount' && event.status == 'success') { | 45 if (event.eventType == 'mount' && event.status == 'success') { |
| 46 chrome.fileBrowserPrivate.requestFileSystem( | 46 chrome.fileBrowserPrivate.requestFileSystem( |
| 47 event.volumeMetadata.volumeId, function() {}); | 47 event.volumeMetadata.volumeId, function() {}); |
| 48 } | 48 } |
| 49 }); | 49 }); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 targetContext.translate(target.width / 2, target.height / 2); | 225 targetContext.translate(target.width / 2, target.height / 2); |
| 226 targetContext.rotate(orientation * Math.PI / 2); | 226 targetContext.rotate(orientation * Math.PI / 2); |
| 227 targetContext.drawImage( | 227 targetContext.drawImage( |
| 228 source, | 228 source, |
| 229 0, 0, | 229 0, 0, |
| 230 source.width, source.height, | 230 source.width, source.height, |
| 231 -drawImageWidth / 2, -drawImageHeight / 2, | 231 -drawImageWidth / 2, -drawImageHeight / 2, |
| 232 drawImageWidth, drawImageHeight); | 232 drawImageWidth, drawImageHeight); |
| 233 targetContext.restore(); | 233 targetContext.restore(); |
| 234 }; | 234 }; |
| OLD | NEW |