Re: [w3c/manifest] [WIP] Adding file_handlers and launch consumer (#1005)

@dmurph commented on this pull request.



> @@ -1787,6 +1876,172 @@ <h2>
         </ol>
       </section>
     </section>
+    <section>
+      <h2>
+        File Handler Items
+      </h2>
+      <p>
+        Each <dfn data-local-lt="file handler's">file handler</dfn> represents

Fixed

> +            <ul>
+              <li>|item| is not [=ordered map=].
+              </li>
+              <li>|item|["action"] doesn't [=map/exist=].
+              </li>
+              <li>|item|["action"] is not a [=string=].
+              </li>
+              <li>|item|["name"] doesn't [=map/exist=].
+              </li>
+              <li>|item|["name"] is the empty string.
+              </li>
+              <li>|item|["accepts"] doesn't [=map/exist=].
+              </li>
+              <li>|item|["accepts"] is not a [=sequence=].
+              </li>
+              <li>|item|["accepts"] is an empty [=sequence=].

done.

> @@ -1012,6 +1012,158 @@ <h3>
           conventions or limitations of the host operating system.
         </p>
       </section>
+      <section>
+        <h3>
+          `file_handlers` member
+        </h3>
+        <p>
+          The [=manifest's=] <code><dfn data-export="" data-dfn-for=
+          "manifest">`file_handlers`</dfn></code> member is a [=list=] that
+          represents URLs within the app that handles launches of given [=file

I like that better.

> @@ -1012,6 +1012,158 @@ <h3>
           conventions or limitations of the host operating system.
         </p>
       </section>
+      <section>
+        <h3>
+          `file_handlers` member
+        </h3>
+        <p>
+          The [=manifest's=] <code><dfn data-export="" data-dfn-for=
+          "manifest">`file_handlers`</dfn></code> member is a [=list=] that
+          represents URLs within the app that handles launches of given [=file
+          types=].
+        </p>
+        <p>
+          A <dfn>file type</dfn> refers to file that has a [=mime type=] and/or

I like it. Done.

> +          |json|["file_handlers"] is not a [=list=], return.
+          </li>
+          <li>[=list/For each=] |entry:ordered map| of |json|["file_handlers"]:
+            <ol>
+              <li>Let |file_handler:ordered map| be [=process a file handler
+              item=] with |entry|.
+              </li>
+              <li>If |file_handler| is failure, continue.
+              </li>
+              <li>[=list/Append=] |file_handler| to |processedFileHandlers|.
+              </li>
+            </ol>
+          </li>
+        </ol>
+        <p>
+          On [=installation=], a user agent SHOULD register the file handlers

I think the "that are consistent with" here provides some wiggle room based on the OS. I'm not an expert in this though.

> +        <li>[=file handler/action=]
+        </li>
+        <li>[=file handler/name=]
+        </li>
+        <li>[=file handler/accepts=]
+        </li>
+        <li>[=file handler/icons=]
+        </li>
+      </ul>
+      <p>
+        A user agent can use these members to associate the web application
+        with [=file type=] on the operating system.
+      </p>
+      <aside class="note">
+        <p>
+          The disambiguation of file handlers and selecting of default file

Yes - quote is correct.

> +          "file handler">action</dfn></code> member is a <a>string</a> that
+          represents a relative URL of the [=manifest/start_url=] origin that
+          is [=manifest/within scope=] of a [=Document/processed manifest=].
+          This URL will be navigated to in the steps to [=execute a file
+          handler launch=].
+        </p>
+      </section>
+      <section>
+        <h3>
+          `name` member
+        </h3>
+        <p>
+          The [=file handler's=] <code><dfn data-dfn-for=
+          "file handler">name</dfn></code> member is a <a>string</a> that
+          represents a name to be provided to the user's operating system for
+          use with "Open with..." UX flows. This MAY be replaced by the user

I positioned there here to be able to apply this customization of name & icon throughout the entire system. If, by spec, it's customizable at the time we read the manifest, then anything that uses this manifest would be seeing the possibly customized icon.

> +          represents a relative URL of the [=manifest/start_url=] origin that
+          is [=manifest/within scope=] of a [=Document/processed manifest=].
+          This URL will be navigated to in the steps to [=execute a file
+          handler launch=].
+        </p>
+      </section>
+      <section>
+        <h3>
+          `name` member
+        </h3>
+        <p>
+          The [=file handler's=] <code><dfn data-dfn-for=
+          "file handler">name</dfn></code> member is a <a>string</a> that
+          represents a name to be provided to the user's operating system for
+          use with "Open with..." UX flows. This MAY be replaced by the user
+          agent for privacy & security reasons.

Hm.. can customize the text in window's explorer for a file type, right? It shows up as text on the OS, but maybe it's not an issue?

"Infected File - Please Launch to Fix" or something else to encourage users to launch the file? IDK though - less direct than icon.

> @@ -1787,6 +1942,147 @@ <h2>
         </ol>
       </section>
     </section>
+    <section>
+      <h2>
+        File Handler Items
+      </h2>
+      <p>
+        Each <dfn data-local-lt="file handler's">file handler</dfn> represents
+        a URL in the scope of the application that can handle launches with
+        [=file types=] it accepts. It has the following members:
+      </p>
+      <ul>
+        <li>[=file handler/action=]
+        </li>
+        <li>[=file handler/name=]
+        </li>
+        <li>[=file handler/accepts=]

done

> +          `accept` member
+        </h3>
+        <p>
+          The [=file handler's=] <code><dfn data-dfn-for=
+          "file handler">accept</dfn></code> member is a <a>dictionary</a>
+          mapping [=MIME types=] to a list of extensions. Extensions have to be
+          strings that start with a "." and only contain [=valid suffix code
+          points=]. Additionally extensions are limited to a length of 16 code
+          points.
+        </p>
+        <p>
+          In addition to complete MIME types, "*" can be used as the subtype of
+          a MIME type to match, for example, all image formats with "image/*".
+        </p>
+        <p>
+          Websites SHOULD always provide both [=MIME types=] and file

Let me know what you think now

> +          Processing file handler items
+        </h2>
+        <p>
+          To <dfn>process a file handler item</dfn>, given [=ordered map=]
+          |item:ordered map|, [=URL=] |start_url:URL|, [=URL=] |scope:URL|, and
+          [=URL=] |manifest URL:URL|.
+        </p>
+        <ol class="algorithm">
+          <li>Return failure if it's the case that:
+            <ul>
+              <li>|item| is not [=ordered map=].
+              </li>
+              <li>|item|["action"] doesn't [=map/exist=] or is not a
+              [=string=].
+              </li>
+              <li>|item|["name"] doesn't [=map/exist=] or is the empty string.

Done.

> +          <li>If |url| is failure, return failure.
+          </li>
+          <li>If |url| is not [=manifest/within scope=] of |scope|, return
+          failure.
+          </li>
+          <li>TODO - process "accepts"
+          </li>
+          <li>Let |file_handler:ordered map| be |ordered map| «[ "action" →
+          |url|, "name" → |item|["name"] ]».
+          </li>
+          <li>[=Process image resources=] passing |item|["icons"],
+          |file_handler|, |manifest URL|, and "icons".
+          </li>
+          <li>The user agent MAY replace |file_handler|["icons"] and
+          |file_handler|["name"] with the application icon and a string
+          containing the application name, respectively.

Done.

> +          </li>
+        </ol>
+        <p>
+          On [=installation=], a user agent SHOULD register the file handlers
+          with the operating system via interactions that are consistent with:
+        </p>
+        <ul>
+          <li>The [=file handler/icon=] and [=file handler/name=] appear in the
+          host operating system surfaces presenting options for opening files,
+          for example within "Open with..." context menus for associated file
+          types.
+          </li>
+          <li>The [=file handler/icon=] appears as the icon of associated files
+          in the host operating system.
+          </li>
+          <li>File types with multiple possible handlers can be disambiguated

I changed it but added some more context - let me know what you think.

> +            </li>
+            <li>Iterate through every {{LaunchConsumer}} set by
+            {{LaunchQueue/setConsumer}} and execute the function with |params|.
+            </li>
+          </ol>
+        </section>
+        <section>
+          <h3>
+            Privacy consideration: Default [=file handler=].
+          </h3>
+          <p>
+            Depending on the operating system capabilities, the [=manifest/file
+            handler=] could become a 'default' handler (e.g. handling launches
+            of a given file type automatically) of a given [=file type=]
+            without the explicit knowledge of the user. To protect against
+            possible mis-use, user agents MAY choose to offer the user the

Done - linked to "Execute a file handler launch"

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/pull/1005#discussion_r712530960

Received on Monday, 20 September 2021 23:36:04 UTC