Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 1 | // Copyright 2024 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_WEBAPPS_WEBAPPS_CLIENT_ANDROID_H_ |
| 6 | #define CHROME_BROWSER_WEBAPPS_WEBAPPS_CLIENT_ANDROID_H_ |
| 7 | |
| 8 | #include "base/no_destructor.h" |
| 9 | #include "build/build_config.h" |
| 10 | #include "chrome/browser/webapps/chrome_webapps_client.h" |
| 11 | #include "content/public/browser/browser_context.h" |
| 12 | |
| 13 | #if !BUILDFLAG(IS_ANDROID) |
| 14 | #error "Android implementation should not be included for non-Android builds." |
| 15 | #endif |
| 16 | |
| 17 | namespace webapps { |
| 18 | |
| 19 | class WebappsClientAndroid : public ChromeWebappsClient { |
| 20 | public: |
| 21 | // Creates the singleton instance accessible from WebappsClient::Get(). |
| 22 | static void CreateSingleton(); |
| 23 | |
| 24 | WebappsClientAndroid(const WebappsClientAndroid&) = delete; |
| 25 | WebappsClientAndroid& operator=(const WebappsClientAndroid&) = delete; |
| 26 | |
| 27 | // WebappsClient: |
| 28 | WebappInstallSource GetInstallSource(content::WebContents* web_contents, |
| 29 | InstallTrigger trigger) override; |
| 30 | AppBannerManager* GetAppBannerManager( |
| 31 | content::WebContents* web_contents) override; |
| 32 | |
| 33 | // Non-locally installed apps do not exist on Android. |
Nafis Abedin | 121b087 | 2024-12-18 20:59:48 | [diff] [blame] | 34 | void DoesNewWebAppConflictWithExistingInstallation( |
| 35 | content::BrowserContext* browser_context, |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 36 | const GURL& start_url, |
Nafis Abedin | 121b087 | 2024-12-18 20:59:48 | [diff] [blame] | 37 | const ManifestId& manifest_id, |
| 38 | WebAppInstallationConflictCallback callback) const override; |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 39 | |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 40 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 41 | bool IsInAppBrowsingContext( |
| 42 | content::WebContents* web_contents) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 43 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 44 | bool IsAppPartiallyInstalledForSiteUrl( |
| 45 | content::BrowserContext* browsing_context, |
| 46 | const GURL& site_url) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 47 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 48 | bool IsAppFullyInstalledForSiteUrl(content::BrowserContext* browsing_context, |
| 49 | const GURL& site_url) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 50 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 2e5932d | 2024-09-18 16:23:39 | [diff] [blame] | 51 | bool IsUrlControlledBySeenManifest(content::BrowserContext* browsing_context, |
| 52 | const GURL& site_url) const override; |
| 53 | |
| 54 | void OnManifestSeen(content::BrowserContext* browsing_context, |
| 55 | const blink::mojom::Manifest& manifest) const override; |
| 56 | |
| 57 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 58 | void SaveInstallationDismissedForMl(content::BrowserContext* browsing_context, |
| 59 | const GURL& manifest_id) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 60 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 61 | void SaveInstallationIgnoredForMl(content::BrowserContext* browsing_context, |
| 62 | const GURL& manifest_id) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 63 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 64 | void SaveInstallationAcceptedForMl(content::BrowserContext* browsing_context, |
| 65 | const GURL& manifest_id) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 66 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 67 | bool IsMlPromotionBlockedByHistoryGuardrail( |
| 68 | content::BrowserContext* browsing_context, |
| 69 | const GURL& manifest_id) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 70 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 71 | segmentation_platform::SegmentationPlatformService* |
| 72 | GetSegmentationPlatformService( |
| 73 | content::BrowserContext* browsing_context) const override; |
| 74 | |
| 75 | bool IsInstallationInProgress(content::WebContents* web_contents, |
| 76 | const GURL& manifest_id) override; |
Daniel Murphy | d25c720 | 2024-03-28 22:06:38 | [diff] [blame] | 77 | bool CanShowAppBanners(const content::WebContents* web_contents) override; |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 78 | void OnWebApkInstallInitiatedFromAppMenu( |
| 79 | content::WebContents* web_contents) override; |
| 80 | void InstallWebApk(content::WebContents* web_contents, |
| 81 | const AddToHomescreenParams& params) override; |
| 82 | void InstallShortcut(content::WebContents* web_contents, |
| 83 | const AddToHomescreenParams& params) override; |
| 84 | |
| 85 | private: |
| 86 | friend base::NoDestructor<WebappsClientAndroid>; |
| 87 | |
| 88 | bool IsInstallationInProgress(content::BrowserContext* browser_context, |
| 89 | const GURL& manifest_id) const; |
| 90 | |
| 91 | WebappsClientAndroid() = default; |
| 92 | }; |
| 93 | |
| 94 | } // namespace webapps |
| 95 | |
| 96 | #endif // CHROME_BROWSER_WEBAPPS_WEBAPPS_CLIENT_ANDROID_H_ |