Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Custom bindings for the experimental.app API. | |
| 6 | |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | |
| 8 var experimentalAppNatives = requireNative('experimental_app'); | |
| 9 var GetIsolatedFileSystem = experimentalAppNatives.GetIsolatedFileSystem; | |
| 10 | |
| 11 chromeHidden.registerCustomHook('experimental.app', function(bindingsAPI) { | |
| 12 chrome.experimental.app.onLaunched.dispatch = | |
| 13 function(launchData, file_system_id, base_name) { | |
|
Mihai Parparita -not on Chrome
2012/05/18 04:26:04
Nit: JS naming style is to use camelCase for varia
benwells
2012/05/22 13:15:03
Done.
| |
| 14 if (launchData) { | |
| 15 event = this; | |
| 16 fs = GetIsolatedFileSystem(file_system_id); | |
| 17 try { | |
| 18 fs.root.getFile(base_name, {}, function(fileEntry) { | |
| 19 launchData.intent.data = fileEntry; | |
| 20 launchData.intent.postResult = function() {}; | |
| 21 chrome.Event.prototype.dispatch.apply(event, [launchData]); | |
|
Mihai Parparita -not on Chrome
2012/05/18 04:26:04
Nit: if you use .call(), you can pass the argument
benwells
2012/05/22 13:15:03
Done.
| |
| 22 }, function(fileError) { | |
| 23 console.error('Error getting fileEntry, code: ' + fileError.code); | |
| 24 chrome.Event.prototype.dispatch.apply(event, []); | |
| 25 }); | |
| 26 } catch (e) { | |
| 27 console.error('Error in event handler for onLaunched: ' + e.stack); | |
| 28 chrome.Event.prototype.dispatch.apply(event, []); | |
| 29 } | |
| 30 } else { | |
| 31 chrome.Event.prototype.dispatch.apply(this, []); | |
| 32 } | |
| 33 }; | |
| 34 }); | |
| OLD | NEW |