- From: Mercurial notifier <cvsmail@w3.org>
- Date: Tue, 10 Jul 2012 15:21:22 +0000
- To: public-dap-commits@w3.org
changeset: 137:56b3039c5f88 tag: tip parent: 136:e42a8962482f parent: 132:8ce8b66e3d29 user: Robin Berjon <robin@berjon.com> date: Tue Jul 10 11:21:03 2012 -0400 files: gallery/index.html wi-addendum-local-services/Overview.html description: used some deep magic that I don't understand diff -r e42a8962482f -r 56b3039c5f88 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Jul 10 11:21:03 2012 -0400 @@ -0,0 +1,4 @@ +# use glob syntax. +syntax: glob + +.DS_Store diff -r e42a8962482f -r 56b3039c5f88 battery/Overview.html --- a/battery/Overview.html Mon Jul 09 09:59:54 2012 +0200 +++ b/battery/Overview.html Tue Jul 10 11:21:03 2012 -0400 @@ -6,11 +6,11 @@ <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script> <script class="remove"> var respecConfig = { - specStatus: "CR", + specStatus: "ED", shortName: "battery-status", - publishDate: "2012-05-08", - previousPublishDate: "2011-11-29", - previousMaturity: "LC", + //publishDate: "2012-05-08", + previousPublishDate: "2012-05-08", + previousMaturity: "CR", edDraftURI: "http://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html", // lcEnd: "2011-12-20", crEnd: "2012-07-01", @@ -189,9 +189,9 @@ <section> <h2>Terminology</h2> <p> - The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#function"> - Function</a></code> interface represents a function in the scripting - language being used as defined in [[!HTML5]]. + The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler"> + EventHandler</a></code> interface represents a callback used for event + handlers as defined in [[!HTML5]]. </p> <p> The concepts <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task"> @@ -255,22 +255,22 @@ Represents the current battery level scaled from 0 to 1.0. </dd> <dt class="no-docs"> - [TreatNonCallableAsNull] attribute Function? onchargingchange + attribute EventHandler onchargingchange </dt> <dd> </dd> <dt class="no-docs"> - [TreatNonCallableAsNull] attribute Function? onchargingtimechange + attribute EventHandler onchargingtimechange </dt> <dd> </dd> <dt class="no-docs"> - [TreatNonCallableAsNull] attribute Function? ondischargingtimechange + attribute EventHandler ondischargingtimechange </dt> <dd> </dd> <dt class="no-docs"> - [TreatNonCallableAsNull] attribute Function? onlevelchange + attribute EventHandler onlevelchange </dt> <dd> </dd> diff -r e42a8962482f -r 56b3039c5f88 contacts/Overview.html --- a/contacts/Overview.html Mon Jul 09 09:59:54 2012 +0200 +++ b/contacts/Overview.html Tue Jul 10 11:21:03 2012 -0400 @@ -1,213 +1,136 @@ <!DOCTYPE html> <html> <head> - <title>Contacts API</title> + <title>Pick Contacts Intent</title> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> - <script type="text/javascript" src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script> - <script type="text/javascript" src='http://dev.w3.org/2009/dap/ReSpec.js/js/sh_main.min.js' class='remove'></script> + <script type="text/javascript" src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove' async></script> <script type="text/javascript" class='remove'> - var respecConfig = { - specStatus: "ED", - shortName: "contacts-api", - editors: [{ - name: "Richard Tibbett", - url: "http://richt.me", - company: "Opera Software ASA", - companyURL: "http://www.opera.com"}], - previousPublishDate: "2011-06-16", - lcEnd: "2011-07-14", - previousMaturity: "LC", - edDraftURI: "http://w3c-test.org/2009/dap/contacts/", - noIDLIn: true, - }; + var respecConfig = { + specStatus: "ED", + shortName: "contacts-api", + editors: [{ + name: "Richard Tibbett", + url: "http://richt.me", + company: "Opera Software ASA", + companyURL: "http://www.opera.com"}, + {name: "Robin Berjon", + url: "http://berjon.com/", + company: "Robineko", + companyURL: "http://robineko.com/"} + ], + // previousPublishDate: "2011-06-16", + // lcEnd: "2011-07-14", + // previousMaturity: "LC", + edDraftURI: "http://w3c-test.org/2009/dap/contacts/", + wg: "Device APIs Working Group", + wgURI: "http://www.w3.org/2009/dap/", + wgPublicList: "public-device-apis", + wgPatentURI: "http://www.w3.org/2004/01/pp-impl/43696/status" + }; </script> - <script type="text/javascript" src='http://dev.w3.org/2009/dap/common/config.js' class='remove'></script> - <style type="text/css"> - /* ReSpec.js CSS optimizations (Richard Tibbett) */ - div.example { - border-top: 1px solid #ff4500; - border-bottom: 1px solid #ff4500; - background: #fff; - padding: 1em; - font-size: 0.9em; - margin-top: 1em; - } - div.example::before { - content: "Example"; - display: block; - width: 150px; - background: #ff4500; - color: #fff; - font-family: initial; - padding: 3px; - padding-left: 5px; - font-weight: bold; - margin: -1em 0 1em -1em; - } - - /* Clean up pre.idl */ - pre.idl::before { - font-size:0.9em; - } - - /* Add better spacing to sections */ - section, .section { - margin-bottom: 2em; - } - - /* Reduce note & issue render size */ - .note, .issue { - font-size:0.8em; - } - - /* Add addition spacing to <ol> and <ul> for rule definition */ - ol.rule li, ul.rule li { - padding:0.2em; - } - /* - IDL wrapping fix - http://perishablepress.com/press/2010/06/01/wrapping-content/ - - [RB] This isn't a fix, it kills indentation! - - pre.idl { - white-space: pre; - white-space: pre-wrap; - white-space: pre-line; - white-space: -pre-wrap; - white-space: -o-pre-wrap; - white-space: -moz-pre-wrap; - white-space: -hp-pre-wrap; - word-wrap: break-word; - } - */ - </style> </head> - <body> <section id='abstract'> <p> - The Contacts API defines the high-level interfaces required to obtain read access to a user's unified - address book. + The Pick Contacts Intent defines a Web Intent [[!WEBINTENTS]] that enables access to a user's + address book service from inside a Web application. It defines both an Intent action/type + pair that selects this operation, and the format of the contacts data that is returned + by services implementing this specification </p> - <p> - This API includes the following key interfaces: - </p> - <ul> - <li>A <a>Contacts</a> interface, which provides the method - needed to access a user's unified address book.</li> - <li>A <a>Contact</a> interface, which captures the individual - contact information that can be returned following a successful read operation.</li> - </ul> </section> <section id='sotd'> <p> - This document represents the early consensus of the group on the scope and features of the proposed - Contacts API. Issues and editors note in the document highlight some of the points on which the group is - still working and would particularly like to get feedback. + This document builds atop previous versions that were pure JavaScript APIs and turns them + into an API built using Web Intents, while maintaining the data format which the JavaScript + APIs had defined. </p> </section> <section class="informative"> <h2>Introduction</h2> <p> - Every operating system and a large number of web-based service providers have different ways of + Every operating system and a large number of Web-based service providers have different ways of representing address book information. Most users are required to maintain a plurality of contact lists - which leads to multiple copies of address book data. This in turn - often leads to disjoint and inconsistent information being stored across a user's - address book providers. + which leads to multiple copies of address book data. This in turn often leads to disjoint and inconsistent + information being stored across a user's address book providers. </p> <p> When sharing contact data with third parties users are, more often than not, required to hand over access to their whole address book. Users are implicitly required to trust third parties with all of their data when, in reality, the user may only wish, or need, to share a subset of their address book information so - that an application can fulfill its purpose. + that an application can fulfil its purpose. When sharing of only a subset of a user's address book is + possible, it often requires the user to type the information into a form herself rather than having it + extracted from one of her address book services. </p> <p> - This specification defines the concept of a user's unified address book - where address book data may - be sourced from a plurality of sources - both online and locally. It then defines the - interfaces through which third party applications can access a user's unified address book, with explicit user - permission and filtering. The focus of this data sharing is on making the user aware of the data that - they will share and putting them at the centre of the data sharing process; free to select both the - extent to which they share their address book information and the ability to restrict which pieces of - information related to which contact gets shared. + This specification enables a Web application to have access to a selected subset of a user's address book, + obtained from arbitrary services not known to the Web application. The interactions, brokered using + Web Intents [[!WEBINTENTS]] are designed in order to maximise the user's security and privacy. + Address book data may be sourced from a plurality of sources — both online and local to the user's device + — so long as those sources are registered as Intent services with the user agent. It defines a common + format which services use to provide data to Web applications in a consistent and interoperable manner. + </p> + <p> + The expectation is that data sharing happens with explicit user permission and filtering. The focus of + this data sharing is on making the user aware of the data that they will share and putting them at the + centre of the data sharing process; free to select both the extent to which they share their address + book information and the ability to restrict which pieces of information related to which contact gets shared. </p> <p> A set of <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> are - presented for the discretion of both implementers of the Contacts API and recipients of contact - information (i.e. web pages). This specification provides a set of non-normative + presented for the discretion of both implementers of Pick Contacts Intent services and recipients of contact + information (i.e. Web applications). This specification provides a set of non-normative <a href="#user-interaction-guidelines">User Interaction Guidelines</a> demonstrating an example user experience that is compliant with the Security and Privacy Considerations described herein. </p> <p> - This specification also provides informative examples illustrating how to - <a href="#adding-and-updating-contacts">add and update contact information</a>, utilizing existing web platform - APIs. - </p> - <p> The following code illustrates how to obtain contact information from a user's address book: </p> - <pre class="example sh_javascript_dom"> - function success (contacts) { - // do something with resulting contact objects - for (var i in contacts) alert(contacts[i].name); - // ... + <pre class="example highlight"> + var intent = new Intent({ action: "http://webintents.org/pick", + type: "http://w3.org/type/contact", + extras: { fields: ["displayName", "emails"] }}); + navigator.startActivity(intent, contactsOK, contactsFail); + + function contactsOK (contacts) { + // iterate over the array of contacts to do something useful with them } - - function error (err) { - // do something with resulting error - alert(err.code); - // ... + function contactsFail (err) { + // display an error to the user } - - // Perform an address book search. Obtain the 'name' and 'emails' properties - // and initially filter the list to Contact records containing 'Bob': - navigator.contacts.find( ['name', 'emails'], success, error, { filter: 'Bob', multiple: true } ); </pre> + <p> + When the above code is run, the user would typically be prompted by her user agent to select + a service able to pick a contact (there may be several such services, if she has multiple address + book sources). Upon selecting a service, she will be presented with an interface enabling her + to choose what contact information is returned to the Web application. Upon completing her + choice, the contacts data would be returned to the Web application in the <code>contactsOK</code> + callback. + </p> </section> <section id='conformance'> <p> - This specification defines conformance criteria that apply to a single product: the - <dfn id="ua">user agent</dfn> that implements the interfaces that it contains. + There is only one single conformance requirement placed upon the <dfn>user agent</dfn> + product: a <a>user agent</a> MUST support Web Intents [[!WEBINTENTS]]. </p> <p> - Implementations that use ECMAScript to implement the APIs defined in this specification must implement - them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification - [[!WEBIDL]], as this specification uses that specification and terminology. + The conformance criteria in this specification apply to a single product: the + <dfn>contact service</dfn> which exposes a Web Intent service that + handles Pick Contact Intents as defined in this specification. </p> <p> - A conforming implementation is required to implement all fields defined in this specification. + The data returned by the <a>contact service</a> is described in this specification using [[!WEBIDL]]. + When this data is provided using JavaScript, then the <a>contact service</a> MUST do so in a manner + consistent with the ECMAScript Bindings defined in the Web IDL specification. </p> - - <section> - <h2>Terminology</h2> - <p> - The terms <dfn>document base URL</dfn>, <dfn>browsing context</dfn>, <dfn>event handler attribute</dfn>, - <dfn>event handler event type</dfn>, <dfn>task</dfn>, <dfn>task source</dfn> and <dfn>task queues</dfn> - are defined by the HTML5 specification [[!HTML5]]. - </p> - <p> - The <a>task source</a> used by this specification is the <dfn>device task source</dfn>. - </p> - <p> - To <dfn>dispatch a <code>success</code> event</dfn> means that an event with the name - <code>success</code>, which does not bubble and is not cancellable, and which uses the - <code>Event</code> interface, is to be dispatched at the <a>ContactFindCB</a> object. - </p> - <p> - To <dfn>dispatch an <code>error</code> event</dfn> means that an event with the name - <code>error</code>, which does not bubble and is not cancellable, and which uses the <code>Event</code> - interface, is to be dispatched at the <a>ContactErrorCB</a> object. - </p> - </section> </section> - <section> + <section class="informative"> <h2>Security and Privacy Considerations</h2> <p> - The API defined in this specification can be used to find contact information from a user's address + The Intent defined in this specification can be used to find contact information from a user's address books. This discloses information related to a user's contacts such as their phone numbers, email addresses and other personally identifying information. The distribution of this information could potentially compromise the user's privacy, or the user's contacts' privacy. A conforming implementation @@ -215,36 +138,23 @@ ensure that no contact information is retrievable without the user's express permission. </p> <section> - <h2>Privacy considerations for implementers of the Contacts API</h2> + <h2>Privacy considerations for implementers of the Pick Contacts Intent</h2> <p> - A <a class="product-ua" href="#ua">user agent</a> should not provide contact information to Web sites without the express - permission of the user. A <a>user agent</a> should acquire permission from the user, unless - they have prearranged trust relationships with users, as described below. The user interface should - include the <a>document base URL</a>. Those permissions that are acquired through the user interface - and that are preserved beyond the current browsing session (i.e. beyond the time when the <a>browsing - context</a> is navigated to another URL) should be revocable and a <a>user agent</a> should respect permission revocation. + A <a>contact service</a> should not provide contact information to Web sites without the express + permission of the user. Obtaining the user's express permission to access a set of contacts does + not imply that the user has granted permission for the same Web site to access more contact information. + A <a>contact service</a> should take great care to ensure that the user can clearly see which information + is about to be shared, and must not share more information than has been requested by the Web application. </p> <p> - Obtaining the user's express permission to access one API method does not imply the user has granted - permission for the same Web site to access other methods provided by this API, or to access the same - method with a different set of arguments, as part of the same permission context. If a user has - expressed permission for an implementation to, e.g. find a set of existing contacts, the implementation - should seek the user's express permission if and when any additional <code>find</code> function is called - on this API. - </p> - <p> - A <a>user agent</a> may have prearranged trust relationships that do not require such user - interfaces. For example, while a Web browser will present a user interface when a Web site performs an - address book request, a Widget [[WIDGETS]] runtime may have a prearranged, delegated security - relationship with the user and, as such, a suitable alternative security and privacy mechanism with - which to authorize the retrieval of contact information. + A <a>user agent</a> may have prearranged trust relationships with a specific <a>contact service</a> + that do not require such user interaction. </p> </section> - - <section class="informative"> + <section> <h2>Privacy considerations for recipients of contact information</h2> <p> - Web sites operators that retrieve contacts information using this API are denoted as recipients + Web sites operators that retrieve contacts information using this Intent are denoted as recipients below. </p> <p> @@ -254,7 +164,7 @@ <p> Recipients should dispose of contact information once that task is completed, unless expressly permitted to retain it by the user. Recipients should also take measures to protect this information - against unauthorized access. If contact information is stored, users should be allowed to update and + against unauthorised access. If contact information is stored, users should be allowed to update and delete this information. </p> <p> @@ -264,7 +174,7 @@ </p> <p> Recipients should clearly and conspicuously disclose the fact that they are collecting contact data, - the purpose for the collection, how long the data is retained, how the data is secured, how the data is + the purpose of the collection, how long the data is retained, how the data is secured, how the data is shared if it is shared, how users can access, update and delete the data, and any other choices that users have with respect to the data. This disclosure should include an explanation of any exceptions to the guidelines listed above. @@ -272,228 +182,156 @@ <p> Note that even if a user gives permission to share their contact information this can have serious privacy implications for those parties whose contacts are shared, as they may not wish such sharing to - occur. This should be considered by web services when requesting and using such information. + occur. This should be considered by Web applications when requesting and using such information. </p> </section> - <section class='informative'> + <section> <h2>Additional implementation considerations</h2> <p> - Further to the requirements listed in the previous section, implementers of the Contacts API are + Further to the requirements listed in the previous section, implementers of a <a>user agents</a> are also advised to consider the following aspects that can negatively affect the privacy of their users: - in certain cases, users can inadvertently grant permission to the <a>user agent</a> to disclose their contacts + in certain cases, users can inadvertently grant permission to disclose their contacts to Web sites. In other cases, the content hosted at a certain URL changes in such a way that the previously granted contact permissions no longer apply as far as the user is concerned. Or the users might simply change their minds. </p> <p> Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive - measures are an implementation responsibility and not prescribed by this specification. However, in - designing these measures, implementers are advised to enable user awareness of contact sharing, and to - provide easy access to interfaces that enable revocation of permissions that web applications have to - access this API. + measures are a <a>user agent</a>'s responsibility and not prescribed by this specification. However, in + designing these measures, implementers are advised to enable user awareness of information sharing, and to + provide easy access to user interfaces that enable revocation of permissions that Web applications have to + access this Intent. </p> </section> </section> <section> - <h2>API Description</h2> - + <h2>Intent Description</h2> + <p> + The action for this Intent is <code>http://webintents.org/pick</code>. + </p> + <p> + The type for this Intent is <code>http://w3.org/type/contact</code>. + </p> + <p> + When a <a>contact service</a> is matched for delivery using these action and type, it + MUST respond in one of two ways: + </p> + <ul> + <li> + If contacts have been successfully selected for delivery, then a successful payload is returned + to the client (using <code>postResult()</code>) matching the data format defined below. + </li> + <li> + If an error of any kind takes place in the service, then an error payload is returned (using + <code>postFailure()</code>) matching the error data format defined below. The <a>contact service</a> + MUST NOT treat the user selecting zero contacts or cancelling the service as error conditions. + </li> + </ul> <section> - <h2><a>ServiceContacts</a> interface</h2> - <p id="ta-aa" class="product-ua"> - The <a>ServiceContacts</a> interface is exposed on the <a class="externalDFN">Navigator</a> - object [[NAVIGATOR]]. Its goal is to provide an access point to the functionality in this - specification. + <h2>Intent Extras</h2> + <p> + The Pick Contact Intent can be instantiated with an <code>extras</code> field that adheres to the + following dictionary. </p> - <dl title='[NoInterfaceObject] interface ServiceContacts' class='idl'> - <dt>readonly attribute Contacts contacts</dt> - <dd>The object through which the contacts functionality can be accessed.</dd> - </dl> - <div class='idl' title='Navigator implements ServiceContacts'></div> + <section> + <h2>The <a>ContactIntentExtras</a> dictionary</h2> + <p> + The <a>ContactIntentExtras</a> dictionary describes the options that can be applied to contact searching. + </p> + <dl title='dictionary ContactIntentExtras' class='idl'> + <dt>DOMString? search</dt> + <dd> + A string which provides a hint to the <a>contact service</a> to facilitate contacts selection by the user. + The exact manner in which this hint is exploited is entirely up to the <a>contact service</a>. + </dd> + <dt>unsigned long? limit</dt> + <dd> + By default a <a>contact service</a> MAY return as many contacts as the user selects. If <code>limit</code> + is specified, the <a>contact service</a> MUST NOT return more than <code>limit</code> contacts. The + <a>contact service</a> SHOULD enforce this limitation in the user interface that it exposes. + </dd> + <dt>DOMString[] fields</dt> + <dd> + An array of field names corresponding to the name of the fields in the <a>Contact</a> dictionary that + the Web application is requesting from the <a>contact service</a>. The <a>contact service</a> MUST + NOT return defined fields on the contact objects that it provides other than those present in this + list. If a field name is provided that the <a>contact service</a> does not recognise as a field + of the <a>Contact</a> dictionary, then it MUST ignore it. + </dd> + </dl> + </section> </section> - + </section> + <section> + <h2>Data Format</h2> + <p> + Upon successful invocation, the <a>contact service</a> MUST return an array of <a>Contact</a> dictionaries. + </p> <section> - <h2><a>Contacts</a> interface</h2> + <h2>The <a>Contact</a> dictionary</h2> <p> - The <a>Contacts</a> interface exposes a database of contact information that may be retrieved. - </p> - <p> - Multiple contact groups can be represented within this unified address book by specifying consistent - <a href='#widl-Contact-categories'><code>categories</code></a> values as part of individual - <a>Contact</a> objects. Multiple contact groups can be displayed by filtering on the required - <a href='#widl-Contact-categories'><code>categories</code></a> values via - the <a>Contacts</a> <a href='#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options'>find()</a> operation. - </p> - - <dl title='[NoInterfaceObject] interface Contacts' class='idl'> - <dt>void find ()</dt> - <dd> - <p> - Find contacts in the address book according to the <a>find contacts process</a> detailed - below. - </p> - <p> - This method takes two, three or four arguments. When called, it starts the following - <dfn>find contacts process</dfn>: - </p> - <ol class="rule"> - <li> - Let <var>successCallback</var> be the callback indicated by the method's second argument. - </li> - <li> - Let <var>errorCallback</var> be the callback indicated by the method's third argument, if any, or null otherwise. - </li> - <li id="ta-ai" class="product-ua">If <var>successCallback</var> is null, then throw a TypeError (as defined in [[WEBIDL]]).</li> - <li class="product-ua" id="ta-ag"> - If there is a <a>task</a> from the <a>device task source</a> in one of the <a>task - queues</a> (e.g. an existing <code>find()</code> operation is still pending a response), run these - substeps: - <ol> - <li> - If <var>errorCallback</var> is not null, let <var>error</var> be a <a>ContactError</a> - object whose code attribute has the value <code>PENDING_OPERATION_ERROR</code> and - queue a task to invoke <var>errorCallback</var> with <var>error</var> as its argument. - </li> - <li>Abort this operation.</li> - </ol> - </li> - <li> - Return, and run the remaining steps asynchronously. - </li> - <li> - Let <var>results</var> be the array of <a>Contact</a> objects obtained by searching contacts in the address book - according to the rules defined in <a href='#contact-search-processing'>Contact Search Processing</a>, - or null if the search has failed. - </li> - <li> - If <var>results</var> is null, run these substeps: - <ol> - <li> - If <var>errorCallback</var> is not null, let <var>error</var> be a <a>ContactError</a> - object whose code attribute has its value set according to the type of failure that occurred and - queue a task to invoke <var>errorCallback</var> with <var>error</var> as its argument. - </li> - <li>Abort this operation.</li> - </ol> - </li> - <li>Queue a task to invoke <var>successCallback</var> with <var>results</var> as its argument.</li> - </ol> - - <dl class='parameters'> - <dt>DOMString[] fields</dt> - <dd>The <a>search qualifier</a>.</dd> - <dt>ContactFindCB successCB</dt> - <dd>Function to call when the asynchronous operation completes successfully.</dd> - <dt>optional ContactErrorCB errorCB</dt> - <dd>Function to call when the asynchronous operation fails.</dd> - <dt>optional ContactFindOptions options</dt> - <dd>The options to apply to the output of this method.</dd> - </dl> - </dd> - </dl> - </section> - - <section> - <h2><a>Contact</a> interface</h2> - <p> - The <a>Contact</a> interface captures the properties of a contact object. All properties included in this - interface have a corresponding definition in [[POCO-SCHEMA]], [[RFC2426]] (aka vCard), and [[OMA-CAB]], thereby - allowing the API to be supported across implementations supporting these various contact formats. - </p> - <p id="ta-ac" class="product-ua"> - All <a>Contact</a> objects MUST include all attributes supported by the implementation, regardless - of whether these attributes have been assigned a <code>null</code> value or not. If a supported attribute has not been - assigned a value by the user or the implementation, then this attribute MUST still be present in the - resulting <a>Contact</a> object and MUST have a value of <code>null</code>. + The <a>Contact</a> dictionary captures the properties of a contact object. All properties included in this + interface have a corresponding definition in [[POCO-SCHEMA]], [[RFC2426]] (also known as vCard), and + [[OMA-CAB]], thereby allowing the data format to be supported across implementations supporting these + various contact representations. </p> <p> Additional attributes MAY be included according to the provisions detailed in - <a href="#extended-contact-properties-and-parameters">Extended Contact Properties and Parameters</a>. If an - extended attribute is supported by the current implementation and has not been assigned a value by the - user or the implementation, then this extended attribute MUST still be present in the resulting - <a>Contact</a> object and MUST have a value of <code>null</code>. + <a href="#extended-contact-properties-and-parameters">Extended Contact Properties and Parameters</a>. </p> - - <dl title='[NoInterfaceObject] interface Contact' class='idl'> - <dt>readonly attribute DOMString id</dt> + <dl title='dictionary Contact' class='idl'> + <dt>DOMString id</dt> <dd> - <p> - A globally unique identifier for the given <a>Contact</a> object. - </p> - <p> - An implementation MUST maintain this globally unique identifier when a <a>Contact</a> is added - to an address book. - </p> + A globally unique identifier for the given <a>Contact</a> object. </dd> - <dt>attribute DOMString? displayName</dt> + <dt>DOMString? displayName</dt> <dd> - <p> - This attribute contains the name of this <a>Contact</a> in a form that is suitable for display - to the user. - </p> + This attribute contains the name of this <a>Contact</a> in a form that is suitable for display + to the user. </dd> - <dt>attribute ContactName? name</dt> + <dt>ContactName? name</dt> <dd> - <p> - This attribute represents the full name of this <a>Contact</a> indicated by the name components - associated with the <a>ContactName</a> object. - </p> + This attribute represents the full name of this <a>Contact</a> indicated by the name components + associated with the <a>ContactName</a> dictionary. </dd> - <dt>attribute DOMString? nickname</dt> + <dt>DOMString? nickname</dt> <dd> - <p> - This attribute contains the nickname (or a casual name) for this <a>Contact</a>. - </p> + This attribute contains the nickname (or a casual name) for this <a>Contact</a>. </dd> - <dt>attribute ContactField[]? phoneNumbers</dt> + <dt>ContactField[]? phoneNumbers</dt> <dd> - <p> - This attribute captures one or more phone numbers associated with this <a>Contact</a>. - </p> + This attribute captures one or more phone numbers associated with this <a>Contact</a>. </dd> - <dt>attribute ContactField[]? emails</dt> + <dt>ContactField[]? emails</dt> <dd> - <p> - This attribute represents one or more email addresses associated with this <a>Contact</a>. - </p> + This attribute represents one or more email addresses associated with this <a>Contact</a>. </dd> - <dt>attribute ContactAddress[]? addresses</dt> + <dt>ContactAddress[]? addresses</dt> <dd> - <p> - This attribute represents one or more physical addresses associated with this <a>Contact</a>. - </p> + This attribute represents one or more physical addresses associated with this <a>Contact</a>. </dd> - <dt>attribute ContactField[]? ims</dt> + <dt>ContactField[]? ims</dt> <dd> - <p> - This attribute represents one or more instant messaging identifiers associated with this - <a>Contact</a>. - </p> + This attribute represents one or more instant messaging identifiers associated with this + <a>Contact</a>. </dd> - <dt>attribute ContactOrganization[]? organizations</dt> + <dt>ContactOrganization[]? organizations</dt> <dd> - <p> - This attribute represents one or more organizations associated with this <a>Contact</a>. - </p> + This attribute represents one or more organisations associated with this <a>Contact</a>. </dd> - <dt>attribute Date? birthday</dt> + <dt>Date? birthday</dt> <dd> - <p> - This attribute contains birthday of this <a>Contact</a>. - </p> - <p> - The year value MAY be set to 0000 when the age of the <a>Contact</a> is private or the year is not - available. - </p> + This attribute contains birthday of this <a>Contact</a>. The <a>contact service</a> MAY + set the year value to 0000 when the age of the <a>Contact</a> is private or the year is not + available. </dd> - <dt>attribute DOMString? note</dt> + <dt>DOMString? note</dt> <dd> - <p> - This attribute contains the personal notes (free-text) for this <a>Contact</a> that is managed by the - user of the address book. - </p> + This attribute contains the personal notes (free-text) for this <a>Contact</a> that is managed by the + user of the address book. </dd> - <dt>attribute ContactField[]? photos</dt> + <dt>ContactField[]? photos</dt> <dd> <p> This attribute represents one or more photos associated with this <a>Contact</a>. @@ -504,679 +342,178 @@ to provide inline data. </p> <p class="note"> - This attribute SHOULD NOT be used to send down arbitrary photos taken by this user, + A <a>contact service</a> SHOULD NOT use this attribute to send down arbitrary photos taken by this user, but specifically profile photos of the contact suitable for display when describing the contact. </p> </dd> - <dt>attribute DOMString[]? categories</dt> + <dt>DOMString[]? categories</dt> <dd> - <p> - This attribute contains one or more user-defined categories/tags/labels associated with this - <a>Contact</a>. e.g. "family", "favorite", "cryptozoologists". - </p> + This attribute contains one or more user-defined categories/tags/labels associated with this + <a>Contact</a>. e.g. "family", "favourite", "cryptozoologists". </dd> - <dt>attribute ContactField[]? urls</dt> + <dt>ContactField[]? urls</dt> <dd> <p> This attribute represents one or more URLs associated with this <a>Contact</a> e.g. personal web page, blog. </p> - <p> - The web resources MUST be specified using the <code>value</code> attribute of the - <code>ContactField</code> object, and its <code>type</code> field may be set to "blog" or - "profile". - </p> </dd> </dl> </section> <section> - <h2><a>ContactName</a> interface</h2> - + <h2>The <a>ContactName</a> dictionary</h2> <p> - The <a>ContactName</a> interface describes a contact's name. + The <a>ContactName</a> dictionary describes a contact's name in detail. </p> - - <dl title='[NoInterfaceObject] interface ContactName' class='idl'> - <dt>attribute DOMString? familyName</dt> + <dl title='dictionary ContactName' class='idl'> + <dt>DOMString? familyName</dt> <dd> - <p> - This attribute contains the family name (also referred to as the last name) of this <a>Contact</a>. - </p> + This attribute contains the family name (also referred to as the last name) of this <a>Contact</a>. </dd> - <dt>attribute DOMString? givenName</dt> + <dt>DOMString? givenName</dt> <dd> - <p> - This attribute contains the given name (also referred to as the first name) of this <a>Contact</a>. - </p> + This attribute contains the given name (also referred to as the first name) of this <a>Contact</a>. </dd> - <dt>attribute DOMString? middleName</dt> + <dt>DOMString? middleName</dt> <dd> - <p> - This attribute contains the middle name of this <a>Contact</a>. - </p> + This attribute contains the middle name of this <a>Contact</a>. </dd> - <dt>attribute DOMString? honorificPrefix</dt> + <dt>DOMString? honorificPrefix</dt> <dd> - <p> - This attribute contains the honorific prefix (or title) of this <a>Contact</a>. E.g. Mr., Dr., Ms., - Mrs. - </p> + This attribute contains the honorific prefix (or title) of this <a>Contact</a>. E.g. Mr., Dr., Ms., Mrs. </dd> - <dt>attribute DOMString? honorificSuffix</dt> + <dt>DOMString? honorificSuffix</dt> <dd> - <p> - This attribute contains the honorific suffix of this <a>Contact</a>. E.g. Jr., III, Sr. - </p> + This attribute contains the honorific suffix of this <a>Contact</a>. E.g. Jr., III, Sr. </dd> </dl> </section> <section> - <h2><a>ContactField</a> interface</h2> - + <h2>The <a>ContactField</a> dictionary</h2> <p> - The <a>ContactField</a> interface is a reusable component that is used to capture contact fields of the - <a>Contact</a> interface that have some modicum of structure. + The <a>ContactField</a> dictionary is a reusable component that is used to capture contact fields of the + <a>Contact</a> dictionary that have some modicum of structure. </p> - <dl title='[NoInterfaceObject] interface ContactField' class='idl'> - <dt>attribute DOMString type</dt> + <dl title='dictionary ContactField' class='idl'> + <dt>DOMString type</dt> <dd> - <p> - This attribute contains the type information for this <a>ContactField</a> and its content varies subject - to the contact property this <a>ContactField</a> is representing. For example, if the <a>ContactField</a> - is representing a <code>phoneNumber</code> property, the <code>type</code> attribute can be set to - <code>home</code>, <code>mobile</code>; if the <a>ContactField</a> is representing the <code>ims</code> - property, the type attribute could be set to <code>xmpp</code>, <code>irc</code>, <code>bbm</code>, etc. - </p> + This attribute contains the type information for this <a>ContactField</a> and its content varies subject + to the contact property this <a>ContactField</a> is representing. For example, if the <a>ContactField</a> + is representing a <code>phoneNumber</code> property, the <code>type</code> attribute can be set to + <code>home</code>, <code>mobile</code>; if the <a>ContactField</a> is representing the <code>ims</code> + property, the type attribute could be set to <code>xmpp</code>, <code>irc</code>, <code>bbm</code>, etc. </dd> - <dt>attribute DOMString? value</dt> + <dt>DOMString? value</dt> <dd> - <p> - This attribute contains the value for this <a>ContactField</a> and its content varies subject to the - contact property this <a>ContactField</a> is representing. For example, if the <a>ContactField</a> is - representing an <code>email</code>, the value attribute could be set to <code>JoeSmith@example.com</code>, - and if the <a>ContactField</a> is representing a <code>url</code>, the value attribute can be set to - <code>http://www.example.org/joesmith</code>, etc. - </p> + This attribute contains the value for this <a>ContactField</a> and its content varies subject to the + contact property this <a>ContactField</a> is representing. For example, if the <a>ContactField</a> is + representing an <code>email</code>, the value attribute could be set to <code>JoeSmith@example.com</code>, + and if the <a>ContactField</a> is representing a <code>url</code>, the value attribute can be set to + <code>http://www.example.org/joesmith</code>, etc. </dd> - <dt>attribute boolean pref</dt> + <dt>boolean pref</dt> <dd> - <p> - This attribute indicates whether this instance of the <a>ContactField</a> is the - preferred, or primary, value for the contact property this <a>ContactField</a> is - representing in the <a>Contact</a> interface. By default, the value is <code>false</code>. - </p> + This attribute indicates whether this instance of the <a>ContactField</a> is the + preferred, or primary, value for the contact property this <a>ContactField</a> is + representing in the <a>Contact</a> interface. By default, the value is <code>false</code>. </dd> </dl> </section> <section> - <h2><a>ContactAddress</a> interface</h2> - + <h2>The <a>ContactAddress</a> dictionary</h2> <p> - The <a>ContactAddress</a> interface is a reusable component that is used to capture addresses - within the <a>Contact</a> interface. + The <a>ContactAddress</a> dictionary is a reusable component that is used to capture addresses + within the <a>Contact</a> dictionary. </p> - <dl title='[NoInterfaceObject] interface ContactAddress' class='idl'> - <dt>attribute boolean pref</dt> + <dl title='dictionary ContactAddress' class='idl'> + <dt>boolean pref</dt> <dd> - <p> - This attribute indicates whether this instance of the <code>ContactAddress</code> is the preferred, or primary, value for the contact. - By default, the value is <code>false</code>. - </p> + This attribute indicates whether this instance of the <code>ContactAddress</code> is the preferred, + or primary, value for the contact. By default, the value is <code>false</code>. </dd> - <dt>attribute DOMString? type</dt> + <dt>DOMString? type</dt> <dd> - <p> - This attribute contains the type of address this object is representing (e.g. <code>work</code>, <code>home</code>, <code>premises</code>, etc). - </p> + This attribute contains the type of address this object is representing (e.g. <code>work</code>, + <code>home</code>, <code>premises</code>, etc). </dd> - <dt>attribute DOMString? streetAddress</dt> + <dt>DOMString? streetAddress</dt> <dd> - <p> - This attribute contains the street address corresponding to this <a>ContactAddress</a>. - </p> + This attribute contains the street address corresponding to this <a>ContactAddress</a>. </dd> - <dt>attribute DOMString? locality</dt> + <dt>DOMString? locality</dt> <dd> - <p> - This attribute contains the locality (or city) name corresponding to this <a>ContactAddress</a>. - </p> + This attribute contains the locality (or city) name corresponding to this <a>ContactAddress</a>. </dd> - <dt>attribute DOMString? region</dt> + <dt>DOMString? region</dt> <dd> - <p> - This attribute contains the region (or state/province) name corresponding to this <a>ContactAddress</a>. - </p> + This attribute contains the region (or state/province) name corresponding to this <a>ContactAddress</a>. </dd> - <dt>attribute DOMString? postalCode</dt> + <dt>DOMString? postalCode</dt> <dd> - <p> - This attribute contains the postal code (or zip) corresponding to this <a>ContactAddress</a>. - </p> + This attribute contains the postal code (or zip) corresponding to this <a>ContactAddress</a>. </dd> - <dt>attribute DOMString? country</dt> + <dt>DOMString? country</dt> <dd> - <p> - This attribute contains the country name corresponding to this <a>ContactAddress</a>. - </p> + This attribute contains the country name corresponding to this <a>ContactAddress</a>. </dd> </dl> </section> <section> - <h2><a>ContactOrganization</a> interface</h2> - + <h2>The <a>ContactOrganization</a> dictionary</h2> <p> - The <a>ContactOrganization</a> interface is a reusable component that is used to support contact - organisations within the <a>Contact</a> interface. + The <a>ContactOrganization</a> dictionary is a reusable component that is used to support contact + organisations within the <a>Contact</a> dictionary. </p> - - <dl title='[NoInterfaceObject] interface ContactOrganization' class='idl'> - <dt>attribute boolean pref</dt> + <dl title='dictionary ContactOrganization' class='idl'> + <dt>boolean pref</dt> <dd> - <p> - This attribute indicates whether this instance of the <code>ContactOrganization</code> is the preferred, or - primary, value for the contact. By default, the value is <code>false</code>. - </p> + This attribute indicates whether this instance of the <code>ContactOrganization</code> is the preferred, or + primary, value for the contact. By default, the value is <code>false</code>. </dd> - <dt>attribute DOMString? type</dt> + <dt>DOMString? type</dt> <dd> - <p> - This attribute contains the type of organization this object is representing. - </p> + This attribute contains the type of organisation this object is representing. </dd> - <dt>attribute DOMString? name</dt> + <dt>DOMString? name</dt> <dd> - <p> - The name of the organisation. - </p> + The name of the organisation. </dd> - <dt>attribute DOMString? department</dt> + <dt>DOMString? department</dt> <dd> - <p> - The department within which this <a>Contact</a> works. - </p> + The department within which this <a>Contact</a> works. </dd> - <dt>attribute DOMString? title</dt> + <dt>DOMString? title</dt> <dd> - <p> - The job title that the <a>Contact</a> holds inside this organisation. - </p> + The job title that the <a>Contact</a> holds inside this organisation. </dd> </dl> </section> - <section> - <h2><a>ContactFindOptions</a> interface</h2> + <h2>The <a>ContactError</a> dictionary</h2> <p> - The <a>ContactFindOptions</a> interface describes the options that can be applied to contact searching. - When a <a>ContactFindOptions</a> parameter is provided to the <a>Contacts</a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> - operation, it should be processed according to the provisions detailed in - <a href="#options-processing">Options Processing</a>. + If the <a>contact service</a> encounters an error then it MUST return an error + (through <code>postFailure()</code>) using the <a>ContactError</a> dictionary. </p> - <dl title='[NoInterfaceObject] interface ContactFindOptions' class='idl'> - <dt>attribute DOMString? filter</dt> - <dd> - A string-based <a>search filter</a> which provides a hint to the user agent to facilitate contacts selection by the user. - </dd> - <dt>attribute boolean? multiple</dt> - <dd> - A boolean value to indicate whether multiple Contact objects are wanted as part of the - <a>Contacts</a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation. - By default this option is set to <code>false</code>. - </dd> + <dl title='dictionary ContactError' class='idl'> + <dt>DOMString message</dt> + <dd>A message describing the error.</dd> </dl> </section> - <section> - <h2><a>ContactFindCB</a> interface</h2> + <h2>Extended Contact Properties and Parameters</h2> <p> - This is the wrapper interface for callbacks indicating success of the <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> - operation. + A <a>contact service</a> MAY extend the dictionaries described in in the Data Formats section with + additional fields. If providing an extended field, a <a>contact service</a> MUST prefix its name + with <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix. </p> - - <dl title='[Callback=FunctionOnly, NoInterfaceObject] interface ContactFindCB' class='idl'> - <dt>void onsuccess ()</dt> - <dd> - <dl class='parameters'> - <dt>Contact[] contactObjs</dt> - <dd> - An array of <a>Contact</a> objects resulting from the given <a>Contacts</a> - <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation. - </dd> - </dl> - </dd> - </dl> - - <section> - <h3>Event Handler Attributes</h3> - <p> - The following is the <a>event handler attribute</a> (and its corresponding <a>event handler event - type</a>) that MUST be supported as a DOM attribute by the <a>ContactFindCB</a> object. - </p> - <table class='simple'> - <thead> - <tr> - <th>event handler attribute</th> - <th>event handler event type</th> - </tr> - </thead> - <tbody> - <tr> - <td><strong><code>onsuccess</code></strong></td> - <td><code>success</code></td> - </tr> - </tbody> - </table> - </section> - </section> - - <section> - <h2><a>ContactErrorCB</a> interface</h2> - <p> - This is the wrapper interface for callbacks indicating failure of the <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> - operation. - </p> - - <dl title='[Callback=FunctionOnly, NoInterfaceObject] interface ContactErrorCB' class='idl'> - <dt>void onerror ()</dt> - <dd> - <dl class='parameters'> - <dt>ContactError error</dt> - <dd>The <a>ContactError</a> object capturing the type of the error.</dd> - </dl> - </dd> - </dl> - - <section> - <h3>Event Handler Attributes</h3> - <p> - The following is the <a>event handler attribute</a> (and its corresponding <a>event handler event - type</a>) that MUST be supported as a DOM attribute by the <a>ContactErrorCB</a> object. - </p> - - <table class='simple'> - <thead> - <tr> - <th>event handler attribute</th> - <th>event handler event type</th> - </tr> - </thead> - <tbody> - <tr> - <td><strong><code><strong>onerror</strong></code></strong></td> - <td><code>error</code></td> - </tr> - </tbody> - </table> - </section> - </section> - - <section> - <h2><a>ContactError</a> interface</h2> - <p> - The <a>ContactError</a> interface encapsulates all errors in the manipulation of - <a>Contact</a> objects. - </p> - - <dl title='[NoInterfaceObject] interface ContactError' class='idl'> - <dt>const unsigned short UNKNOWN_ERROR = 0</dt> - <dd>An unknown error occurred.</dd> - - <dt>const unsigned short INVALID_ARGUMENT_ERROR = 1</dt> - <dd>An invalid parameter was provided when the requested method was invoked.</dd> - - <dt>const unsigned short TIMEOUT_ERROR = 2</dt> - <dd>The requested method timed out before it could be completed.</dd> - - <dt>const unsigned short PENDING_OPERATION_ERROR = 3</dt> - <dd>There is already a <a>task</a> in the <a>device task source</a>.</dd> - - <dt>const unsigned short IO_ERROR = 4</dt> - <dd>An error occurred in communication with the underlying implementation that meant the requested - method could not complete.</dd> - - <dt>const unsigned short NOT_SUPPORTED_ERROR = 5</dt> - <dd>The requested method is not supported by the current implementation.</dd> - - <dt>const unsigned short PERMISSION_DENIED_ERROR = 20</dt> - <dd>Access to the requested information was denied by the implementation or by the user.</dd> - - <dt>readonly attribute unsigned short code</dt> - <dd>An error code assigned by an implementation when an error has occurred in Contacts API - processing.</dd> - </dl> </section> </section> - - <section> - <h2><a>Contact Search Processing</a></h2> - - <p> - The <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> - method provides an operation to search for one of more <a href= - "#contact-interface"><code>Contact</code></a> objects within the <a href= - "#contacts-interface"><code>Contacts</code></a> database. - </p> - - <section> - <h3>Search Qualifiers</h3> - - <p> - The <dfn>search qualifier</dfn> provides an application with a way to request the specific subset of - <a href="#contact-interface"><code>Contact</code></a> properties it wishes to obtain in any resulting - successful callback. The <a>search qualifier</a> is deployed to minimize the data that needs to be - shared with an application in order to let that application fulfill its function on behalf of the user. - The <a>search qualifier</a> is included within a <a href= - "#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation as - the <code>fields</code> parameter. - </p> - - <p id="ta-aj" class="product-ua"> - A <a>search qualifier</a> MUST be specified from a requesting application as a part of any <a href= - "#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation. - </p> - - <p id="ta-ab" class="product-ua"> - If the <a>search qualifier</a> provided is of <em>zero-length</em> then the current <a href= - "#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation and - the current find() operation was invoked with a non-<code>null</code> - <code>errorCB</code> parameter, then the user agent MUST invoke the <code>errorCB</code> function - with an error code of <a href= - "#widl-ContactError-INVALID_ARGUMENT_ERROR"><code>INVALID_ARGUMENT_ERROR</code></a>. - </p> - - <p id="ta-ak" class="product-ua"> - In the case that the <a>search qualifier</a> provided is of <em>non-zero-length</em> then the - current <a href="#contacts-interface"><code>Contacts</code></a> <a href= - "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation MUST return only the matching <a href= - "#contact-interface"><code>Contact</code></a> properties within any resulting <a href= - "#contact-interface"><code>Contact</code></a> object(s). - </p> - - <p id="ta-al" class="product-ua"> - If a provided <a>search qualifier</a> element (<code>fields[x]</code>) does not match a <a href= - "#contact-interface"><code>Contact</code></a> attribute, <code>fields[x]</code> SHOULD be ignored when - executing the current <a href="#contacts-interface"><code>Contacts</code></a> <a href= - "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation. - </p> - - <section> - <h3>Advanced Search Qualifiers</h3> - - <p> - We call <dfn>composed attributes</dfn> <a href="#contact-interface"><code>Contact</code></a> - attributes of types <code>object</code>, which contain information only available - only through child attributes of that object, or <code>array</code>. - </p> - - <p class="product-ua" id="ta-ad"> - A requesting application MUST be able to request both the full composed <a href= - "#contact-interface"><code>Contact</code></a> attribute and also be able to request individual parts - of a composed <a href="#contact-interface"><code>Contact</code></a> attribute in the <a>search - qualifier</a> provided to a <a href="#contacts-interface"><code>Contacts</code></a> <a href= - "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation. - </p> - - <p> - For example, the <code>name</code> attribute of a <a href= - "#contact-interface"><code>Contact</code></a> object is defined to be of composed type <a href= - "#contactname-interface"><code>ContactName</code></a>. Therefore, a requesting application may - request either the full composed attribute (i.e. <code>name</code>) or specific individual attributes - of this composed attribute (i.e. <code>name.familyName</code>, - <code>name.givenName</code>, <code>name.middleName</code>, <code>name.honorificPrefix</code>, - <code>name.honorificSuffix</code>) as part of a <a href= - "#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation's - <a>search qualifier</a>. - </p> - - <p id="ta-af" class="product-ua"> - In the case that a composed <a href="#contact-interface"><code>Contact</code></a> attribute is - defined as an array of composed objects, specific individual attributes can be referenced - by using the composed attribute name, a dot (<code>.</code>) character and the individual attribute - to be retrieved. - </p> - - <p> - For example, the <code>addresses</code> attribute of <a href= - "#contact-interface"><code>Contact</code></a> allows multiple <a href= - "#contactaddress-interface"><code>ContactAddress</code></a> objects to be defined. To request - individual attributes of this composed attribute an application would request e.g. - <code>addresses.locality</code>, <code>addresses.region</code>, etc. - </p> - </section> - - <div class="example"> - <p> - The following Contact search is initiated: - </p> - <pre class="sh_javascript"> - - navigator.contacts( ['emails.value', 'name', 'friends'], - function(contacts) { - for(i in contacts) { - for(j in contacts[i].emails) - alert(contacts[i].emails[j]); - } - } ); - </pre> - - <p> - The above example logically implies: - </p> - - <ol class="rule"> - <li>Return only the valid <a href="#contact-interface"><code>Contact</code></a> attributes - requested in the provided <a>search qualifier</a> (<code>name</code>, <code>emails.value</code> - - <code>friends</code> is not a valid <a href="#contact-interface"><code>Contact</code></a> attribute - so ignore this element).</li> - </ol> - </div> - </section> - - <section> - <h2>Options Processing</h2> - - <section> - <h3>Search Cardinality</h3> - - <p id="ta-am" class="product-ua"> - By default, the <a href="#contacts-interface"><code>Contacts</code></a> <a href= - "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation MUST return either an empty sequence or a single <a href= - "#contact-interface"><code>Contact</code></a> object, accessible as part of the sequence returned in - the <a href="#contactfindcb-interface"><code>ContactFindCB</code></a> callback function. - </p> - - <p id="ta-ae" class="product-ua"> - If a <a href="#contactfindoptions-interface"><code>ContactFindOptions</code></a> object is - provided to the <a href="#contacts-interface"><code>Contacts</code></a> <a href= - "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation and its <code>multiple</code> attribute is set to - <code>true</code>, the <a href="#contacts-interface"><code>Contacts</code></a> <a href= - "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation MUST return either an empty sequence, a single <a href= - "#contact-interface"><code>Contact</code></a> object or <var>[X]</var> number of <a href= - "#contact-interface"><code>Contact</code></a> objects, accessible as part of the sequence returned in - the <a href="#contactfindcb-interface"><code>ContactFindCB</code></a> callback function. - </p> - </section> - - <section> - <h3>Search Filters</h3> - - <p> - A <dfn>search filter</dfn> may be specified from a requesting web application to provide a hint to the user agents as to which contacts the user can select to share with the application.</p> - - <p>The <a>search filter</a> is defined through the <code>filter</code> - attribute of the <a href="#contactfindoptions-interface"><code>ContactFindOptions</code></a> object - provided to a <a href="#contacts-interface"><code>Contacts</code></a> <a href= - "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation. - </p> - - <p>The actual usage of this <a>search filter</a> is user-agent dependant, but is expected to represent - the logical union of provided values that are matched therein. - </p> - </section> - </section> - </section> - - <section> - <h2>Extended Contact Properties and Parameters</h2> - - <p> - The properties and parameters defined on the <a href="#contact-interface"><code>Contact</code></a> - interface MAY be extended by implementers of this specification. - </p> - - <p> - Non-standard, private properties and parameters MUST have a prefixed name starting with - <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix. Extended properties and - parameters can be defined bilaterally between <a title="user agent">user agents</a> without outside - registration or standardization. - </p> - - <p> - It is RECOMMENDED that authors define both a formal vCard grammar and a WebIDL grammar for their - proposed extension to ensure interoperability between vCard databases and other non-standard Contact - databases and formats. It is also RECOMMENDED that authors provide documentation of their extension - properties and parameters within the public domain. - </p> - - <div class="example"> - <p> - A new parameter is required by Company X to provide information related to a user's accounts - registered across different networks and services. - </p> - - <p> - The [[WEBIDL]] syntax for this parameter is defined as follows: - </p> - - <div class='idl' title='Contact implements ContactExtended'> - - </div> - - <dl title='[NoInterfaceObject] interface ContactExtended' class='idl'> - <dt>attribute ContactAccount[] Xaccounts</dt> - - <dd>One or more user accounts. See [[[POCO-SCHEMA]] Section 7.2.2. <code>accounts</code>].</dd> - </dl> - - <dl title='[NoInterfaceObject] interface ContactAccount' class='idl'> - <dt>attribute DOMString domain</dt> - - <dd> - <p> - See [[[POCO-SCHEMA]] Section 7.6. <code>domain</code>]. - </p> - </dd> - - <dt>attribute DOMString username</dt> - - <dd> - <p> - See [[[POCO-SCHEMA]] Section 7.6. <code>username</code>]. - </p> - </dd> - - <dt>attribute DOMString userid</dt> - - <dd> - <p> - See [[[POCO-SCHEMA]] Section 7.6. <code>userid</code>]. - </p> - </dd> - </dl> - - <p> - The corresponding vCard [[RFC2426]] notation for this parameter is defined as follows: - </p> - <pre> - The following ABNF grammar extends the grammar found in [[RFC2426]] (Section 4). - - <strong>X-ACCOUNT</strong> - - Purpose: To specify the components of the accounts for the vCard - object. - - Value type: A single structured text value, separated by the SEMI- - COLON character (ASCII decimal 59). - - Cardinality: (0,n) - - Special notes: The structured type value consists of a sequence of - account components. The component values must be specified in - their corresponding position. The structured type value - corresponds, in sequence, to the domain; the username; the userid. - When a component value is missing, the associated component - separator must still be specified. - - The text components are separated by the SEMI-COLON character - (ASCII decimal 59). - - ABNF: - - X-ACCOUNT-param = ; no parameter allowed - X-ACCOUNT-value = list-component 3(";" list-component) - </pre> - - <p> - This parameter will be used within the Contacts API as follows: - </p> - <pre class="sh_javascript"> - var contact = ...; // ...obtain individual contact object - for(var i in contact.Xaccounts) { - alert(contact.Xaccounts[i].domain); // thesocialnetwork.com - alert(contact.Xaccounts[i].username); // null - alert(contact.Xaccounts[i].userid); // 344aesq2 - } - </pre> - - <p> - This parameter will be used within the vCard format [[RFC2426]]] as follows: - </p> - <pre> - X-ACCOUNT;thesocialnetwork.com;;344aesq2 - </pre> - </div> - </section> - - <section> - <h3>API Invocation via DOM Events</h3> - - <p> - The API contained in this document can be invoked either programmatically (for example, inline within - a general script) or resulting from the <a>interaction of a user</a>. - </p> - - <p> - The <dfn>interaction of a user</dfn> is when a user invokes the API from an <a href= - "http://dev.w3.org/html5/markup/elements.html"><code>HTMLElement</code></a> [[HTML5]] within the current - <a>browsing context</a> via a <a>valid auto-invocation event</a>. - </p> - - <p> - A <dfn>valid auto-invocation event</dfn> includes any of the following event types, as defined in - [[!DOM-LEVEL-3-EVENTS]]: - </p> - - <ul> - <li><code>click</code></li> - - <li><code>dblclick</code></li> - - <li><code>mouseup</code></li> - </ul> - - <p> - The <code>find()</code> method on <a href="#contacts-interface"><code>Contacts</code></a> should, if - the method was invoked by an <a>interaction of a user</a> (as opposed to having been created and executed - in general script), display the <a>Contact Picker</a> directly. - </p> - </section> - <section class="informative appendix"> <h2>User Interaction Guidelines</h2> @@ -1371,226 +708,5 @@ </p> </section> </section> - - <section class="informative appendix"> - <h2>Adding and Updating Contacts</h2> - - <p> - The ability to add and update contact information is not a function of the API provided in this - specification. Instead, the intention is to reuse existing web platform APIs and paradigms in order to - achieve add and update functionality. - </p> - - <p> - In this section we show how the existing web platform would be used to provide add and update - writeback functionality to allow users to add new contacts or update existing contacts from a web page to - their unified address book. - </p> - - <p> - A <dfn>valid Contact resource</dfn> is a web resource with a <code>.vcard</code> or <code>.vcf</code> - filename extension or a web resource with a MIME-type matching a <a>valid media type</a>. A <dfn>vCard - object</dfn> is a text-based representation of contact information provided according to any version of - the vCard family of specifications. - </p> - - <p class="note">Need to add informative references to all specs within the 'vCard family of - specifications'. - </p> - - <p> - To handle the saving of a new Contact, a <a>user agent</a> should register as the default handler for - any <a>valid Contact resource</a>. - </p> - - <p> - A <dfn>valid media type</dfn> will be one of the following web resource MIME types: - </p> - - <ul> - <li><code>text/vcard</code></li> - <li><code>text/x-vcard</code></li> - <li><code>text/directory</code></li> - <li><code>text/directory;profile=vCard</code></li> - </ul> - - <p> - On invocation of a <a>valid Contact resource</a>, the <a>user agent</a> should, on successful download - of the <a>valid Contact resource</a>, store the given resource in the user's unified address book - according to the <a>rule for storing a Contact resource</a>. As part of this standard download process, - the <a>user agent</a> may present a dialog to the user allowing them to select a different application - with which to handle the given resource, thereby overriding the use of the unified address book for the - storage of the data contained therein and bypassing the <a>rule for storing a Contact resource</a>. - </p> - - <p> - The <dfn>rule for storing a Contact resource</dfn> is defined as follows: - </p> - - <p> - Let <var>Contact</var> be the parsed key/value pairs contained in the <a>valid Contact - resource</a>. - </p> - - <ol> - <li>If <var>Contact</var> contains a <code>UID</code> key then process the <a>valid Contact - resource</a> as follows. - - <ol> - <li>Let <var>MatchedContact</var> be the result of obtaining a Contact object from the user's - unified address book that matches exactly the value of the <code>UID</code> provided.</li> - - <li>If a <var>MatchedContact</var> has been found (i.e. <var>MatchedContact</var> is - not-<code>null</code>) then update the contents of <var>MatchedContact</var> with the contents of - <var>Contact</var> and exit this rule.</li> - </ol> - </li> - - <li>Save the contents of <var>Contact</var> in the user's unified address book as a new Contact - object.</li> - </ol> - - <p> - As part of the <a>rule for storing a Contact resource</a>, the <a>user agent</a> may provide - additional dialogs to the user after successful completion of the download and before the Contact - information is saved to the unified address book, such as to show a preview of the Contact information - contained therein as it will be stored in the user's unified address book. The user may be able to - override the information provided before accepting the additions and permanently storing the given data - in their unified address book. - </p> - - <section class="informative"> - <h4>Adding a new Contact</h4> - - <p> - A web page can dynamically generate a <a>vCard object</a> on the client side for download to the - user's unified address book via either data: URIs [[RFC2397]] or using the [[FILE-WRITER]] and - [[FILE-API]] interfaces. The following examples show two methods for creating a <a>vCard object</a> - dynamically and then presenting this to the user. The user may then save this information by clicking - on the presented information, download the dynamically generated <a>vCard object</a> and invoke a - suitable application with which to handle the dynamic resource. - </p> - - <div class="example"> - <pre class="sh_javascript"> - <a id="vcard">Save our Contact Details</a> - - <script type="text/javascript"> - var vcard = 'BEGIN:VCARD\r\n' + - 'VERSION:2.1\r\n' + - 'N:Doe;John\r\n' + - 'FN:John Doe\r\n' + - 'TEL;WORK;VOICE:123456\r\n' + - 'END:VCARD'; - - // assign vCard as a Data URI to an anchor element for presentation and download by the user - document.getElementById('vcard').href = "data:text/x-vcard;charset=utf-8," + encodeURIComponent( vcard ); - </script> - </pre> - </div> - - <div class="example"> - <pre class="sh_javascript"> - <a id="vcard">Save our Contact Details</a> - - <script type="text/javascript"> - // obtain an ArrayBuffer consisting of valid vCard syntax (out of scope) - var vCardObj = getVCard( /* ... */ ); - - // create a new vCard Blob [[FILE-WRITER]] - var contactBlobBuilder = new BlobBuilder(); - contactBlobBuilder.append( vCardObj ); - var contactBlob = contactBlobBuilder.getBlob( "text/x-vcard" ); - - // obtain a vCard Blob URL [[FILE-API]] - var contactBlobURL = window.URL.createObjectUrl( contactBlob ); - - // assign vCard Blob URL to an anchor element for presentation and download by the user - document.getElementById('vcard').href = contactBlobURL; - </script> - </pre> - </div> - </section> - - <section class="informative"> - <h4>Updating an existing Contact</h4> - - <p> - To update an existing Contact, the user must have already shared the contact information to edit - with the current web page via the <a href='#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options'>find()</a> operation of the <a href= - "#contacts-interface"><code>Contacts</code></a> interface. This section assumes that the user is - already sharing some contact information with the current web page via this process. - </p> - - <p> - If this existing Contact information is to be updated in the user's unified address book then the - developer will assign the <code>id</code> attribute, as returned in the <code>Contact</code> object, as - the <code>UID</code> property of any resulting <a>vCard object</a> to be processed by the <a>user - agent</a> according to the <a>rule for storing a Contact resource</a>. - </p> - - <p> - The examples below show two methods for updating an existing Contact in the user's unified address - book by maintaining a valid UID property while changing other parameters of the Contact card. The user - is then required to click on the resulting anchor element to download the modified Contact - resource. - </p> - - <div class="example"> - <pre class="sh_javascript"> - <a id="vcard">Save our Contact Details</a> - - <script type="text/javascript"> - // Obtain a single existing Contact object resulting from navigator.contacts.find() - var existingContactObj = ...; - - var vcard = 'BEGIN:VCARD\r\n' + - 'VERSION:3.0\r\n' + - 'UID:' + existingContactObj.id + '\r\n' + // assign the Contact.id to a UID property - 'N:Doe;John\r\n' + - 'FN:John Doe\r\n' + - 'TEL;HOME;VOICE:654321\r\n' + - 'END:VCARD'; - - // assign vCard as a Data URI to an anchor element for presentation and download by the user - document.getElementById('vcard').href = "data:text/x-vcard;charset=utf-8," + encodeURIComponent( vcard ); - </script> - </pre> - </div> - - <div class="example"> - <pre class="sh_javascript"> - <a id="vcard">Update our Contact Details</a> - - <script type="text/javascript"> - // Obtain a single existing Contact object resulting from navigator.contacts.find() - var existingContactObj = ...; - - // Modify some parameters as required. e.g. add a new phone number - existingContactObj.phoneNumbers.push({ - type: 'home', - value: '654321' - }); - - // With the existing Contact object, create an ArrayBuffer consisting of valid vCard - // syntax (out of scope) making sure to set the resulting vCard UID property to - // the id parameter returned in the existing Contact object - var vCardObj = getVCard( existingContactObj ); - - // create a new vCard Blob [[FILE-WRITER]] - var contactBlobBuilder = new BlobBuilder(); - contactBlobBuilder.append( vCardObj ); - var contactBlob = contactBlobBuilder.getBlob( "text/x-vcard" ); - - // obtain a vCard Blob URL [[FILE-API]] - var contactBlobURL = window.URL.createObjectUrl( contactBlob ); - - // assign vCard Blob URL to an anchor element for presentation and download by the user - document.getElementById('vcard').href = contactBlobURL; - </script> - </pre> - </div> - </section> - </section> </body> </html> diff -r e42a8962482f -r 56b3039c5f88 gallery/Overview.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gallery/Overview.html Tue Jul 10 11:21:03 2012 -0400 @@ -0,0 +1,520 @@ +<!DOCTYPE html> +<html> + <head> + <title>Pick Media Intent</title> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> + <script type="text/javascript" src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove' async></script> + <script type="text/javascript" class='remove'> + var respecConfig = { + specStatus: "ED", + shortName: "gallery-api", + editors: [{ + name: "송정기(Jungkee Song)", + url: "", + company: "Samsung Electronics Co., Ltd.", + companyURL: "http://www.samsung.com/sec/"}, + {name: "이원석(Wonsuk Lee)", + url: "http://wonsuk73.com/", + company: "Samsung Electronics Co., Ltd.", + companyURL: "http://www.samsung.com/sec/"} + ], + // previousPublishDate: "2012-05-02", + // edEnd: "", + // previousMaturity: "ED", + edDraftURI: "http://w3c-test.org/dap/gallery/", + wg: "Device APIs Working Group", + wgURI: "http://www.w3.org/2009/dap/", + wgPublicList: "public-device-apis", + wgPatentURI: "http://www.w3.org/2004/01/pp-impl/43696/status" + }; + </script> + </head> + <body> + <section id='abstract'> + <p> + The Pick Media Intent defines a Web Intent [[!WEBINTENTS]] that enables + access to a user's media gallery from inside a Web application. It + defines both an Intent action/type pair that selects this operation, + and the format of the media data that is returned by services implementing this specification. + </p> + </section> + + <section id='sotd'> + <p> + This document recasted the previous pure JavaScript APIs version as an API built using Web Intents, while refining the metadata format based on related media data definitions and practical web-based media services. + </p> + </section> + + <section class="informative"> + <h2>Introduction</h2> + <p> + On account of a number of media applications and services accessed from various devices, users tend to maintain their media data in multiple sources including local stroage of devices and web-based media gallleries. For instance, users upload subset of their photos to several different social media galleries with different metadata. For another example, users collect their favorite audio and video resources in several different media galleries which provide inconsistent metadata attributes one another. + </p> + <p class="note"> + A terminology, <b>media object</b>, is used hereunder to denote <b>media data</b> that contain a media content and its related metadata. (See <a>Media</a> dictionary) + </p> + <p> + This specification enables a Web application to have access to a selected subset of user's media objects, obtained from arbitrary services not known to the Web application. The interactions, brokered using Web Intents [[WEBINTENTS]] are designed in order to maximise the user's security and privacy. Media objects may be sourced from a plurality of sources — both online and local to the user's device — so long as those sources are registered as Intent services with the user agent. It defines a common media object format which services use to provide data to Web applications in a consistent and interoperable manner. + </p> + <p> + For a Pick Media Intent request, user permission can be naturally asked by a necessary user authentication process that a service implementer MAY provide. Also, users can determine the result media objects to bring to the client with the searching and selecting functionalities that a service implemeter MAY provide. + </p> + <p> + A set of <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> are + presented for the discretion of both implementers of Pick Media Intent services and recipients of media + data (i.e. Web applications). + </p> + <p> + The following code illustrates how to obtain media object from a user's media gallery: + </p> + <pre class="example highlight"> + var intent = new Intent({ action: "http://webintents.org/pick", + type: "http://w3.org/type/media", + extras: { search: "olympic", + filters: ["title", "description", "author", "tags"], + limit: 100 }}); + navigator.startActivity(intent, mediaOK, mediaFail); + + function mediaOK (mediaObjectArray) { + // iterate over the array of media objects to do something useful with them + } + function mediaFail (err) { + // display an error to the user + } + </pre> + <p> + When the above code is run, the user would typically be prompted by her user agent to select + a service able to pick media objects (there may be several such services, if she has multiple media galleries). Upon selecting a service, she will be presented with an interface enabling her + to choose what media objects are returned to the Web application. Upon completing her + choice, an array of the media objects would be returned to the Web application in the <code>mediaOK</code> + callback. + </p> + </section> + + <section id='conformance'> + <p> + There is only one single conformance requirement placed upon the <dfn>user agent</dfn> + product: a <a>user agent</a> MUST support Web Intents [[!WEBINTENTS]]. + </p> + <p> + The conformance criteria in this specification apply to a single product: the + <dfn>Media service</dfn> which exposes a Web Intent service that + handles Pick Media Intents as defined in this specification. + </p> + <p> + The data returned by the <a>Media service</a> is described in this specification using [[!WEBIDL]]. + When this data is provided using JavaScript, then the <a>Media service</a> MUST do so in a manner + consistent with the ECMAScript Bindings defined in the Web IDL specification. + </p> + </section> + + <section class="informative"> + <h2>Security and Privacy Considerations</h2> + <p> + The Intent defined in this specification can be used to find media objects from user's media galleries. The media objects, in the form of photos, videos, voice recordings with related metadata, may contain user's private information. The distribution of this information could + potentially compromise the user's privacy. A conforming implementation + of this specification should provide a mechanism that protects the user's privacy and this mechanism should ensure that no such information is retrievable without the user's express permission. + </p> + <section> + <h2>Privacy considerations for implementers of the Pick Media Intent</h2> + <p> + A <a>media service</a> should not provide media objects to Web sites without the express + permission of the user. Obtaining the user's express permission to access a set of media objects does + not imply that the user has granted permission for the same Web site to access more media objects. + A <a>media service</a> should take great care to ensure that the user can clearly see which information + is about to be shared, and must not share more information than has been requested by the Web application. + </p> + <p> + A <a>user agent</a> may have prearranged trust relationships with a specific <a>media service</a> + that do not require such user interaction. + </p> + </section> + <section> + <h2>Privacy considerations for recipients of media objects</h2> + <p> + Web sites operators that retrieve media objects using this Intent are denoted as recipients + below. + </p> + <p> + Recipients should only request media objects when necessary, and only use the media objects for the task for which it was provided to them. + </p> + <p> + Recipients should dispose of media objects once that task is completed, unless expressly + permitted to retain it by the user. Recipients should also take measures to protect this information + against unauthorised access. If media objects are stored, users should be allowed to update and + delete this information. + </p> + <p> + The recipient of media objects should not retransmit the media objects without the + user's express permission. Care should be taken when retransmitting and use of encryption is + encouraged. + </p> + <p> + Recipients should clearly and conspicuously disclose the fact that they are collecting media objects, + the purpose of the collection, how long the data is retained, how the data is secured, how the data is + shared if it is shared, how users can access, update and delete the data, and any other choices that + users have with respect to the data. This disclosure should include an explanation of any exceptions to + the guidelines listed above. + </p> + <p> + Note that even if a user gives permission to share their media objects this can have serious + privacy implications for those parties whose media objects are shared, as they may not wish such sharing to + occur. This should be considered by Web applications when requesting and using such information. + </p> + </section> + <section> + <h2>Additional implementation considerations</h2> + <p> + Further to the requirements listed in the previous section, implementers of a <a>user agents</a> are + also advised to consider the following aspects that can negatively affect the privacy of their users: + in certain cases, users can inadvertently grant permission to disclose their media objects + to Web sites. In other cases, the content hosted at a certain URL changes in such a way that the + previously granted permissions no longer apply as far as the user is concerned. Or the users + might simply change their minds. + </p> + <p> + Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive + measures are a <a>user agent</a>'s responsibility and not prescribed by this specification. However, in + designing these measures, implementers are advised to enable user awareness of information sharing, and to + provide easy access to user interfaces that enable revocation of permissions that Web applications have to + access this Intent. + </p> + </section> + </section> + + <section> + <h2>Intent Description</h2> + <p> + The action for this Intent is <code>http://webintents.org/pick</code>. + </p> + <p> + The type for this Intent is <code>http://w3.org/type/media</code>. + </p> + <p> + When a <a>media service</a> is matched for delivery using these action and type, it + MUST respond in one of two ways: + </p> + <ul> + <li> + If media objects have been successfully selected for delivery, then a successful payload is returned + to the client (using <code>postResult()</code>) matching the data format defined below. + </li> + <li> + If an error of any kind takes place in the service, then an error payload is returned (using + <code>postFailure()</code>) matching the error data format defined below. The <a>media service</a> + MUST NOT treat the user selecting zero media object or cancelling the service as error conditions. + </li> + </ul> + <section> + <h2>Intent Extras</h2> + <p> + The Pick Media Intent can be instantiated with an <code>extras</code> field that adheres to the + following dictionary. + </p> + <section> + <h2>The <a>MediaIntentExtras</a> dictionary</h2> + <p> + The <a>MediaIntentExtras</a> dictionary describes the options that the invoker can inform to the service as hints in searching the media objects. None of the fields are mandatory. + </p> + <dl title='dictionary MediaIntentExtras' class='idl'> + <dt>DOMString? search</dt> + <dd> + A string which provides a hint to the <a>media service</a> to search media objects. + The exact manner in which this hint is exploited is entirely up to the <a>media service</a>. + </dd> + <dt>DOMString[]? filters</dt> + <dd> + An array of string which contain hints to the <a>media service</a> to the DOMString and DOMString[] fields in the <a>Media</a> dictionary that + the Web application prefers to use as search criteria. The <a>media service</a> MAY + use the values of the <a>filters</a> to search media objects in the media gallery. If a filter name is provided that the <a>media service</a> does not recognise as a field + of the <a>Media</a> dictionary, then it MUST ignore it. + </dd> + <dt>unsigned long? limit</dt> + <dd> + By default a <a>media service</a> MAY return as many media objects as the user selects. If <code>limit</code> + is specified, the <a>media service</a> MUST NOT return more than <code>limit</code> media objects. The + <a>media service</a> SHOULD enforce this limitation in the user interface that it exposes. + </dd> + </dl> + </section> + </section> + </section> + <section> + <h2>Data Format</h2> + <p> + Upon successful invocation, the <a>media service</a> MUST return an array of <a>Media</a> dictionaries. + </p> + <section> + <h2>The <a>Media</a> dictionary</h2> + <p> + The <a>Media</a> dictionary captures the properties of a media object. The properties defined in this dictionary present the content (URI by default and Blob as option) of the media data and the related metadata. The properties of the dictionary are defined based on the previous work of metadata survey in Media Ontology WG, the <a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">core set</a>, [[MEDIA-ANNOT-REQS]] as well as the common attributes of open APIs provided by typical web-based media services, thereby allowing the data format to be supported across implementations supporting these various media metadata representations. + </p> + <p> + Additional attributes MAY be included according to the provisions detailed in + <a href="#extended-media-properties-and-parameters">Extended Media Properties and Parameters</a>. + </p> + <dl title='dictionary Media' class='idl'> + <dt>MediaContent content</dt> + <dd> + A dictionary containing a URI to the content of the media resource. It optionally contains a Blob of the content. + </dd> + <dt>DOMString description</dt> + <dd> + The text description of the content of the media resource. + </dd> + <dt>DOMString? id</dt> + <dd> + <p> + A URI identifying a media resource. + </p> + <p class="note"> + The property, identifier, defined in the core set of [<a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">Ontology for Media Resources 1.0</a>] can be considered as a representation format. + </p> + </dd> + <dt>DOMString title</dt> + <dd> + The title or name given to the media resource. + </dd> + <dt>DOMString type</dt> + <dd> + The MIME type of the media resource (e.g., image/png, video/*) [[RFC2046]]. + </dd> + <dt>DOMString? author</dt> + <dd> + The author of the media resource in string. + </dd> + <dt>DOMString? category</dt> + <dd> + The category (genre) of the content of the media resource. + </dd> + <dt>DOMString? copyright</dt> + <dd> + The copyright statement associated with the media resource. + </dd> + <dt>DOMString? fileName</dt> + <dd> + This field's value is not a url, but is the filename (probably not fully qualified, but simply the name of the leaf file) of the resource being passed as assigned by the user. (See <a href="http://www.w3.org/wiki/WebIntents/MIME_Types">WebIntents/MIME Types</a>) + </dd> + <dt>unsigned long? fileSize</dt> + <dd> + The size of the content of the media resource. + </dd> + <dt>Position? location</dt> + <dd> + The location information related to the content of the media resource. [[GEOLOCATION-API]] + </dd> + <dt>DOMString[]? tags</dt> + <dd> + <p> + The array of strings representing series of tag string. + </p> + </dd> + <dt>MediaContent? thumbnail</dt> + <dd> + A dictionary containing a URI to the thumbnail of the content of the media resource. It optionally contains a Blob of the thumbnail of the content. + </dd> + <dt>Date? createdDate</dt> + <dd> + <p> + The creation date of the media resource in Date type. + </p> + </dd> + <dt>Date? updatedDate</dt> + <dd> + <p> + The last updated date of the media resource in Date type. + </p> + </dd> + <dt>DOMString? collection</dt> + <dd> + <p> + The name of the collection or album that the media resource belongs to. + </p> + </dd> + <dt>unsigned long? duration</dt> + <dd> + <p> + The actual duration of the resource. The units are defined to be seconds. + </p> + </dd> + <dt>unsigned long? frameRate</dt> + <dd> + <p> + The video frame rate. The units are defined to be frames per second. + </p> + </dd> + <dt>DOMString? language</dt> + <dd> + <p> + The language used in the media resource. + </p> + </dd> + <dt>unsigned long? likeCount</dt> + <dd> + <p> + The count of the vote in favor of the media resource. + </p> + </dd> + <dt>float? rating</dt> + <dd> + <p> + The rating value (e.g., customer rating, review, audience appreciation) of the media resource. + </p> + </dd> + <dt>unsigned long? ratingCount</dt> + <dd> + <p> + The number of ratings made on the media resource. + </p> + </dd> + <dt>DOMString? resolution</dt> + <dd> + <p> + The frame size of the resource (e.g., width and height of 720 and 480 in px is represented as 720*480+px). + </p> + <p class="note"> + If the usage of this property is frequent, a seperate dictionary can be defined refering to frameSize property defined in [<a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">Ontology for Media Resources 1.0</a>] + </p> + </dd> + <dt>unsigned long? samplingRate</dt> + <dd> + <p> + The audio sampling rate. The units are defined to be samples per second. + </p> + </dd> + <dt>Date? publishedDate</dt> + <dd> + <p> + The publishing date of the media resource in Date type. + </p> + </dd> + <dt>DOMString? publisher</dt> + <dd> + <p> + The publisher of the media resource. + </p> + </dd> + <dt>unsigned long? viewCount</dt> + <dd> + <p> + The access count made on the media resource. + </p> + </dd> + </dl> + </section> + + <section> + <h2>The <a>MediaContent</a> dictionary</h2> + <p> + The <a>MediaContent</a> dictionary describes a media content reference in detail. + </p> + <dl title='dictionary MediaContent' class='idl'> + <dt>DOMString uri</dt> + <dd> + The URI to the content of the media resource. This attribute is a mandatory property. + </dd> + <dt>Blob? blob</dt> + <dd> + The optional property to contain the media content in Blob format. + </dd> + </dl> + </section> + + <section> + <h2>The <a>MeidaError</a> dictionary</h2> + <p> + If the <a>media service</a> encounters an error then it MUST return an error + (through <code>postFailure()</code>) using the <a>MediaError</a> dictionary. + </p> + <dl title='dictionary MediaError' class='idl'> + <dt>DOMString message</dt> + <dd>A message describing the error.</dd> + </dl> + </section> + <section> + <h2>Extended Media Properties and Parameters</h2> + <p> + A <a>media service</a> MAY extend the dictionaries described in in the Data Formats section with + additional fields. If providing an extended field, a <a>media service</a> MUST prefix its name + with <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix. + </p> + </section> + </section> + <section class="informative appendix"> + <h2>Media Service Example</h2> + + <p> + This section describes an example usage of the Pick Media Intent in media service. It shows the use of the values delivered through <a>MediaIntentExtras</a> dictionary, and the way to return the result array of media objects through <a>Media</a> dictionary. + </p> + + <section> + <h3>Accessing <a>MediaIntentExtras</a> Values - Example #1</h3> + + <p> + Media service implementers can retrieve the values delivered in extra field of the intent request. The extra field contains the MediaIntentExtras dictionary: + </p> + <div class='example'> + <pre class="sh_javascript"> + <script type="text/javascript"> + if (window.intent) { + var keyword = window.intent.extra.search; // a string based hint to search + var filters = window.intent.extra.filters; // DOMString[] based hint to fields to match + var limit = window.intent.extra.limit; // maximum number of objects to return + + // do search relevant media objects based on the extras + var mediaObjectArray = searchMediaobjects(keyword, filters, limit); + + if (mediaObjectArray) { + window.intent.postResult(mediaObjectArray); + } else { + window.intent.postFailure(errorMessage); + } + } + </script> + </pre> + </div> + + <p> + The use of the properties in MediaIntentExtras dictionary is optional. Service implementers can decide whether these properties are to be used as hints for search. + </p> + </section> + + <section> + <h3>Creating Media Object - Example #2</h3> + + <p> + Media service implementers can create media objects in the format of the Media dictionary and make an array of media objects to send to client. (using <code>postResult()</code>): + </p> + + <div class='example'> + <pre class="sh_javascript"> + <script type="text/javascript"> + if (window.intent) { + var content = {}; + content.uri = "http://example.com/gallery/image00001.png"; + + var mediaObject = new Object(); + mediaObject.content = content; + mediaObject.description = "The city view of Seoul"; + mediaObject.id = ""; + mediaObject.title = "City of Seoul"; + mediaObject.type = "image/png"; // MIME type of the media content + mediaObject.author = "J."; + + var mediaObjectArray = new Array(); + + mediaObjectArray[0] = mediaObject; + + if (mediaObjectArray) { + window.intent.postResult(mediaObjectArray); + } else { + window.intent.postFailure(errorMessage); + } + } + </script> + </pre> + </div> + </section> + </section> + </body> +</html> diff -r e42a8962482f -r 56b3039c5f88 gallery/index.html --- a/gallery/index.html Mon Jul 09 09:59:54 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,715 +0,0 @@ -<!DOCTYPE html> -<!-- saved from url=(0035)http://dev.w3.org/2009/dap/gallery/ --> -<html lang="en" dir="ltr"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <title>The Gallery API</title> - -<style type="text/css"> -/***************************************************************** - * ReSpec CSS - * Robin Berjon (robin at berjon dot com) - * v0.05 - 2009-07-31 - *****************************************************************/ - - -/* --- INLINES --- */ -em.rfc2119 { - text-transform: lowercase; - font-variant: small-caps; - font-style: normal; - color: #900; -} - -h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym, -h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr { - border: none; -} - -dfn { - font-weight: bold; -} - -a.internalDFN { - color: inherit; - border-bottom: 1px solid #99c; - text-decoration: none; -} - -a.externalDFN { - color: inherit; - border-bottom: 1px dotted #ccc; - text-decoration: none; -} - -a.bibref { - text-decoration: none; -} - -code { - color: #ff4500; -} - - -/* --- WEB IDL --- */ -pre.idl { - border-top: 1px solid #90b8de; - border-bottom: 1px solid #90b8de; - padding: 1em; - line-height: 120%; -} - -pre.idl::before { - content: "WebIDL"; - display: block; - width: 150px; - background: #90b8de; - color: #fff; - font-family: initial; - padding: 3px; - font-weight: bold; - margin: -1em 0 1em -1em; -} - -.idlType { - color: #ff4500; - font-weight: bold; - text-decoration: none; -} - -/*.idlModule*/ -/*.idlModuleID*/ -/*.idlInterface*/ -.idlInterfaceID, .idlDictionaryID { - font-weight: bold; - color: #005a9c; -} - -.idlSuperclass { - font-style: italic; - color: #005a9c; -} - -/*.idlAttribute*/ -.idlAttrType, .idlFieldType, .idlMemberType { - color: #005a9c; -} -.idlAttrName, .idlFieldName, .idlMemberName { - color: #ff4500; -} -.idlAttrName a, .idlFieldName a, .idlMemberName a { - color: #ff4500; - border-bottom: 1px dotted #ff4500; - text-decoration: none; -} - -/*.idlMethod*/ -.idlMethType { - color: #005a9c; -} -.idlMethName { - color: #ff4500; -} -.idlMethName a { - color: #ff4500; - border-bottom: 1px dotted #ff4500; - text-decoration: none; -} - -/*.idlParam*/ -.idlParamType { - color: #005a9c; -} -.idlParamName { - font-style: italic; -} - -.extAttr { - color: #666; -} - -/*.idlConst*/ -.idlConstType { - color: #005a9c; -} -.idlConstName { - color: #ff4500; -} -.idlConstName a { - color: #ff4500; - border-bottom: 1px dotted #ff4500; - text-decoration: none; -} - -/*.idlException*/ -.idlExceptionID { - font-weight: bold; - color: #c00; -} - -.idlTypedefID, .idlTypedefType { - color: #005a9c; -} - -.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code { - color: #c00; - font-weight: normal; -} - -.excName a { - font-family: monospace; -} - -.idlRaises a.idlType, .excName a.idlType { - border-bottom: 1px dotted #c00; -} - -.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse { - width: 45px; - text-align: center; -} -.excGetSetTrue, .prmNullTrue, .prmOptTrue { color: #0c0; } -.excGetSetFalse, .prmNullFalse, .prmOptFalse { color: #c00; } - -.idlImplements a { - font-weight: bold; -} - -dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members { - margin-left: 2em; -} - -.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt { - font-weight: normal; -} - -.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code { - font-weight: bold; - color: #000; - font-family: monospace; -} - -.attributes dt code, .fields dt code, .dictionary-members dt code { - background: #ffffd2; -} - -.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code { - color: #005a9c; - background: transparent; - font-family: inherit; - font-weight: normal; - font-style: italic; -} - -.methods dt code { - background: #d9e6f8; -} - -.constants dt code { - background: #ddffd2; -} - -.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd { - margin-bottom: 1em; -} - -table.parameters, table.exceptions { - border-spacing: 0; - border-collapse: collapse; - margin: 0.5em 0; - width: 100%; -} -table.parameters { border-bottom: 1px solid #90b8de; } -table.exceptions { border-bottom: 1px solid #deb890; } - -.parameters th, .exceptions th { - color: #fff; - padding: 3px 5px; - text-align: left; - font-family: initial; - font-weight: normal; - text-shadow: #666 1px 1px 0; -} -.parameters th { background: #90b8de; } -.exceptions th { background: #deb890; } - -.parameters td, .exceptions td { - padding: 3px 10px; - border-top: 1px solid #ddd; - vertical-align: top; -} - -.parameters tr:first-child td, .exceptions tr:first-child td { - border-top: none; -} - -.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName { - width: 100px; -} - -.parameters td.prmType { - width: 120px; -} - -table.exceptions table { - border-spacing: 0; - border-collapse: collapse; - width: 100%; -} - -/* --- TOC --- */ -.toc a { - text-decoration: none; -} - -a .secno { - color: #000; -} - -/* --- TABLE --- */ -table.simple { - border-spacing: 0; - border-collapse: collapse; - border-bottom: 3px solid #005a9c; -} - -.simple th { - background: #005a9c; - color: #fff; - padding: 3px 5px; - text-align: left; -} - -.simple th[scope="row"] { - background: inherit; - color: inherit; - border-top: 1px solid #ddd; -} - -.simple td { - padding: 3px 10px; - border-top: 1px solid #ddd; -} - -.simple tr:nth-child(even) { - background: #f0f6ff; -} - -/* --- DL --- */ -.section dd > p:first-child { - margin-top: 0; -} - -.section dd > p:last-child { - margin-bottom: 0; -} - -.section dd { - margin-bottom: 1em; -} - -.section dl.attrs dd, .section dl.eldef dd { - margin-bottom: 0; -} - -/* --- EXAMPLES --- */ -pre.example { - border-top: 1px solid #ff4500; - border-bottom: 1px solid #ff4500; - padding: 1em; - margin-top: 1em; -} - -pre.example::before { - content: "Example"; - display: block; - width: 150px; - background: #ff4500; - color: #fff; - font-family: initial; - padding: 3px; - font-weight: bold; - margin: -1em 0 1em -1em; -} - -/* --- EDITORIAL NOTES --- */ -.issue { - padding: 1em; - margin: 1em 0em 0em; - border: 1px solid #f00; - background: #ffc; -} - -.issue::before { - content: "Issue"; - display: block; - width: 150px; - margin: -1.5em 0 0.5em 0; - font-weight: bold; - border: 1px solid #f00; - background: #fff; - padding: 3px 1em; -} - -.note { - margin: 1em 0em 0em; - padding: 1em; - border: 2px solid #cff6d9; - background: #e2fff0; -} - -.note::before { - content: "Note"; - display: block; - width: 150px; - margin: -1.5em 0 0.5em 0; - font-weight: bold; - border: 1px solid #cff6d9; - background: #fff; - padding: 3px 1em; -} - -/* --- Best Practices --- */ -div.practice { - border: solid #bebebe 1px; - margin: 2em 1em 1em 2em; -} - -span.practicelab { - margin: 1.5em 0.5em 1em 1em; - font-weight: bold; - font-style: italic; -} - -span.practicelab { background: #dfffff; } - -span.practicelab { - position: relative; - padding: 0 0.5em; - top: -1.5em; -} - -p.practicedesc { - margin: 1.5em 0.5em 1em 1em; -} - -@media screen { - p.practicedesc { - position: relative; - top: -2em; - padding: 0; - margin: 1.5em 0.5em -1em 1em; - } -} - -/* --- SYNTAX HIGHLIGHTING --- */ -pre.sh_sourceCode { - background-color: white; - color: black; - font-style: normal; - font-weight: normal; -} - -pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; } /* language keywords */ -pre.sh_sourceCode .sh_type { color: #666; } /* basic types */ -pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */ -pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */ -pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */ -pre.sh_sourceCode .sh_specialchar { color: #ffc0cb; font-family: monospace; } /* e.g., \n, \t, \\ */ -pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; } /* comments */ -pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */ -pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; } /* e.g., #include, import */ -pre.sh_sourceCode .sh_symbol { color: blue; } /* e.g., *, + */ -pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */ -pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */ -pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; } /* TODO and FIXME */ - -/* Predefined variables and functions (for instance glsl) */ -pre.sh_sourceCode .sh_predef_var { color: #00008B; } -pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; } - -/* for OOP */ -pre.sh_sourceCode .sh_classname { color: teal; } - -/* line numbers (not yet implemented) */ -pre.sh_sourceCode .sh_linenum { display: none; } - -/* Internet related */ -pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; } - -/* for ChangeLog and Log files */ -pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; } -pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; } -pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; } - -/* for Prolog, Perl... */ -pre.sh_sourceCode .sh_variable { color: #006400; } - -/* for LaTeX */ -pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; } -pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; } -pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; } -pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; } -pre.sh_sourceCode .sh_argument { color: #006400; } -pre.sh_sourceCode .sh_optionalargument { color: purple; } -pre.sh_sourceCode .sh_math { color: orange; } -pre.sh_sourceCode .sh_bibtex { color: blue; } - -/* for diffs */ -pre.sh_sourceCode .sh_oldfile { color: orange; } -pre.sh_sourceCode .sh_newfile { color: #006400; } -pre.sh_sourceCode .sh_difflines { color: blue; } - -/* for css */ -pre.sh_sourceCode .sh_selector { color: purple; } -pre.sh_sourceCode .sh_property { color: blue; } -pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; } - -/* other */ -pre.sh_sourceCode .sh_section { color: black; font-weight: bold; } -pre.sh_sourceCode .sh_paren { color: red; } -pre.sh_sourceCode .sh_attribute { color: #006400; } - -</style><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css" charset="utf-8"></head> - -<body style="display: inherit; "><div class="head"><p><a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a></p><h1 class="title" id="title">The Gallery <acronym title="Application Programming Interface">API</acronym></h1><h2 id="w3c-editor-s-draft-02-may-2012"><acronym title="World Wide Web Consortium">W3C</acronym> Editor's Draft 02 May 2012</h2><dl><dt>This version:</dt><dd><a href="http://dev.w3.org/2009/dap/gallery/">http://dev.w3.org/2009/dap/gallery/</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/gallery/">http://www.w3.org/TR/gallery/</a></dd><dt>Latest editor's draft:</dt><dd><a href="http://dev.w3.org/2009/dap/gallery/">http://dev.w3.org/2009/dap/gallery/</a></dd><dt>Previous version:</dt><dd>none</dd><dt>Editors:</dt> -<dd><span>송정기(Jungkee Song)</span>, <a href="http://www.samsung.com/sec/">Samsung Electronics Co., Ltd.</a></dd> -<dd><span>이원석(Wonsuk Lee)</span>, <a href="http://www.samsung.com/sec/">Samsung Electronics Co., Ltd.</a></dd> -</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2012 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. <acronym title="World Wide Web Consortium">W3C</acronym> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p><hr></div> - -<div id="abstract" class="introductory section"><h2>Abstract</h2><p>This specification defines a mechanism to pick and search media (image, video, audio) contents along with related metadata from media galleries.<br><br> - This specification uses Web Intents to find and locate the registered galleries. -</p></div><div id="sotd" class="introductory section"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym> technical reports index</a> at http://www.w3.org/TR/.</em></p><p>This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as an Editor's Draft. If you wish to make comments regarding this document, please send them to <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>). All feedback is welcome.</p><p>Publication as an Edtor's Draft does not imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>. <acronym title="World Wide Web Consortium">W3C</acronym> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the inforation in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.</p></div> - <div id="toc" class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc"> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#conformance" class="tocxref"><span class="secno">1. </span>Conformance</a></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#introduction" class="tocxref"><span class="secno">2. </span>Introduction</a><ul class="toc"> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#usage-examples" class="tocxref"><span class="secno">2.1 </span>Usage Examples</a></li></ul></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#api-description" class="tocxref"><span class="secno">3. </span><acronym title="Application Programming Interface">API</acronym> Description</a><ul class="toc"> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#media-object" class="tocxref"><span class="secno">3.1 </span><code>MediaObject</code> dictionary</a><ul class="toc"> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#attributes" class="tocxref"><span class="secno">3.1.1 </span>Dictionary <code>MediaObject</code> Members</a></li> - </ul></li></ul></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#use-cases-and-requirements" class="tocxref"><span class="secno">4. </span>Use Cases and Requirements</a><ul class="toc"> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#use-cases" class="tocxref"><span class="secno">4.1 </span>Use Cases</a></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#requirements" class="tocxref"><span class="secno">4.2 </span>Requirements</a></li></ul></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#related-documents" class="tocxref"><span class="secno">A. </span>Related documents</a></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#features-for-future-consideration" class="tocxref"><span class="secno">B. </span>Features for Future Consideration</a></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#acknowledgements" class="tocxref"><span class="secno">C. </span>Acknowledgements</a></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#references" class="tocxref"><span class="secno">D. </span>References</a><ul class="toc"> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#normative-references" class="tocxref"><span class="secno">D.1 </span>Normative references</a></li> - <li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#informative-references" class="tocxref"><span class="secno">D.2 </span>Informative references</a></li></ul></li></ul> - </div> - -<div id="conformance" class="section"><!--OddPage--><h2><span class="secno">1. </span>Conformance</h2><p>As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.</p> -<p>The key words <em class="rfc2119" title="must">must</em>, <em class="rfc2119" title="must not">must not</em>, <em class="rfc2119" title="required">required</em>, <em class="rfc2119" title="should">should</em>, <em class="rfc2119" title="should not">should not</em>, <em class="rfc2119" title="recommended">recommended</em>, <em class="rfc2119" title="may">may</em>, and <em class="rfc2119" title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class="bibref" rel="biblioentry" href="http://dev.w3.org/2009/dap/gallery/#bib-RFC2119">RFC2119</a></cite>].</p> - -</div> - -<div class="informative section" id="introduction"> - - <!--OddPage--><h2><span class="secno">2. </span>Introduction</h2><p><em>This section is non-normative.</em></p> - <p>The Gallery <acronym title="Application Programming Interface">API</acronym> defines a high-level interface for accessing media gallery located on the device. A media gallery is a collection of media objects such as video, audio and image. </p> - <p class="note">To achieve the simplicity in the browser level context, this specification defines only the read-only functionalities.</p> - <div id="usage-examples" class="section"> - <h3><span class="secno">2.1 </span>Usage Examples</h3> - <p>The following code shows how to work with the gallery <acronym title="Application Programming Interface">API</acronym>.</p> - <p>Example of a image gallery service. The code registers a pick action for image pick service:</p> - <div> - <pre class="example"><html> -<head> -<meta charset='utf-8' /> -<title>Image Gallery Service</title> -<intent action=”http://webintents.org/pick” - type=”image/*” - href=”http://example.org/ImageService/” - title=”Example Image Service” /> -</head> - </pre> - </div> - <p>A web application start a Web Intent request to pick images from registered galleries.</p> - <div> - <pre class="example sh_javascript_dom sh_sourceCode"><span class="sh_comment">// Client-ends request media service using Web Intents <b>pick</b> action</span> -<span class="sh_comment">// The request of <b>image</b> pick service</span> - -<span class="sh_keyword">var</span> intent <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_predef_func">Intent</span><span class="sh_symbol">({</span> - action<span class="sh_symbol">:</span> <span class="sh_string">"http://webintents.org/pick"</span><span class="sh_symbol">,</span> - type<span class="sh_symbol">:</span> <span class="sh_string">"image/*"</span><span class="sh_symbol">,</span> - extras<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> filter<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> name<span class="sh_symbol">:</span> <span class="sh_string">"Seoul"</span> <span class="sh_symbol">},</span> multiple<span class="sh_symbol">:</span> <span class="sh_predef_var">true</span> <span class="sh_symbol">}</span> - <span class="sh_symbol">});</span> - -navigator<span class="sh_symbol">.</span><span class="sh_predef_func">startActivity</span><span class="sh_symbol">(</span>intent<span class="sh_symbol">,</span> galleryResponse<span class="sh_symbol">);</span> - -<span class="sh_keyword">function</span> <span class="sh_predef_func">galleryResponse</span><span class="sh_symbol">(</span>data<span class="sh_symbol">)</span> <span class="sh_symbol">{</span> - <span class="sh_comment">// Parse data encoded in an array of objects</span> -<span class="sh_symbol">}</span></pre> - </div> - <p>Example of a video gallery service. The code registers a pick action for video pick service:</p> - <div> - <pre class="example"><html> -<head> -<meta charset='utf-8' /> -<title>Video Gallery Service</title> -<intent action=”http://webintents.org/pick” - type=”video/*” - href=”http://example.org/VideoService/” - title=”Example Video Service” /> -</head> - </pre> - </div> - <p>A web application start a Web Intent request to pick videos from registered galleries.</p> - <div> - <pre class="example sh_javascript_dom sh_sourceCode"><span class="sh_comment">// Client-ends request media service using Web Intents <b>pick</b> action</span> -<span class="sh_comment">// The request of <b>video</b> pick service</span> - -<span class="sh_keyword">var</span> intent <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_predef_func">Intent</span><span class="sh_symbol">({</span> - action<span class="sh_symbol">:</span> <span class="sh_string">"http://webintents.org/pick"</span><span class="sh_symbol">,</span> - type<span class="sh_symbol">:</span> <span class="sh_string">"video/*"</span><span class="sh_symbol">,</span> - extras<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> filter<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> name<span class="sh_symbol">:</span> <span class="sh_string">"Family"</span> <span class="sh_symbol">},</span> multiple<span class="sh_symbol">:</span> <span class="sh_predef_var">true</span> <span class="sh_symbol">}</span> - <span class="sh_symbol">});</span> - -navigator<span class="sh_symbol">.</span><span class="sh_predef_func">startActivity</span><span class="sh_symbol">(</span>intent<span class="sh_symbol">,</span> galleryResponse<span class="sh_symbol">);</span> - -<span class="sh_keyword">function</span> <span class="sh_predef_func">galleryResponse</span><span class="sh_symbol">(</span>data<span class="sh_symbol">)</span> <span class="sh_symbol">{</span> - <span class="sh_comment">// Parse data encoded in an array of objects</span> -<span class="sh_symbol">}</span></pre> - </div> - <p>Example of a audio gallery service. The code registers a pick action for audio pick service:</p> - <div> - <pre class="example"><html> -<head> -<meta charset='utf-8' /> -<title>Audio Gallery Service</title> -<intent action=”http://webintents.org/pick” - type=”audio/*” - href=”http://example.org/AudioService/” - title=”Example Audio Service” /> -</head> - </pre> - </div> - <p>A web application start a Web Intent request to pick audios from registered galleries.</p> - <div> - <pre class="example sh_javascript_dom sh_sourceCode"><span class="sh_comment">// Client-ends request media service using Web Intents <b>pick</b> action</span> -<span class="sh_comment">// The request of <b>audio</b> pick service</span> - -<span class="sh_keyword">var</span> intent <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_predef_func">Intent</span><span class="sh_symbol">({</span> - action<span class="sh_symbol">:</span> <span class="sh_string">"http://webintents.org/pick"</span><span class="sh_symbol">,</span> - type<span class="sh_symbol">:</span> <span class="sh_string">"audio/*"</span><span class="sh_symbol">,</span> - extras<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> filter<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> name<span class="sh_symbol">:</span> <span class="sh_string">"Love"</span> <span class="sh_symbol">},</span> multiple<span class="sh_symbol">:</span> <span class="sh_predef_var">true</span> <span class="sh_symbol">}</span> - <span class="sh_symbol">});</span> - -navigator<span class="sh_symbol">.</span><span class="sh_predef_func">startActivity</span><span class="sh_symbol">(</span>intent<span class="sh_symbol">,</span> galleryResponse<span class="sh_symbol">);</span> - -<span class="sh_keyword">function</span> <span class="sh_predef_func">galleryResponse</span><span class="sh_symbol">(</span>data<span class="sh_symbol">)</span> <span class="sh_symbol">{</span> - <span class="sh_comment">// Parse data encoded in an array of objects</span> -<span class="sh_symbol">}</span></pre> - </div> - <p class="note">Mediaobject (ImageObject, VideoObject and AudioObject) in schema.org might be used as type in case Web Intents specification adopts it.</p> - <p class="note">Callback gets an array of objects, data, describing the content. Objects in data, in addition to other metadata fields, have either a url or a content field that would contain a Blob (i.e. the media content.)</p> - </div> -</div> - -<div id="api-description" class="section"> - <!--OddPage--><h2><span class="secno">3. </span><acronym title="Application Programming Interface">API</acronym> Description</h2> - <!--section> - <h2><code>Galleries</code> interface</h2> - <p class="note"> More functions could be taked into account. e.g. How about finding function to the all galleries on the device? </p> - <p><code>Galleries</code> interface offer access to the list of Media Galleries on the device. The number of galleries is dependent on the implementation. - As an example, in a window mobile implementation it might retrieve the gallery located in the directory "\My Documents" and another on located on the memory card.</p> - - - <dl title="[NoInterfaceObject] interface Galleries" class="idl"> - <dt>MediaGalleries getGalleries() </dt> - <dd>Retrieve all galleries located on the device. </dd> - </dl> - </section--> - <div id="media-object" class="section"> - <h3><span class="secno">3.1 </span><code>MediaObject</code> dictionary</h3> - <p>The <code>MediaObject</code> dictionary exposes an object to deliver media contents and related metadata from web galleries and local galleries.</p> - <p class="note">The metadata of the media contens and the search filters are to be defined.</p> - <pre class="idl"><span class="idlDictionary" id="idl-def-MediaObject">dictionary</span> <span class="idlDictionaryID">MediaObject</span> { -<span class="idlMember"> <span class="idlMemberType"><a>readonly attribute any</a></span> <span class="idlMemberName"><a href="#widl-MediaObject-content">content</a></span>;</span> -<span class="idl">};</span> -</pre><div id="attributes" class="section"><h4><span class="secno">3.1.1 </span>Dictionary <a class="idlType" href="#idl-def-MediaObject"><code>MediaObject</code></a> Members</h4><dl class="attributes"><dt id="widl-Gallery-length"><code>content</code> of type <span class="idlAttrType"><a>any</a></span>, readonly</dt><dd>the content of the media object.</dd></dl></div> - <h3><span class="secno">3.2 </span>Discussion</h3> - <p class="note">This section is only for dicussion and will be deleted.</p> - <p> - </p><h4>Content delivery method:</h4> - Which is a better way, using a url or a blob?<br> -<ul><li> a URL (Blob URI is used for local contents: http://www.w3.org/TR/FileAPI/#creating-revoking) - <br> - Advantage: Web application developers do not have to take complex part of blob reception. - <br> - Disadvantage: for remote contents, developers cannot manipulate the contents in script (other than assigning them to image/video/audio element) unless the remote service has enabled CORS. -</li> -<li> a Blob - <br> - Advantage: no matter whether the galleries are remote or local, developers can manipulate the received contents in the same way. - <br> - Disadvantage: When retrieving huge amount of data from the galleries, a naïve implementation might think it needs to download entire contents before exposing blobs. In fact, blob reading can be done, through FileReader, on demand. (FileReader even provides Progress Events, but it does require an implementation of Blob that supports this sort of usage.) -</li></ul> - - <p></p> - <p> - </p><h4><em>extra</em> attribute in Web Intents request</h4> - When extra attribute is not given, the request is regarded a search for everything and pick just one; when extra is given, the request is regarded as a specific content search. - <p></p> - <p> - </p><h4><em>multiple</em> attribute in <em>extra</em> parameter:</h4> - When set to true, <em>mutiple</em> attribute in <em>extra</em> paramenter means a client wants to retrieve contents from multiple media sources. Search filter should filter what the user sees in the picker, and the user still decides what is returned (which can be everything of course). - <p></p> - <br> - -<div id="use-cases-and-requirements" class="section"> - <!--OddPage--><h2><span class="secno">4. </span>Use Cases and Requirements</h2> - <div id="use-cases" class="section"> - <h3><span class="secno">4.1 </span>Use Cases</h3> - <p> - </p><h4 id="uc1">Picking image:</h4> - A user picks an image or a set of images either from web galleries (e.g. Flickr, Piscasa, etc.) or from local gallery. - <p></p> - <p> - </p><h4 id="uc2">Picking video:</h4> - A user picks a video or a set of videos either from web galleries (e.g. YouTube, DailyMotion, etc.) or from local gallery. - <p></p> - <p> - </p><h4 id="uc3">Picking audio:</h4> - A user picks an audio or a set of audio either from web galleries (e.g. SoundCloud, Last.fm, etc.) or from local gallery. - <p></p> - <br> - <p class="note">Advantage: it makes integrating with popular services like Flickr, Youtube, SoundCloud a lot easier.</p> - </div> - <div id="requirements" class="section"> - <h3><span class="secno">4.2 </span>Requirements</h3> - <p>The Gallery <acronym title="Application Programming Interface">API</acronym>: </p> - <ul> - <li><em class="rfc2119" title="must">must</em> provide the ability to list the galleries from available sources (e.g. local storage, memory card and web services such as Flickr, YouTube, SoundCloud, etc.) – by Web Intents</li> - <li><em class="rfc2119" title="must">must</em> provide the ability to enumerate the media objects in the designated gallery.</li> - <li><em class="rfc2119" title="must">must</em> provide the ability to filter the media objects in the designated gallery. i.e. finding content inside a gallery (e.g. date, title, geolocation, etc.)</li> - <li><em class="rfc2119" title="must">must</em> provide the ability to retrieve the metadata of the media objects in the gallery (the metadata format is to be defined later through e.g. the MediaObjects in schema.org or the model in JS, etc.)</li> - </ul> - </div> -</div> - -<div class="appendix section" id="related-documents"> - <!--OddPage--><h2><span class="secno">A. </span>Related documents</h2> - <p>The <acronym title="Application Programming Interface">API</acronym> described in this document took inspiration from the following documents:</p> - <ul> - <li><a href="http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html" name="WebIntents" id="WebIntents">Web Intents</acronym></a> </li> - </ul> -</div> -<div id="features-for-future-consideration" class="section"> - <!--OddPage--><h2><span class="secno">B. </span>Features for Future Consideration</h2> - <p>This is a list of features that have been discussed with respect to this version of the <acronym title="Application Programming Interface">API</acronym> but for which it has been decided that if they are - included it will be in a future revision. </p> - <ul> - <li>...</li> - </ul> -</div> -<div class="appendix section" id="acknowledgements"> - <!--OddPage--><h2><span class="secno">C. </span>Acknowledgements</h2> - <p>Many thanks to Robin Berjon for making our lives so much easier with his cool tool.</p> -</div> - - -<div id="references" class="appendix section"><!--OddPage--><h2><span class="secno">D. </span>References</h2><div id="normative-references" class="section"><h3><span class="secno">D.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-CORE-DEVICE">[A Blob URI]</dt><dd>Arun Ranganathan; Jonas Sicking. <a href="http://www.w3.org/TR/FileAPI/#creating-revoking"><cite>A Blob URI.</cite></a> 20 October 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/FileAPI/#creating-revoking">http://www.w3.org/TR/FileAPI/#creating-revoking</a> -</dd><dt id="bib-RFC2119">[Web Intents]</dt><dd>Greg Billock; James Hawkins; Paul Kinlan. <a href="http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html"><cite>Web Intents.</cite></a> 27 April 2012. W3C Editor's Draft. (Work in progress.) URL: <a href="http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html">http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html</a> -</dd></dl></div><div id="informative-references" class="section"><h3><span class="secno">D.2 </span>Informative references</h3><p>No informative references.</p></div></div></body></html> \ No newline at end of file diff -r e42a8962482f -r 56b3039c5f88 proximity/Overview.html --- a/proximity/Overview.html Mon Jul 09 09:59:54 2012 +0200 +++ b/proximity/Overview.html Tue Jul 10 11:21:03 2012 -0400 @@ -93,9 +93,9 @@ <section> <h2>Terminology</h2> <p> - The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#function"> - Function</a></code> interface represents a function in the scripting - language being used as defined in [[!HTML5]]. + The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler"> + EventHandler</a></code> interface represents a callback used for event + handlers as defined in [[!HTML5]]. </p> <p> The concepts <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task"> @@ -148,7 +148,7 @@ which this specification extends: </p> <dl title="partial interface Window" class="idl"> - <dt>[TreatNonCallableAsNull] attribute Function? ondeviceproximity</dt> + <dt>attribute EventHandler ondeviceproximity</dt> <dd> </dd> </dl> @@ -273,7 +273,7 @@ which this specification extends: </p> <dl title="partial interface Window" class="idl"> - <dt>[TreatNonCallableAsNull] attribute Function? onuserproximity</dt> + <dt>attribute EventHandler onuserproximity</dt> <dd> </dd> </dl> diff -r e42a8962482f -r 56b3039c5f88 proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js Tue Jul 10 11:21:03 2012 -0400 @@ -0,0 +1,333 @@ +/** +* W3C 3-clause BSD License +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* o Redistributions of works must retain the original copyright notice, +* this list of conditions and the following disclaimer. +* +* o Redistributions in binary form must reproduce the original copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* o Neither the name of the W3C nor the names of its contributors may be +* used to endorse or promote products derived from this work without +* specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +**/ + +(function() { + //inheritance tests + test(function() { + var event = new DeviceProximityEvent(''); + assert_true(event instanceof window.DeviceProximityEvent); + }, 'the event is an instance of DeviceProximityEvent'); + + test(function() { + var event = new DeviceProximityEvent(''); + assert_true(event instanceof window.Event); + }, 'the event inherits from Event'); + + //Type attribute tests + test(function() { + assert_throws(TypeError(), function() { + new DeviceProximityEvent(); + }, 'First argument is required, so was expecting a TypeError.'); + }, 'Missing type argument'); + + test(function() { + var event = new DeviceProximityEvent(undefined); + assert_equals(event.type, 'undefined'); + }, 'Event type set to undefined'); + + test(function() { + var event = new DeviceProximityEvent(null); + assert_equals(event.type, 'null'); + }, 'type argument is null'); + + test(function() { + var event = new DeviceProximityEvent(123); + assert_equals(event.type, '123'); + }, 'type argument is number'); + + test(function() { + var event = new DeviceProximityEvent(new Number(123)); + assert_equals(event.type, '123'); + }, 'type argument is Number'); + + test(function() { + var event = new DeviceProximityEvent([]); + assert_equals(event.type, ''); + }, 'type argument is array'); + + test(function() { + var event = new DeviceProximityEvent(new Array()); + assert_equals(event.type, ''); + }, 'type argument is instance of Array'); + + test(function() { + var event = new DeviceProximityEvent(['t', ['e', ['s', ['t']]]]); + assert_equals(event.type, 't,e,s,t'); + }, 'type argument is nested array'); + + test(function() { + var event = new DeviceProximityEvent(Math); + assert_equals(event.type, '[object Math]'); + }, 'type argument is host object'); + + test(function() { + var event = new DeviceProximityEvent(true); + assert_equals(event.type, 'true'); + }, 'type argument is boolean (true)'); + + test(function() { + var event = new DeviceProximityEvent(new Boolean(true)); + assert_equals(event.type, 'true'); + }, 'type argument is instance of boolean'); + + test(function() { + var event = new DeviceProximityEvent(false); + assert_equals(event.type, 'false'); + }, 'type argument is boolean (false)'); + + test(function() { + var event = new DeviceProximityEvent(new Boolean(false)); + assert_equals(event.type, 'false'); + }, ''); + + test(function() { + var event = new DeviceProximityEvent('test'); + assert_equals(event.type, 'test'); + }, 'type argument is instance of boolean (false)'); + + test(function() { + var event = new DeviceProximityEvent(new String('test')); + assert_equals(event.type, 'test'); + }, 'type argument is string'); + + test(function() { + var event = new DeviceProximityEvent(function test() {}); + assert_equals(event.type, 'function test() {}'); + }, 'type argument is function'); + + test(function() { + var event = new DeviceProximityEvent({ + toString: function() { + return '123'; + } + }); + assert_equals(event.type, '123'); + }, 'type argument is complext object, with toString method'); + + test(function() { + assert_throws(TypeError(), function() { + new DeviceProximityEvent({ + toString: function() { + return function() {} + } + }); + }); + }, 'toString is of type function'); + + //test the attributes exist + test(function() { + var event = new DeviceProximityEvent('test'); + assert_own_property(event, 'value', 'must have attribute value'); + }, 'value attribute exist'); + + test(function() { + var event = new DeviceProximityEvent('test'); + assert_own_property(event, 'min', 'must have attribute min'); + }, 'min attribute exist'); + + test(function() { + var event = new DeviceProximityEvent('test'); + assert_own_property(event, 'max', 'must have attribute max'); + }, 'max attribute exist'); + + //test readonly attribute double value; + test(function() { + var event = new DeviceProximityEvent('test'); + assert_readonly(event, 'value', 'readonly attribute value'); + }, 'value attribute is readonly'); + + //test readonly attribute double min + test(function() { + var event = new DeviceProximityEvent('test'); + assert_readonly(event, 'min', 'readonly attribute min'); + }, 'min attribute is readonly'); + + //readonly attribute double max; + test(function() { + var event = new DeviceProximityEvent('test'); + assert_readonly(event, 'max', 'readonly attribute max'); + }, 'max attribute is readonly'); + + + test(function() { + var dic = { + min: 3, + max: 7, + value: 13 + }, + event = new DeviceProximityEvent('test', dic), + props = { + writable: false, + enumerable: true, + configurable: true + }, + eProps = Object.getOwnPropertyDescriptor(event, 'max'), + writable = eProps.writable === props.writable, + enumerable = eProps.enumerable === props.enumerable, + config = eProps.configurable === props.configurable; + assert_true(writable && enumerable && config); + }, 'min props check'); + + test(function() { + //the max attribute + var dic = { + min: 3, + max: 7, + value: 13 + }, + event = new DeviceProximityEvent('test', dic), + props = { + writable: false, + enumerable: true, + configurable: true + }, + eProps = Object.getOwnPropertyDescriptor(event, 'max'), + writable = eProps.writable === props.writable, + enumerable = eProps.enumerable === props.enumerable, + config = eProps.configurable === props.configurable; + + assert_true(writable && enumerable && config); + + }, 'max props check'); + + test(function() { + var dic = { + min: 3, + max: 7, + value: 13 + }, + event = new DeviceProximityEvent('test', dic), + props = { + writable: false, + enumerable: true, + configurable: true + }, + eProps = Object.getOwnPropertyDescriptor(event, 'value'), + writable = eProps.writable === props.writable, + enumerable = eProps.enumerable === props.enumerable, + config = eProps.configurable === props.configurable; + + assert_true(writable && enumerable && config); + }, 'value props check'); + test(function() { + var desc = 'Expected to find ondeviceproximity attribute on window object'; + assert_own_property(window, 'ondeviceproximity', desc); + }, 'ondeviceproximity exists'); + + test(function() { + var desc = 'window.ondeviceproximity must be null'; + assert_equals(window.ondeviceproximity, null, desc); + }, 'ondeviceproximity is null'); + + test(function() { + var desc = 'window.ondeviceproximity did not accept callable object', + func = function() {}; + window.ondeviceproximity = func; + assert_equals(window.ondeviceproximity, func, desc); + }, 'ondeviceproximity is set to function'); + + test(function() { + var desc = 'window.ondeviceproximity did not treat noncallable as null'; + window.ondeviceproximity = function() {}; + window.ondeviceproximity = {}; + assert_equals(window.ondeviceproximity, null, desc); + }, 'treat object as null'); + + test(function() { + var desc = 'window.ondeviceproximity did not treat noncallable as null'; + window.ondeviceproximity = function() {}; + window.ondeviceproximity = { + call: 'test' + }; + assert_equals(window.ondeviceproximity, null, desc); + }, 'treat object with non-callable call property as null'); + + test(function() { + var desc = 'window.ondeviceproximity did not treat noncallable as null', + test = function() {}; + test.call = 'test'; + window.ondeviceproximity = function() {}; + window.ondeviceproximity = test; + assert_equals(window.ondeviceproximity, null, desc); + }, 'treat object with non-callable call property as null'); + + test(function() { + var desc = 'window.ondeviceproximity did not treat noncallable (string) as null'; + window.ondeviceproximity = function() {}; + window.ondeviceproximity = 'string'; + assert_equals(window.ondeviceproximity, null, desc); + }, 'treat string as null'); + + test(function() { + var desc = 'window.ondeviceproximity did not treat noncallable (number) as null'; + window.ondeviceproximity = function() {}; + window.ondeviceproximity = 123; + assert_equals(window.ondeviceproximity, null, desc); + }, 'treat number as null'); + + test(function() { + var desc = 'window.ondeviceproximity did not treat noncallable (undefined) as null'; + window.ondeviceproximity = function() {}; + window.ondeviceproximity = undefined; + assert_equals(window.ondeviceproximity, null, desc); + }, 'treat undefined as null'); + + test(function() { + var desc = 'window.ondeviceproximity did not treat noncallable (array) as null'; + window.ondeviceproximity = function() {}; + window.ondeviceproximity = []; + assert_equals(window.ondeviceproximity, null, desc); + }, 'treat array as null'); + + test(function() { + var desc = 'window.ondeviceproximity did not treat noncallable host object as null'; + window.ondeviceproximity = function() {}; + window.ondeviceproximity = Node; + assert_equals(window.ondeviceproximity, null, desc); + }, 'treat non-callable host object as null'); + + //Async tests + var t = async_test('test if device proximity event recieved'); + window.addEventListener('deviceproximity', function(e) { + t.step(function() { + var msg = 'expected instance of DeviceProximityEvent: '; + assert_true(e instanceof window.DeviceProximityEvent, msg); + }); + t.done(); + }); + + var t2 = async_test('test if user proximity event recieved'); + window.ondeviceproximity = function(e) { + t2.step(function() { + var msg = 'expected instance of DeviceProximityEvent: '; + assert_true(e instanceof window.DeviceProximityEvent, msg); + }); + t2.done(); + }; +})(); diff -r e42a8962482f -r 56b3039c5f88 proximity/tests/submissions/marcos/UserProximityEvent_tests.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proximity/tests/submissions/marcos/UserProximityEvent_tests.js Tue Jul 10 11:21:03 2012 -0400 @@ -0,0 +1,325 @@ +/** +* W3C 3-clause BSD License +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* o Redistributions of works must retain the original copyright notice, +* this list of conditions and the following disclaimer. +* +* o Redistributions in binary form must reproduce the original copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* o Neither the name of the W3C nor the names of its contributors may be +* used to endorse or promote products derived from this work without +* specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +**/ +(function() { + //inheritance tests + test(function() { + var event = new UserProximityEvent(''); + assert_true(event instanceof window.UserProximityEvent); + }, 'the event is an instance of UserProximityEvent'); + + test(function() { + var event = new UserProximityEvent(''); + assert_true(event instanceof window.Event); + }, 'the event inherits from Event'); + + //Type attribute tests + test(function() { + assert_throws(TypeError(), function() { + new UserProximityEvent(); + }, 'First argument is required, so was expecting a TypeError.'); + }, 'Missing type argument'); + + test(function() { + var event = new UserProximityEvent(undefined); + assert_equals(event.type, 'undefined'); + }, 'Event type set to undefined'); + + test(function() { + var event = new UserProximityEvent(null); + assert_equals(event.type, 'null'); + }, 'type argument is null'); + + test(function() { + var event = new UserProximityEvent(123); + assert_equals(event.type, '123'); + }, 'type argument is number'); + + test(function() { + var event = new UserProximityEvent(new Number(123)); + assert_equals(event.type, '123'); + }, 'type argument is Number'); + + test(function() { + var event = new UserProximityEvent([]); + assert_equals(event.type, ''); + }, 'type argument is array'); + + test(function() { + var event = new UserProximityEvent(new Array()); + assert_equals(event.type, ''); + }, 'type argument is instance of Array'); + + test(function() { + var event = new UserProximityEvent(['t', ['e', ['s', ['t']]]]); + assert_equals(event.type, 't,e,s,t'); + }, 'type argument is nested array'); + + test(function() { + var event = new UserProximityEvent(Math); + assert_equals(event.type, '[object Math]'); + }, 'type argument is host object'); + + test(function() { + var event = new UserProximityEvent(true); + assert_equals(event.type, 'true'); + }, 'type argument is boolean (true)'); + + test(function() { + var event = new UserProximityEvent(new Boolean(true)); + assert_equals(event.type, 'true'); + }, 'type argument is instance of boolean'); + + test(function() { + var event = new UserProximityEvent(false); + assert_equals(event.type, 'false'); + }, 'type argument is boolean (false)'); + + test(function() { + var event = new UserProximityEvent(new Boolean(false)); + assert_equals(event.type, 'false'); + }, ''); + + test(function() { + var event = new UserProximityEvent('test'); + assert_equals(event.type, 'test'); + }, 'type argument is instance of boolean (false)'); + + test(function() { + var event = new UserProximityEvent(new String('test')); + assert_equals(event.type, 'test'); + }, 'type argument is string'); + + test(function() { + var event = new UserProximityEvent(function test() {}); + assert_equals(event.type, 'function test() {}'); + }, 'type argument is function'); + + test(function() { + var event = new UserProximityEvent({ + toString: function() { + return '123'; + } + }); + assert_equals(event.type, '123'); + }, 'type argument is complext object, with toString method'); + + test(function() { + assert_throws(TypeError(), function() { + new UserProximityEvent({ + toString: function() { + return function() {} + } + }); + }); + }, 'toString is of type function'); + + //test readonly attribute boolean near; + test(function() { + var event = new UserProximityEvent('test'); + assert_readonly(event, 'near', 'readonly attribute near'); + }, 'near is readonly'); + + test(function() { + var event = new UserProximityEvent('test', { + near: false + }); + assert_equals(event.near, false, 'near set to false'); + }, 'near set to false'); + + test(function() { + var event = new UserProximityEvent('test', { + near: true + }); + assert_equals(event.near, true, 'near set to true'); + }, 'near set to true'); + + test(function() { + var event = new UserProximityEvent('test', { + near: undefined + }); + assert_equals(event.near, false, 'argument is truthy'); + }, 'near set to a falsy object'); + + test(function() { + var event = new UserProximityEvent('test', { + near: null + }); + assert_equals(event.near, false, 'argument is flasy'); + }, 'near set to a falsy object'); + + test(function() { + var event = new UserProximityEvent('test', { + near: 0 + }); + assert_equals(event.near, false, 'argument is flasy'); + }, 'near set to a falsy object'); + + test(function() { + var event = new UserProximityEvent('test', { + near: '' + }); + assert_equals(event.near, false, 'argument is flasy'); + }, 'near set to a falsy object'); + + test(function() { + var event = new UserProximityEvent('test', { + near: '\u0020' + }); + assert_equals(event.near, true, 'argument is truthy'); + }, 'near set to a truthy object'); + + test(function() { + var event = new UserProximityEvent('test', { + near: 1 + }); + assert_equals(event.near, true, 'argument is truthy'); + }, 'near set to a truthy object'); + + test(function() { + var event = new UserProximityEvent('test', { + near: [] + }); + assert_equals(event.near, true, 'argument is truthy'); + }, 'near set to a truthy object'); + + test(function() { + var event = new UserProximityEvent('test', { + near: {} + }); + assert_equals(event.near, true, 'argument is truthy'); + }, 'near set to a truthy object'); + + test(function() { + var dict = { + get test() { + return false; + } + }; + var event = new UserProximityEvent('test', { + near: dict.test + }); + assert_equals(event.near, false, 'explict false'); + }, 'near set to object that resolves to false'); + + test(function() { + var desc = 'Expected to find onuserproximity attribute on window object'; + assert_own_property(window, 'onuserproximity', desc); + }, 'onuserproximity exists'); + + test(function() { + var desc = 'window.onuserproximity must be null'; + assert_equals(window.onuserproximity, null, desc); + }, 'onuserproximity is null'); + + test(function() { + var desc = 'window.onuserproximity did not accept callable object', + func = function() {} + window.onuserproximity = func; + assert_equals(window.onuserproximity, func, desc); + }, 'onuserproximity is set to function'); + + test(function() { + var desc = 'window.onuserproximity did not treat noncallable as null'; + window.onuserproximity = function() {}; + window.onuserproximity = {}; + assert_equals(window.onuserproximity, null, desc); + }, 'treat object as null'); + + test(function() { + var desc = 'window.onuserproximity did not treat noncallable as null'; + window.onuserproximity = function() {}; + window.onuserproximity = { + call: 'test' + }; + assert_equals(window.onuserproximity, null, desc); + }, 'treat object with non-callable call property as null'); + + test(function() { + var desc = 'window.onuserproximity did not treat noncallable as null', + test = function() {}; + test.call = 'test'; + window.onuserproximity = function() {}; + window.onuserproximity = test; + assert_equals(window.onuserproximity, null, desc); + }, 'treat object with non-callable call property as null'); + + test(function() { + var desc = 'window.onuserproximity did not treat noncallable (string) as null'; + window.onuserproximity = function() {}; + window.onuserproximity = 'string'; + assert_equals(window.onuserproximity, null, desc); + }, 'treat string as null'); + + test(function() { + var desc = 'window.onuserproximity did not treat noncallable (number) as null'; + window.onuserproximity = function() {}; + window.onuserproximity = 123; + assert_equals(window.onuserproximity, null, desc); + }, 'treat number as null'); + + test(function() { + var desc = 'window.onuserproximity did not treat noncallable (undefined) as null'; + window.onuserproximity = function() {}; + window.onuserproximity = undefined; + assert_equals(window.onuserproximity, null, desc); + }, 'treat undefined as null'); + + test(function() { + var desc = 'window.onuserproximity did not treat noncallable (array) as null'; + window.onuserproximity = function() {}; + window.onuserproximity = []; + assert_equals(window.onuserproximity, null, desc); + }, 'treat array as null'); + + test(function() { + var desc = 'window.onuserproximity did not treat noncallable host object as null'; + window.onuserproximity = function() {}; + window.onuserproximity = Node; + assert_equals(window.onuserproximity, null, desc); + }, 'treat non-callable host object as null'); + + //Async tests + var t = async_test('test if user proximity event recieved'); + window.addEventListener('userproximity', function(e) { + t.step(function() { + var msg = 'expected instance of UserProximityEvent: '; + assert_true(e instanceof window.UserProximityEvent, msg); + }); + t.done(); + }); + + var t2 = async_test('test if user proximity event recieved'); + window.onuserproximity = function(e) { + t2.step(function() { + var msg = 'expected instance of UserProximityEvent: '; + assert_true(e instanceof window.UserProximityEvent, msg); + }); + t2.done(); + }; +})(); diff -r e42a8962482f -r 56b3039c5f88 proximity/tests/submissions/marcos/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proximity/tests/submissions/marcos/index.html Tue Jul 10 11:21:03 2012 -0400 @@ -0,0 +1,11 @@ +<!doctype html> +<head> +<title>Proximity Events Test Suite</title> +<body> +<h1>Test Suite for Proximity Events</h1> +<div id="log"></div> +<hr> +<p><small>Distributed under both the <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">W3C Test Suite License</a> and the <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution forms</a>.</small></p> +<script src="http://www.w3c-test.org/resources/testharness.js"></script> +<script src="DeviceProximityEvent_tests.js"></script> +<script src="UserProximityEvent_tests.js"></script> \ No newline at end of file diff -r e42a8962482f -r 56b3039c5f88 wi-addendum-local-services/Overview.html --- a/wi-addendum-local-services/Overview.html Mon Jul 09 09:59:54 2012 +0200 +++ b/wi-addendum-local-services/Overview.html Tue Jul 10 11:21:03 2012 -0400 @@ -1,3 +1,4 @@ +<<<<<<< mine <!DOCTYPE html> <html> <head> @@ -576,4 +577,583 @@ </p> </section> </body> -</html> \ No newline at end of file +</html>======= +<!DOCTYPE html> +<html> + <head> + <title>Web Intents Addendum - Local Services</title> + <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/> + <!-- + === NOTA BENE === + For the three scripts below, if your spec resides on dev.w3 you can check them + out in the same tree and use relative links so that they'll work offline, + --> + <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script> + <script class='remove'> + var respecConfig = { + // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED. + specStatus: "ED", + + // the specification's short name, as in http://www.w3.org/TR/short-name/ + shortName: "Web Intents-UPnP addendum", + + // if your specification has a subtitle that goes below the main + // formal title, define it here + // subtitle : "an excellent document", + + // if you wish the publication date to be other than today, set this + // publishDate: "2009-08-06", + + // if the specification's copyright date is a range of years, specify + // the start date here: + // copyrightStart: "2005" + + // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date + // and its maturity status + // previousPublishDate: "1977-03-15", + // previousMaturity: "WD", + + // if there a publicly available Editor's Draft, this is the link + // edDraftURI: "http://dev.w3.org/2009/dap/ReSpec.js/documentation.html", + + // if this is a LCWD, uncomment and set the end of its review period + // lcEnd: "2009-08-05", + + // if you want to have extra CSS, append them to this list + // it is recommended that the respec.css stylesheet be kept + extraCSS: ["http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"], + + // editors, add as many as you like + // only "name" is required + editors: [ + { name: "Claes Nilsson", + company: "Sony Mobile", companyURL: "http://www.sonymobile.com/se/" }, + ], + + // authors, add as many as you like. + // This is optional, uncomment if you have authors as well as editors. + // only "name" is required. Same format as editors. + + //authors: [ + // { name: "Your Name", url: "http://example.org/", + // company: "Your Company", companyURL: "http://example.com/" }, + //], + + // + edDraftURI: "http://w3c-test.org/dap/wi-addendum-local-services/", + + // name of the WG + wg: "DAP/Web Apps Web Intents task force", + + // URI of the public WG page + wgURI: "http://www.w3.org/2009/dap/", + + // name (without the @w3c.org) of the public mailing to which comments are due + wgPublicList: "public-web-intents", + + // URI of the patent status for this WG, for Rec-track documents + // !!!! IMPORTANT !!!! + // This is important for Rec-track documents, do not copy a patent URI from a random + // document unless you know what you're doing. If in doubt ask your friendly neighbourhood + // Team Contact. + wgPatentURI: "", + }; + </script> + </head> + <body> + <section id='abstract'> + This specification is an addendum to Web Intents, [[!WEBINTENTS]], that defines how Web Intents enabled User Agents can discover and communicate + with local Web Intents Services. + </section> + + <section class='informative'> + <h2>Introduction</h2> + <p> + Web Intents,[[!WEBINTENTS]], is a service discovery and light-weight RPC mechanism for web applications. The concept enables rich integration between web applications. + A typical Web Intents scenario is: + </p> + <ol> + <li>Web Intents Services register their intention to handle an action for the user </li> + <li>A web application requests to start an action (share, edit, pick, view, ...)</li> + <li>The user selects which service to handle the action</li> + </ol> + <p> + A Web Intents Service is represented by a web page that declaratively marks itself as providing handling functionality for particular intents. Users register Web Intents Services + by visiting web pages that contain registration markup. + However, the strength of Web Intents is the ability to provide web applications with access to Services residing not only in the cloud but also in local environments. + </p> + <p> + This specification defines optional extensions to Web Intents enabled User Agents to discover and dynamically register local Web Intents + Services. Note that all details of the specific low level protocols used to discover and communicate with the local services are hidden to + the Client Web Applications. + </p> + <p> + The following code illustrates how a web application containing links to videos, can initiate video playback by creating and invoking a "video intent" as defined in [[!WEBINTENTS]]. + This code is the same irrespective of whether the Service executing the intent action is a cloud based Service or a local Service. + </p> + <pre class="example sh_javascript_dom"> + + // Create a new intent +var intent = new Intent( "http://webintents.org/view","video/mp4",{ "src":videoCanvas.src, "img": videoCanvas.poster}); + +// Start intents picker +navigator.startActivity(intent, + // On Result + function(intentData) {console.log("player.html: On Result" + intentData);}, + // On Failure + function(intentData) {console.log("player.html: On Failure" + intentData);}); + </pre> + <p> + The example below briefly describes the steps taken when a Service on a local network, e.g. UPnP or mDNS, device is discovered and selected by + the user. + </p> + + <ol> + <li>Triggered by navigator.startActivity the User Agent will start local network discovery of Web Intents Services.</li> + <li>Replies from Web Intents enabled devices contain a URL to a Web Intents document, containing Web Intents Service registration + markup, in the device. </li> + <li>The Web Intents documents are retrieved by the User Agent and the dynamically registered Services are visible in the Web Intents Service picker. </li> + <li>User selects Service.</li> + <li>User Agent retrieves the Service page from the the Web Intents local network device and invokes it. </li> + <li>The Service page handles the intent. </li> + <li>When handling the intent is finished, the Service page issues window.intent.postResult and closes itself. </li> + </ol> + + </section> + + <section id="conformance"> + <p> + This specification defines conformance criteria that apply to: + <ul> + <li><dfn>UPnP enabled User Agent</dfn>: A <a>UPnP enabled User Agent</a> MUST support Web Intents [[!WEBINTENTS]] and the conformance criteria + stated in this specification. </li> + <li><dfn>UPnP enabled device</dfn>: A <a>UPnP enabled device</a> MUST support [[!UPNP-DEVICEARCH]] and the conformance criteria + stated in this specification. </li> + </ul> + + <p> + TBD definitions of User Agents and devices for other local discovery and communication technologies... + </p> + </p> + <p> + Implementations that use ECMAScript to implement the APIs defined in + this specification must implement them in a manner consistent with the + ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]], + as this specification uses that specification and terminology. + </p> + <section> + <h2>Dependencies</h2> + <p> + This specification relies on the following specifications: + + <dl> + <dt>Web Intents</dt> + <dd>This addendum specification is dependent on and defines optional extensions to the basic Web Intents specification, [[!WEBINTENTS]]. </dd> + <dt>UPnP Device Architecture 1.0</dt> + <dd>This addendum specification is dependent on and defines vendor specific extensions to the UPnP Device Architecture 1.0 specification, [[!UPNP-DEVICEARCH]] </dd> + </dl> + + </p> + </section> + </section> + + <section> + <h2>Terminology</h2> + <p> + Web Intents related terms are used according to section "Terminology" in [[!WEBINTENTS]]. + </p> + + <section> + <h3>UPnP related terms</h3> + <p> + UPnP related terms are used according to [[!UPNP-DEVICEARCH]]. + </p> + <p> + The <a>UPnP enabled User Agent</a> has the role of a <dfn id="dfn-registration">control point</dfn> according to UPnP terminology. + </p> + <p> + The <a>UPnP enabled device</a> discovered by the <a>UPnP enabled User Agent</a> has the roles of <dfn id="dfn-registration">device</dfn> according to UPnP terminology. + </p> + </section> + + <section> + <h3>mDNS related terms</h3> + <p> + TBD... + </p> + </section> + + + </section> + + <section> + + <h2>UPnP adaptation</h2> + + <section> + + <h3><a>UPnP enabled device</a></h3> + + <p> + The <a>UPnP enabled device</a> <em class="rfc2119" title="must">must</em> support this section. + </p> + + <section> + + <h4>UPnP Web Intents serviceType</h4> + + <p> + The <a>UPnP enabled device</a> <em class="rfc2119" title="must">must</em> support the UPnP service which serviceType is the <code>urn:schemas-webintents-org:service:WebIntents:1</code> + as a vendor specific serviceType according to [[!UPNP-DEVICEARCH]]. It is vendor dependent how the <a>UPnP enabled device</a> implements the serviceType, + i.e. a device description of any deviceType could include this serviceType. + </p> + + <p> + The Web Intents serviceType <em class="rfc2119" title="must">must</em> have a dummy state variable, <code>X_State</code> of <code>ui4</code> data type to comform to [[!UPNP-DEVICEARCH]] + which requires one or more state variables in a serviceType. The <code>X_State</code> state variable is not used with a value and is never evented. + </p> + <p> + The Web Intents serviceType has no standard action. + </p> + + <p> + See below for the UPnP Service description document of the Web Intents serviceType. + </p> + + <p align="left"><img src="Example_device_and_service_description_pages/Slide2.png" alt="Service description page" width="600" height="600" ><br> + (<a href="Example_device_and_service_description_pages/Slide2.png">View as PNG</a>) + </p> + + + </section> + + <section> + + <h4>Web Intents specific SSDP headers</h4> + + <p> + The <a>UPnP enabled device</a> <em class="rfc2119" title="must">must</em> support SSDP discovery process based on standard UPnP Discovery extended with 2 additional + SSDP headers for M-SEARCH response and NOTIFY when ST/NT headers are:<code>urn:schemas-webintents-org:service:WebIntents:1</code> + </p> + + <ul> + <li> + <code>location.webintents.org</code>: <em class="rfc2119" title="required">required</em>. States the location to the Web Intents document in the <a>UPnP enabled device</a>. + If the value of this header is a relative URL the base URL is the base URL of the <code>LOCATION</code> header. + </li> + <li> + <code>action.webintents.org</code>: <em class="rfc2119" title="optional">optional</em>. If supported, states the Web Intents + <code>action</code> of the supported Web Intents Services and <em class="rfc2119" title="must">must</em> + match the <code>action</code> attributes of the Service registration markup in the Web Intents document. To support more than + one Web Intents <code>action</code> the action strings <em class="rfc2119" title="must">must</em> be separated with + one or more commas. Commas included in action strings <em class="rfc2119" title="must">must</em> be percent-encoded as + defined in [[!RFC3986]], section-2.1. + <br /> <br /> + This header allows the <a>UPnP enabled User Agent</a> to filter received SSDP messages so that the <a>UPnP enabled User Agent</a>s only have to + retrieve Web Intents documents for matching Web Intents Actions. + </li> + </ul> + + </section> + + <section> + + <h4>Web Intents document</h4> + + <p> + The <a>UPnP enabled device</a> <em class="rfc2119" title="must">must</em> store Web Intents documents for the Web Intents Services the <a>UPnP enabled device</a> supports. + Web Intents documents are html pages that contain Web Intents Service registration markup according to the rules for Web Intents Service registration defined + by [[!WEBINTENTS]]. They may also contain Service handler code for Services registered within the same document. + </p> + + </section> + + <section> + + <h4>Web Intents Service pages</h4> + + <p> + The <a>UPnP enabled device</a> <em class="rfc2119" title="must">must</em> store a Web Intents Service page for each Service that is + referred in Web Intents documents through <code>href</code> attributes in the registration markup. + </p> + <p> + Service pages contain Service handler code and fulfills the rules for Web Intents Services as defined by [[!WEBINTENTS]]. + </p> + + </section> + + </section> + + <section> + + <h3><a>UPnP enabled User Agent</a></h3> + + <p> + The <a>UPnP enabled User Agent</a> <em class="rfc2119" title="must">must</em> support discovery of <a>UPnP enabled device<a>s through SSDP Discovery or through Advertisement + or through both methods according to [[!UPNP-DEVICEARCH]] and according to the Web Intents serviceType and Web Intents specific SSDP headers + defined in this specification, section 4.1. + </p> + + <p> + The sections below describe typical steps using these methods. + </p> + <section class='informative'> + <h4>Dynamic Service registration based on M-SEARCH</h4> + <p> + The section describes the discovery process based on standard UPnP M-SEARCH multicast request. + </p> + + <p> + When the navigator.startActivity method [[!WEBINTENTS]] is called, the <a>UPnP enabled User Agent</a> runs the following steps: + </p> + + <ol class="rule"> + <li> + Send a multicast request with the method M-SEARCH in the format specified by [[!UPNP-DEVICEARCH]]. + <br /> + The <code>ST</code> header is set to: <code>urn:schemas-webintents-org:service:WebIntents:1</code> + </li> + <br /> + <li> + For each matching M-SEARCH response, i.e. the response ST header is <code>urn:schemas-webintents-org:service:WebIntents:1</code> and the <code>action.webintents.org</code> + header, if present, matches the Action of the invoked intent, + the <a>UPnP enabled User Agent</a> attempts to retrieve the Web Intents document from the discovered <a>UPnP enabled device</a>. + The value of the <code>location.webintents.org</code> header is the location for the Web Intents document. + If this value is a relative URL the <a>UPnP enabled User Agent</a> uses the base URL of the <code>LOCATION</code> header as base URL for the location of the + Web Intents document. + <br /> <br /> + If the <a>UPnP enabled User Agent</a> fails to retrieve the Web Intents document it silently disregards the discovered Service. + <br /> <br /> + If the <code>action.webintents.org</code> header is present and does not match the <code>action</code> attributes of the Services registered in the retrieved Web Intents + document the <a>UPnP enabled User Agent</a> silently disregards the discovered Service. + </li> + <br /> + <li> + It is expected that the Web Intents document contains registration markup and the <a>UPnP enabled User Agent</a> interprets this + registration markup according to the rules for registration defined by [[!WEBINTENTS]] and register the Services accordingly. + </li> + <br /> + <li> + The <a>UPnP enabled User Agent</a> makes each dynamically registered Service available for selection + by the user, typically by making them visible and selectable in a Web Intents Service picker. + </li> + <br /> + <li> + Based on user selection of a dynamically registered Service the <a>UPnP enabled User Agent</a> loads the + Service handler code as defined by the <code>href</code> attribute in the registration markup for this Service according to the rules for + loading Service pages defined in [[!WEBINTENTS]]. + </li> + + </ol> + + </section> + + <section class='informative'> + <h4>Dynamic Service registration based on NOTIFY</h4> + <p> + This section describes the discovery process based on standard UPnP Advertisement with NOTIFY message. + </p> + + <p> + The <a>UPnP enabled User Agent</a> <em class="rfc2119" title="may">may</em> continously listen and act on advertisments according to the following steps: + </p> + <ol class="rule"> + + <li> + The <a>UPnP enabled User Agent</a> maintains a list of announced services based on received SSDP NOTIFY messages + with <code>NT</code> header equal to <code>urn:schemas-webintents-org:service:WebIntents:1</code>. + </li> + <br /> + <li> + When the navigator.startActivity method [[!WEBINTENTS]] is called the <a>UPnP enabled User Agent</a> checks the list + of of announced services for a service with an <code>action.webintents.org</code> header that matches the Action of the invoked intent. + </li> + <br /> + <li> + For each match the <a>UPnP enabled User Agent</a> attempts to retrieve the Web Intents document document from the discovered <a>UPnP enabled device</a>. The <a>UPnP enabled User Agent</a> + may also attempt to retrieve the Web Intents document for announced services without an <code>action.webintents.org</code> header. + The location of the Web Intents document is the value of the <code>location.webintents.org</code> header. If this value is a relative URL the + base URL is the base URL of the <code>LOCATION</code> header. + <br /> <br /> + If the <a>UPnP enabled User Agent</a> fails to retrieve the Web Intents document it silently disregards the discovered Service. + <br /> <br /> + If the <code>action.webintents.org</code> header does not match the <code>action</code> attribute in the retrieved Web Intents document + the <a>UPnP enabled User Agent</a> silently disregards the discovered Service. + </li> + <br /> + <li> + It is expected that the Web Intents document contains registration markup and the <a>UPnP enabled User Agent</a> interprets the + Web Intents document according to the rules for registration defined by [[!WEBINTENTS]] and register the Services accordingly. + </li> + <br /> + <li> + The <a>UPnP enabled User Agent</a> makes each dynamically registered Service available for selection + by the user, typically by making them visible and selectable in a Web Intents Service picker. + </li> + <br /> + <li> + Based on user selection of a dynamically registered Service the <a>UPnP enabled User Agent</a> loads the + Service handler code as defined by the <code>href</code> attribute in the registration markup for this Service according to the rules for + loading Service pages defined in [[!WEBINTENTS]]. + </li> + </ol> + + <p class="note"> + Power consumption in battery powered devices should be considered. If power consumption is severe continuously listening to SSDP advertisement in the background + should not be used.. + </p> + + </section> + + <section class='informative'> + <h4>Support for Web Intents and UPnP</h4> + <p> + In addition to the normative statements defined in this specification it is assumed that <a>UPnP enabled User Agent</a>s that comply to this specification + support Web Intents according to [[!WEBINTENTS]] and UPnP Discovery, Description and Control according to [[!UPNP-DEVICEARCH11]]. + However, it is implementation dependent whether this is supported natively in the User Agent or supported through some external component, + e.g. an in-device web server. + </p> + </section> + + <section class='informative'> + + <h4>Service availability management</h4> + + <p> + The <a>UPnP enabled User Agent</a> must manage the availability of UPnP services. For example detect when contact with a <a>UPnP enabled device</a> is lost through standard + UPnP life cycle management and remove a previously discovered and registered Service from the Service picker. However, for battery powered devices + power consumption must be considered and long lasting "keep alive" sessions" should be avoided. + </p> + + </section> + + </section> + + + + </section> + + <section> + + <h2>mDNS adaptation</h2> + + <p> + + This section describes how the User Agent handles Web Intents Services provided by local devices supporting mDNS. + </p> + + <p> + TBD.... + </p> + + + </section> + + + <section class='informative'> + <h2>APIs / protocols Client - Service </h2> + <p> + The APIs / protocols for interaction between Client and Service pages are not defined by this specification. It is assumed that Web Intents + based APIs and protocols will be standardized by W3C and that these will be applicable for Client and Service applications running on User Agents that + comply to this specification. Different use cases will require different ways of interaction patterns between Client and Service. + </p> + + <p> + Examples: + </p> + <ul> + <li> + A Client application invoking a "View" intent provides, as intent payload data, a link to a video to be displayed at the remote <a>UPnP enabled device</a>. + The Service application takes full control of the video playback by providing control buttons and sends UPnP commands to the remote device. + So in this case there the simple "API" just gives the link to the video to play. + </li> + <li> + Some use cases require a longer lasting relation between the Client and Service applications. By using the MessagePort[] attribute of the intent object + a message channel can be established between the Client and Service page. This message channel can be used to run Service specific protocols, + for example a protocol that allows the Client application to send simple video playback control commands to a Service application. + </li> + </ul> + + </section> + + <section class='informative appendix'> + <h2>Examples and scenarios</h2> + <section> + <h3>View and control video on remote device through Service page control buttons</h3> + <p> + The following scenario describes how a Client page uses Web Intents to discover a remote video view service. The Service page + contains the UI for controlling the video playback. + </p> + + <p align="left"><img src="Example_scenario_1/Slide1.png" alt="Example scenario 1/Slide1" width="700" height="700" ><br> + (<a href="Example_scenario_1/Slide1.png">View as PNG</a>) + </p> + + <p align="left"><img src="Example_scenario_1/Slide2.png" alt="Example scenario 1/Slide2" width="700" height="700" ><br> + (<a href="Example_scenario_1/Slide2.png">View as PNG</a>) + </p> + + <p align="left"><img src="Example_scenario_1/Slide3.png" alt="Example scenario 1/Slide3" width="700" height="700" ><br> + (<a href="Example_scenario_1/Slide3.png">View as PNG</a>) + </p> + </section> + + <section> + <h3>View and control video on remote device through Client page control buttons</h3> + <p> + The following scenario describes how a Client page uses Web Intents to discover a remote video view service. The UI stays in the Client page, + which contains the UI controls for the video playback. + </p> + + <p class="issue"> + This scenario assumes the possibility to have hidden/background Service pages or Service pages that are visible inline the Client page. + Currently [[!WEBINTENTS]] does not allow this but W3C DAP Action http://www.w3.org/2009/dap/track/actions/519 should add a proposal for a hidden disposition. + </p> + + <p align="left"><img src="Example_scenario_2/Slide1.png" alt="Example scenario 2/Slide1" width="700" height="700" ><br> + (<a href="Example_scenario_2/Slide1.png">View as PNG</a>) + </p> + + <p align="left"><img src="Example_scenario_2/Slide2.png" alt="Example scenario 2/Slide2" width="700" height="700" ><br> + (<a href="Example_scenario_2/Slide2.png">View as PNG</a>) + </p> + + <p align="left"><img src="Example_scenario_2/Slide3.png" alt="Example scenario 2/Slide3" width="700" height="700" ><br> + (<a href="Example_scenario_2/Slide3.png">View as PNG</a>) + </p> + + <p align="left"><img src="Example_scenario_2/Slide4.png" alt="Example scenario 2/Slide4" width="700" height="700" ><br> + (<a href="Example_scenario_2/Slide4.png">View as PNG</a>) + </p> + </section> + + + + <section> + <h3>Example of Web Intents document</h3> + + <p align="left"><img src="Example1_registration_page/Slide1.png" alt="Example1 registration page" width="280" height="280" ><br> + (<a href="Example1_registration_page/Slide1.png">View as PNG</a>) + </p> + </section> + + <section> + <h3>Example of UPnP Device description document</h3> + <p align="left"><img src="Example_device_and_service_description_pages/Slide1.png" alt="Example device and service description pages/Slide1" width="600" height="600" ><br> + (<a href="Example_device_and_service_description_pages/Slide1.png">View as PNG</a>) + </p> + </section> + + </section> + + <section class='appendix'> + <h3>Acknowledgements</h3> + <p> + Many thanks to Sony Mobile colleagues Anders Isberg, Anders Edenbrandt and Björn Ekberg + for all support. + <br /> <br /> + Many thanks to Robin Berjon for making our lives so much easier with his cool specification editing tool. + </p> + </section> + </body> +</html>>>>>>>> theirs
Received on Tuesday, 10 July 2012 15:21:37 UTC