// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module webapps.mojom;
import "sandbox/policy/mojom/sandbox.mojom";
import "url/mojom/url.mojom";
// The WebAppOriginAssociation structure is an internal representation of the
// web app origin association file described in the "Scope Extensions for Web
// Apps" explainer:
// https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md
struct WebAppOriginAssociation {
array<AssociatedWebApp> apps;
};
// |web_app_identity| is the app's manifest id.
// https://www.w3.org/TR/appmanifest/#dfn-id
struct AssociatedWebApp {
url.mojom.Url web_app_identity;
};
struct WebAppOriginAssociationError {
string message;
int32 line;
int32 column;
};
// Interface for parsing web app origin association files. Lives in a utility
// process, and used as part of the "PWAs as URL Handlers" feature.
[ServiceSandbox=sandbox.mojom.Sandbox.kService]
interface WebAppOriginAssociationParser {
// Parses the |raw_json| into a WebAppOriginAssociation object, along
// with any errors. If parsing failed, |association| will be null. If no
// errors are found, |errors| will be empty.
ParseWebAppOriginAssociation(string raw_json)
=> (WebAppOriginAssociation? association,
array<WebAppOriginAssociationError> errors);
};