Actually, I was thinking about replacing manifestUrl, appId, origin and installOrigin by metadata. It is worse to duplicate attribute like this.
So that downloadApp signature becomes: `downloadApp(manifest,  metadata, appPath, callback, errCallback)`
You would just have to move
```
let metadata = {
      'id': appId,
      'installOrigin': installOrigin,
      'manifestURL': manifestUrl,
};
```
to `processApp` and call downloadApp like this: `downloadApp(json, appPath, metadata, copyAppPathToProfile, handleError);`
Then you can either keep origin definition in prepareHostedApp/downloadPackagedApp or move it to processApp, with something like this:
```
if (!metadata.origin) {
  if (manifest['package_path']) {
    metadata.origin = getOrigin(manifest['package_path']);
  } else if (manifest['launch_path']) {
    metadata.origin = getOrigin(manifest['launch_path']);
  } else {
    throw new Error("...");
  }
}
```