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. |
Daniel Murphy | 2cc5cdf7 | 2024-03-12 20:00:01 | [diff] [blame] | 34 | bool DoesNewWebAppConflictWithExistingInstallation( |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 35 | content::BrowserContext* browsing_context, |
| 36 | const GURL& start_url, |
| 37 | const ManifestId& manifest_id) const override; |
| 38 | |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame^] | 39 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 40 | bool IsInAppBrowsingContext( |
| 41 | content::WebContents* web_contents) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame^] | 42 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 43 | bool IsAppPartiallyInstalledForSiteUrl( |
| 44 | content::BrowserContext* browsing_context, |
| 45 | const GURL& site_url) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame^] | 46 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 47 | bool IsAppFullyInstalledForSiteUrl(content::BrowserContext* browsing_context, |
| 48 | const GURL& site_url) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame^] | 49 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 50 | void SaveInstallationDismissedForMl(content::BrowserContext* browsing_context, |
| 51 | const GURL& manifest_id) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame^] | 52 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 53 | void SaveInstallationIgnoredForMl(content::BrowserContext* browsing_context, |
| 54 | const GURL& manifest_id) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame^] | 55 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 56 | void SaveInstallationAcceptedForMl(content::BrowserContext* browsing_context, |
| 57 | const GURL& manifest_id) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame^] | 58 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 59 | bool IsMlPromotionBlockedByHistoryGuardrail( |
| 60 | content::BrowserContext* browsing_context, |
| 61 | const GURL& manifest_id) const override; |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame^] | 62 | // TODO(crbug.com/40269982): Implement. |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 63 | segmentation_platform::SegmentationPlatformService* |
| 64 | GetSegmentationPlatformService( |
| 65 | content::BrowserContext* browsing_context) const override; |
| 66 | |
| 67 | bool IsInstallationInProgress(content::WebContents* web_contents, |
| 68 | const GURL& manifest_id) override; |
Daniel Murphy | d25c720 | 2024-03-28 22:06:38 | [diff] [blame] | 69 | bool CanShowAppBanners(const content::WebContents* web_contents) override; |
Daniel Murphy | 97612a3 | 2024-01-25 01:41:33 | [diff] [blame] | 70 | void OnWebApkInstallInitiatedFromAppMenu( |
| 71 | content::WebContents* web_contents) override; |
| 72 | void InstallWebApk(content::WebContents* web_contents, |
| 73 | const AddToHomescreenParams& params) override; |
| 74 | void InstallShortcut(content::WebContents* web_contents, |
| 75 | const AddToHomescreenParams& params) override; |
| 76 | |
| 77 | private: |
| 78 | friend base::NoDestructor<WebappsClientAndroid>; |
| 79 | |
| 80 | bool IsInstallationInProgress(content::BrowserContext* browser_context, |
| 81 | const GURL& manifest_id) const; |
| 82 | |
| 83 | WebappsClientAndroid() = default; |
| 84 | }; |
| 85 | |
| 86 | } // namespace webapps |
| 87 | |
| 88 | #endif // CHROME_BROWSER_WEBAPPS_WEBAPPS_CLIENT_ANDROID_H_ |