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 24 matching lines...) Expand all Loading... |
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 initializatino 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 // TODO(mtomasz): Get rid of mountPath when possible. | 45 if (event.eventType == 'mount' && event.status == 'success') { |
46 if (event.eventType == 'mount' && event.volumeMetadata.mountPath) { | |
47 chrome.fileBrowserPrivate.requestFileSystem( | 46 chrome.fileBrowserPrivate.requestFileSystem( |
48 event.volumeMetadata.volumeId, function() {}); | 47 event.volumeMetadata.volumeId, function() {}); |
49 } | 48 } |
50 }); | 49 }); |
51 }.bind(this)); | 50 }.bind(this)); |
52 | 51 |
53 // Listen for incoming requests. | 52 // Listen for incoming requests. |
54 chrome.extension.onMessageExternal.addListener(function(request, | 53 chrome.extension.onMessageExternal.addListener(function(request, |
55 sender, | 54 sender, |
56 sendResponse) { | 55 sendResponse) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 targetContext.translate(target.width / 2, target.height / 2); | 225 targetContext.translate(target.width / 2, target.height / 2); |
227 targetContext.rotate(orientation * Math.PI / 2); | 226 targetContext.rotate(orientation * Math.PI / 2); |
228 targetContext.drawImage( | 227 targetContext.drawImage( |
229 source, | 228 source, |
230 0, 0, | 229 0, 0, |
231 source.width, source.height, | 230 source.width, source.height, |
232 -drawImageWidth / 2, -drawImageHeight / 2, | 231 -drawImageWidth / 2, -drawImageHeight / 2, |
233 drawImageWidth, drawImageHeight); | 232 drawImageWidth, drawImageHeight); |
234 targetContext.restore(); | 233 targetContext.restore(); |
235 }; | 234 }; |
OLD | NEW |