| 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 bindings = new (require('schema_binding_generator').Bindings)( |
| 8 'app.runtime'); |
| 9 |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 10 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| 11 var chrome = requireNative('chrome').GetChrome(); |
| 8 var fileSystemHelpers = requireNative('file_system_natives'); | 12 var fileSystemHelpers = requireNative('file_system_natives'); |
| 9 var GetIsolatedFileSystem = fileSystemHelpers.GetIsolatedFileSystem; | 13 var GetIsolatedFileSystem = fileSystemHelpers.GetIsolatedFileSystem; |
| 10 var appNatives = requireNative('app_runtime'); | 14 var appNatives = requireNative('app_runtime'); |
| 11 var DeserializeString = appNatives.DeserializeString; | 15 var DeserializeString = appNatives.DeserializeString; |
| 12 var SerializeToString = appNatives.SerializeToString; | 16 var SerializeToString = appNatives.SerializeToString; |
| 13 var CreateBlob = appNatives.CreateBlob; | 17 var CreateBlob = appNatives.CreateBlob; |
| 14 | 18 |
| 19 chrome.Event; |
| 15 chromeHidden.Event.registerArgumentMassager('app.runtime.onLaunched', | 20 chromeHidden.Event.registerArgumentMassager('app.runtime.onLaunched', |
| 16 function(args, dispatch) { | 21 function(args, dispatch) { |
| 17 var launchData = args[0]; | 22 var launchData = args[0]; |
| 18 var intentData = args[1]; | 23 var intentData = args[1]; |
| 19 var intentId = args[2]; | 24 var intentId = args[2]; |
| 20 | 25 |
| 21 if (launchData && typeof launchData.id !== 'undefined') { | 26 if (launchData && typeof launchData.id !== 'undefined') { |
| 22 // new-style dispatch. | 27 // new-style dispatch. |
| 23 var items = [] | 28 var items = [] |
| 24 var numItems = launchData.items.length; | 29 var numItems = launchData.items.length; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 console.error('Unexpected launch data format'); | 115 console.error('Unexpected launch data format'); |
| 111 dispatch([]); | 116 dispatch([]); |
| 112 } | 117 } |
| 113 } else if (launchData) { | 118 } else if (launchData) { |
| 114 dispatch([launchData]); | 119 dispatch([launchData]); |
| 115 } else { | 120 } else { |
| 116 dispatch([]); | 121 dispatch([]); |
| 117 } | 122 } |
| 118 } | 123 } |
| 119 }); | 124 }); |
| 125 |
| 126 exports.bindings = bindings.generate(); |
| OLD | NEW |