Re: Supporting extra parameters on the Intent object

I think filename is a great example for saving a file. I can imagine this
being a huge requirement for services such as drop box and box.net

I think consistency is good, so extras in and out would be useful and easy
to develop and it is easy to parse if it is just any valid JavaScript
object

As for mime type parameters I think it is fine I believe developers would
prefer extras though (even if mime type is cleaner).

P
On Jan 30, 2012 3:53 PM, "Greg Billock" <gbillock@google.com> wrote:

> I like this metadata field on the return type. Did we think of
> examples for the passed intent data to have metadata as well? I know
> we discussed passing those in MIME parameters.
>
> On Sun, Jan 29, 2012 at 6:18 PM, James Hawkins <jhawkins@google.com>
> wrote:
> > Many use cases require passing optional, extra parameters from the
> > client to the service and vice versa.
> >
> > Consider an example client invoking the Pick intent: a web mail client
> > using Pick for attachments.  The current implementation allows the
> > user browse the file system and pick a file to attach: this file has a
> > filename, and that filename is displayed in the UI.  Using the Pick
> > intent, the mail client can receive, say, an image to attach, but
> > currently there is no way to correlate a filename with the picked
> > image.
> >
> > I propose following the precedence set by Android Intents [1] to solve
> > this problem: add an optional |extras| dictionary to the Intent
> > object.  Documentation for intent actions could specify handling of
> > optional extra parameters, e.g., filename for Pick.
> >
> > [Constructor(in string action, in string type, in any data)]
> > interface Intent {
> >     readonly attribute DOMString action;
> >     readonly attribute DOMString type;
> >     readonly attribute any data;
> >     readonly attribute Dictionary extras;  <--- Added
> >     void postResult (any data, optional Dictionary extras);      <---
> > |extras| added
> >     void postFailure (any data);
> > };
> >
> > Client:
> >
> > document.getElementById('attach').onclick = function() {
> >   var intent = new Intent("http://webintents.org/pick", "*");
> >  navigator.startActivity(intent, filePicked);
> > });
> >
> > Service:
> >
> > if (window.intent) {
> >  ....
> >  window.intent.postResult(selectedFile, {filename: selectedFilename});
> > }
> >
> >
> > What do you think?
> >
> > [1] http://developer.android.com/reference/android/content/Intent.html,
> > search for 'extras'.
> >
> > Thanks,
> > James
> >
>
>

Received on Monday, 30 January 2012 16:01:07 UTC