Skip to content

Instantly share code, notes, and snippets.

@t4kemyh4nd
Created October 15, 2023 05:59
Show Gist options
  • Save t4kemyh4nd/b25defcca8c8cbb216e075116bf1ff0b to your computer and use it in GitHub Desktop.
Save t4kemyh4nd/b25defcca8c8cbb216e075116bf1ff0b to your computer and use it in GitHub Desktop.
void WebApkInstaller::OnHaveSufficientSpaceForInstall() {
if (install_from_webapk_service_) {
DCHECK(!serialized_webapk_.get()->empty());
// We already have a serialized WebAPK request, so we can skip fetching the
// icons and building the proto.
const net::NetworkTrafficAnnotationTag
traffic_annotation_install_from_service =
net::DefineNetworkTrafficAnnotation("webapk_create_for_service", R"(
semantics {
sender: "WebAPK"
description:
"At the requesting app's request, Chrome can install supported web "
"apps on Android so that they show up in the user's app drawer and "
"optionally home screen. Web apps installed in this way are called "
"WebAPKs. See "
"https://developers.google.com/web/fundamentals/integration/webapks "
"for more details. WebAPKs are created on a Google server on "
"behalf of the Chrome client and the requesting app. In order for "
"the server to create a WebAPK, it first needs to know metadata "
"about the web app that the user wants to install, as well as some "
"details about the user's device. Upon successful WebAPK creation, "
"the server will return a URL from which the WebAPK can be "
"downloaded along with a few other details about the WebAPK (its "
"size, version, and hash, for example)."
trigger: "Chrome received a WebAPK install request via its install-"
"scheduling service from another app."
data:
"The 'WebApk' message in components/webapk/webapk.proto lists the "
"full contents of a WebAPK request. Note that 'package_name', "
"'version', and 'update_reasons' will not be filled in for initial "
"app installation requests, but only for future app updates. The "
"proto includes:\n"
" * the URL of the web app's Web Application Manifest (see "
"https://www.w3.org/TR/appmanifest/ for details)\n"
" * the parsed contents of the web app's Web Application Manifest "
"(includes things like the app's name and description, URLs to "
"icons, and other app features)\n"
" * the Android package name and version string of the browser "
"from which the user made the request\n"
" * the ABI and Android OS version of the device that made the "
"request"
destination: GOOGLE_OWNED_SERVICE
}
policy {
cookies_allowed: NO
policy_exception_justification: "Not implemented."
setting: "This feature cannot be disabled."
}
)");
SendRequest(traffic_annotation_install_from_service, *serialized_webapk_);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment