Avi Drissman | 8ba1bad | 2022-09-13 19:22:36 | [diff] [blame] | 1 | // Copyright 2020 The Chromium Authors |
Evan Stade | aecdf1b5 | 2020-12-02 03:01:53 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Evan Stade | 2229a56 | 2021-01-12 18:30:07 | [diff] [blame] | 5 | #ifndef COMPONENTS_WEBAPPS_BROWSER_ANDROID_WEBAPPS_UTILS_H_ |
| 6 | #define COMPONENTS_WEBAPPS_BROWSER_ANDROID_WEBAPPS_UTILS_H_ |
Evan Stade | aecdf1b5 | 2020-12-02 03:01:53 | [diff] [blame] | 7 | |
Alan Cutter | e511d18a | 2021-08-04 23:10:38 | [diff] [blame] | 8 | #include "third_party/blink/public/mojom/manifest/manifest.mojom-forward.h" |
Evan Stade | aecdf1b5 | 2020-12-02 03:01:53 | [diff] [blame] | 9 | |
Alan Cutter | e511d18a | 2021-08-04 23:10:38 | [diff] [blame] | 10 | class GURL; |
Evan Stade | cf758624 | 2020-12-17 20:38:49 | [diff] [blame] | 11 | |
Evan Stade | aecdf1b5 | 2020-12-02 03:01:53 | [diff] [blame] | 12 | namespace content { |
| 13 | class BrowserContext; |
| 14 | } |
| 15 | |
| 16 | namespace webapps { |
| 17 | |
Susanne Westphal | 8e116dc | 2022-04-25 09:57:42 | [diff] [blame] | 18 | enum class WebApkInstallResult; |
| 19 | |
Evan Stade | aecdf1b5 | 2020-12-02 03:01:53 | [diff] [blame] | 20 | class WebappsUtils { |
| 21 | public: |
| 22 | WebappsUtils() = delete; |
| 23 | WebappsUtils& operator=(const WebappsUtils&) = delete; |
| 24 | WebappsUtils(const WebappsUtils&) = delete; |
| 25 | |
| 26 | // Returns true if there is an installed WebAPK which can handle |url|. |
| 27 | static bool IsWebApkInstalled(content::BrowserContext* browser_context, |
| 28 | const GURL& url); |
Evan Stade | cf758624 | 2020-12-17 20:38:49 | [diff] [blame] | 29 | |
| 30 | // Returns whether the format of the URLs in the Web Manifest is WebAPK |
| 31 | // compatible. |
| 32 | static bool AreWebManifestUrlsWebApkCompatible( |
Alan Cutter | e511d18a | 2021-08-04 23:10:38 | [diff] [blame] | 33 | const blink::mojom::Manifest& manifest); |
Susanne Westphal | 8e116dc | 2022-04-25 09:57:42 | [diff] [blame] | 34 | |
| 35 | // Shows toast notifying user of the result of a WebAPK install if the |
| 36 | // installation was not successful. |
| 37 | static void ShowWebApkInstallResultToast(webapps::WebApkInstallResult result); |
Evan Stade | aecdf1b5 | 2020-12-02 03:01:53 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace webapps |
| 41 | |
Evan Stade | 2229a56 | 2021-01-12 18:30:07 | [diff] [blame] | 42 | #endif // COMPONENTS_WEBAPPS_BROWSER_ANDROID_WEBAPPS_UTILS_H_ |