| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Custom bindings for the chrome.app.runtime API. | 5 // Custom bindings for the chrome.app.runtime API. |
| 6 | 6 |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| 8 var fileSystemHelpers = requireNative('file_system_natives'); | 8 var fileSystemHelpers = requireNative('file_system_natives'); |
| 9 var GetIsolatedFileSystem = fileSystemHelpers.GetIsolatedFileSystem; | 9 var GetIsolatedFileSystem = fileSystemHelpers.GetIsolatedFileSystem; |
| 10 var appNatives = requireNative('app_runtime'); | 10 var appNatives = requireNative('app_runtime'); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 dispatch([launchData]); | 28 dispatch([launchData]); |
| 29 }, function(fileError) { | 29 }, function(fileError) { |
| 30 console.error('Error getting fileEntry, code: ' + fileError.code); | 30 console.error('Error getting fileEntry, code: ' + fileError.code); |
| 31 dispatch([]); | 31 dispatch([]); |
| 32 }); | 32 }); |
| 33 } catch (e) { | 33 } catch (e) { |
| 34 console.error('Error in event handler for onLaunched: ' + e.stack); | 34 console.error('Error in event handler for onLaunched: ' + e.stack); |
| 35 dispatch([]); | 35 dispatch([]); |
| 36 } | 36 } |
| 37 break; | 37 break; |
| 38 case('filesystem'): |
| 39 launchData.intent.data = GetIsolatedFileSystem(intentData.fileSystemId, |
| 40 intentData.baseName); |
| 41 launchData.intent.postResult = function() {}; |
| 42 launchData.intent.postFailure = function() {}; |
| 43 dispatch([launchData]); |
| 44 break; |
| 38 case('serialized'): | 45 case('serialized'): |
| 39 var deserializedData = DeserializeString(intentData.data); | 46 var deserializedData = DeserializeString(intentData.data); |
| 40 launchData.intent.data = deserializedData; | 47 launchData.intent.data = deserializedData; |
| 41 launchData.intent.postResult = function() {}; | 48 launchData.intent.postResult = function() {}; |
| 42 launchData.intent.postFailure = function() {}; | 49 launchData.intent.postFailure = function() {}; |
| 43 dispatch([launchData]); | 50 dispatch([launchData]); |
| 44 break; | 51 break; |
| 45 case('blob'): | 52 case('blob'): |
| 46 var blobData = CreateBlob(intentData.blobFilePath, | 53 var blobData = CreateBlob(intentData.blobFilePath, |
| 47 intentData.blobLength); | 54 intentData.blobLength); |
| 48 launchData.intent.data = blobData; | 55 launchData.intent.data = blobData; |
| 49 launchData.intent.postResult = function() {}; | 56 launchData.intent.postResult = function() {}; |
| 50 launchData.intent.postFailure = function() {}; | 57 launchData.intent.postFailure = function() {}; |
| 51 dispatch([launchData]); | 58 dispatch([launchData]); |
| 52 break; | 59 break; |
| 53 default: | 60 default: |
| 54 console.error('Unexpected launch data format'); | 61 console.error('Unexpected launch data format'); |
| 55 dispatch([]); | 62 dispatch([]); |
| 56 } | 63 } |
| 57 } else if (launchData) { | 64 } else if (launchData) { |
| 58 dispatch([launchData]); | 65 dispatch([launchData]); |
| 59 } else { | 66 } else { |
| 60 dispatch([]); | 67 dispatch([]); |
| 61 } | 68 } |
| 62 }); | 69 }); |
| OLD | NEW |