blob: a02574fc9cf5a98d27353f172bf06c3305d38c75 [file] [log] [blame]
Daniel Murphy97612a32024-01-25 01:41:331// 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
17namespace webapps {
18
19class 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 Murphy2cc5cdf72024-03-12 20:00:0134 bool DoesNewWebAppConflictWithExistingInstallation(
Daniel Murphy97612a32024-01-25 01:41:3335 content::BrowserContext* browsing_context,
36 const GURL& start_url,
37 const ManifestId& manifest_id) const override;
38
Alison Gale3f4203f72024-04-26 19:27:4239 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3340 bool IsInAppBrowsingContext(
41 content::WebContents* web_contents) const override;
Alison Gale3f4203f72024-04-26 19:27:4242 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3343 bool IsAppPartiallyInstalledForSiteUrl(
44 content::BrowserContext* browsing_context,
45 const GURL& site_url) const override;
Alison Gale3f4203f72024-04-26 19:27:4246 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3347 bool IsAppFullyInstalledForSiteUrl(content::BrowserContext* browsing_context,
48 const GURL& site_url) const override;
Alison Gale3f4203f72024-04-26 19:27:4249 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3350 void SaveInstallationDismissedForMl(content::BrowserContext* browsing_context,
51 const GURL& manifest_id) const override;
Alison Gale3f4203f72024-04-26 19:27:4252 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3353 void SaveInstallationIgnoredForMl(content::BrowserContext* browsing_context,
54 const GURL& manifest_id) const override;
Alison Gale3f4203f72024-04-26 19:27:4255 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3356 void SaveInstallationAcceptedForMl(content::BrowserContext* browsing_context,
57 const GURL& manifest_id) const override;
Alison Gale3f4203f72024-04-26 19:27:4258 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3359 bool IsMlPromotionBlockedByHistoryGuardrail(
60 content::BrowserContext* browsing_context,
61 const GURL& manifest_id) const override;
Alison Gale3f4203f72024-04-26 19:27:4262 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3363 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 Murphyd25c7202024-03-28 22:06:3869 bool CanShowAppBanners(const content::WebContents* web_contents) override;
Daniel Murphy97612a32024-01-25 01:41:3370 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_