blob: 5051cb8575e95cd00ebbeb6343343c2d13284cf7 [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.
Nafis Abedin121b0872024-12-18 20:59:4834 void DoesNewWebAppConflictWithExistingInstallation(
35 content::BrowserContext* browser_context,
Daniel Murphy97612a32024-01-25 01:41:3336 const GURL& start_url,
Nafis Abedin121b0872024-12-18 20:59:4837 const ManifestId& manifest_id,
38 WebAppInstallationConflictCallback callback) const override;
Daniel Murphy97612a32024-01-25 01:41:3339
Alison Gale3f4203f72024-04-26 19:27:4240 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3341 bool IsInAppBrowsingContext(
42 content::WebContents* web_contents) const override;
Alison Gale3f4203f72024-04-26 19:27:4243 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3344 bool IsAppPartiallyInstalledForSiteUrl(
45 content::BrowserContext* browsing_context,
46 const GURL& site_url) const override;
Alison Gale3f4203f72024-04-26 19:27:4247 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3348 bool IsAppFullyInstalledForSiteUrl(content::BrowserContext* browsing_context,
49 const GURL& site_url) const override;
Alison Gale3f4203f72024-04-26 19:27:4250 // TODO(crbug.com/40269982): Implement.
Daniel Murphy2e5932d2024-09-18 16:23:3951 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 Murphy97612a32024-01-25 01:41:3358 void SaveInstallationDismissedForMl(content::BrowserContext* browsing_context,
59 const GURL& manifest_id) const override;
Alison Gale3f4203f72024-04-26 19:27:4260 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3361 void SaveInstallationIgnoredForMl(content::BrowserContext* browsing_context,
62 const GURL& manifest_id) const override;
Alison Gale3f4203f72024-04-26 19:27:4263 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3364 void SaveInstallationAcceptedForMl(content::BrowserContext* browsing_context,
65 const GURL& manifest_id) const override;
Alison Gale3f4203f72024-04-26 19:27:4266 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3367 bool IsMlPromotionBlockedByHistoryGuardrail(
68 content::BrowserContext* browsing_context,
69 const GURL& manifest_id) const override;
Alison Gale3f4203f72024-04-26 19:27:4270 // TODO(crbug.com/40269982): Implement.
Daniel Murphy97612a32024-01-25 01:41:3371 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 Murphyd25c7202024-03-28 22:06:3877 bool CanShowAppBanners(const content::WebContents* web_contents) override;
Daniel Murphy97612a32024-01-25 01:41:3378 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_