← Back to team overview

ubuntu-phone team mailing list archive

Re: Applications spawning other Applications

 

On Thu, Jul 18, 2013 at 9:37 PM, Thomas Voß <thomas.voss@xxxxxxxxxxxxx> wrote:
> On Thu, Jul 18, 2013 at 8:28 PM, Michał Sawicz
>> What if you don't know/care what kind of app should handle, say, a
>> downloaded PDF file?
>>
>
> Good point and I do agree in general, However, once we allow mime-type
> handling we break the strict per-app siloing of content.
>
> Not sure how to solve that issue for mime-type handling.
>
> Thomas

Just some thoughts of how it could be.

An application that wants to spawn another app have to provide
"spawning mechanism"
with three parameters: other app's name, MIME-type of a resource, URL
of the resource.
Any two of these parameters may be optional but at least one is mandatory.

Spawning mechanism might be: Qt.spawn(...)->Dbus->Upstart or whatever
is appropriate.

App's name - name of the application to spawn in a form used in the app's
manifest, like "com.ubuntu.developer.username.myapp". To make not confined apps
spawnable, Ubuntu will provide manifests for not confined apps too (if
it doesn't already).
MIME-type and URL - nothing unusual, obvious.

Hierarchy of decision making: name->MIME->URL. URL is considered only when
neither name nor MIME is provided.

Use cases:
${browser} could be any application registered as default handler for
"text/html"

- spawn a browser with html page as argument, based on MIME-type:
    name="", MIME="text/html", URL="http://host/page.html";

- spawn a browser with html page as argument, based on URL's "http:" :
    name="", MIME="", URL="http://host/page.html";

- spawn the browser with fallback to default browser if requested one
is not installed/registered:
    name="com.mozilla.firefox", MIME="text/html", URL="http://host/page.html";

- spawn the browser without fallback, if Firefox is not installed
nothing is spawned:
    name="com.mozilla.firefox", MIME="", URL="http://host/page.html";

- spawn the browser without an argument:
    name="com.mozilla.firefox", MIME="", URL=""

- spawn a browser without an argument:
    name="", MIME="text/html", URL=""

"name" could be not just one app but a list of apps, with
left-to-right priority:
    name(s)="com.mozilla.firefox,com.google.chrome"

Also, there is such a thing as Uniform Type Identifier.
http://en.wikipedia.org/wiki/Uniform_Type_Identifier

You might consider adopting it, in part or as a whole, and use it
instead of MIME-type.
Or even instead of name+MIME:
- spawn a browser with fallback, no need for MIME as parameter anymore:
    names="com.mozilla.firefox,com.google.chrome,public.html"
URL="http://host/page.html";


Follow ups

References