tree: 01ea1077a41fd205e15f60d37ba10416a23960c0 [search]
  1. .style.mdformat
  2. AGENTS.md
  3. BUILD.gn
  4. DIR_METADATA
  5. OWNERS
  6. README.md
  7. webapk_features.cc
  8. webapk_features.h
  9. webapk_handler_delegate.cc
  10. webapk_handler_delegate.h
  11. webapk_helpers.cc
  12. webapk_helpers.h
  13. webapk_helpers_unittest.cc
  14. webapk_icons_hasher_browsertest.cc
  15. webapk_info.cc
  16. webapk_info.h
  17. webapk_install_service.cc
  18. webapk_install_service.h
  19. webapk_install_service_factory.cc
  20. webapk_install_service_factory.h
  21. webapk_installer.cc
  22. webapk_installer.h
  23. webapk_installer_browsertest.cc
  24. webapk_metrics.cc
  25. webapk_metrics.h
  26. webapk_post_share_target_navigator.cc
  27. webapk_post_share_target_navigator.h
  28. webapk_post_share_target_navigator_browsertest.cc
  29. webapk_restore_manager.cc
  30. webapk_restore_manager.h
  31. webapk_restore_manager_unittest.cc
  32. webapk_restore_task.cc
  33. webapk_restore_task.h
  34. webapk_restore_task_browsertest.cc
  35. webapk_restore_web_contents_manager.cc
  36. webapk_restore_web_contents_manager.h
  37. webapk_ukm_recorder.cc
  38. webapk_ukm_recorder.h
  39. webapk_update_data_fetcher.cc
  40. webapk_update_data_fetcher.h
  41. webapk_update_manager.cc
chrome/browser/android/webapk/README.md

Android WebAPK Browser Native Code (chrome/browser/android/webapk)

This directory contains the C++ browser-process components for WebAPKs in Chromium on Android.

Following Chromium's documentation guidelines, this document describes how native WebAPK components bridge Java UI/coordinators, the WebAPK minting server, and Chrome Sync. For class-specific API details, see the header files.

For the comprehensive architectural guide covering the complete Java/C++ call graphs, see Android Web Apps Architecture.

Subsystems & JNI Bridge Architecture

Java WebApkActivityCoordinator / WebApkUpdateManager
                     │
                     ▼ (JNI)
[Native WebAPK Services] chrome/browser/android/webapk/
      ├── WebApkInstaller ──► WebAPK Minting Server (Requests signed APK)
      └── WebApkUpdateManager ──► Manifest Serialization & Update Dispatch

1. Installation Pipeline

  • Tri-Party Minting Protocol: WebApkInstaller receives installation requests from AppBannerManagerAndroid or the user menu. It packages the parsed Web App Manifest and icon hashes, sends an asynchronous request to the WebAPK minting server, and receives an installation token. It passes this token across JNI to Java (WebApkInstaller.java), which delegates the APK download and installation to Google Play via GooglePlayWebApkInstallDelegate.
  • Install Management: WebApkInstallService is the profile-keyed service that queues, deduplicates, and manages active installation requests across tabs.

2. Update Dispatch & Invariants

  • Background Update Bridge: Free JNI functions in webapk_update_manager.cc serialize updated manifest and icon data to disk when Java detects changes. When the scheduled background task executes, WebApkInstaller reads the file, requests an updated token from the minting server, and triggers the update via Google Play.
  • Foreground Suppression Invariant: Background update tasks defer execution while the target WebAPK is currently open in the foreground to prevent runtime state corruption.

Related Directories