webapps_client.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_WEBAPPS_BROWSER_WEBAPPS_CLIENT_H_
  5. #define COMPONENTS_WEBAPPS_BROWSER_WEBAPPS_CLIENT_H_
  6. #include "build/build_config.h"
  7. #include "components/security_state/core/security_state.h"
  8. class GURL;
  9. namespace content {
  10. class WebContents;
  11. } // namespace content
  12. namespace infobars {
  13. class ContentInfoBarManager;
  14. } // namespace infobars
  15. namespace webapps {
  16. class AppBannerManager;
  17. enum class InstallTrigger;
  18. enum class WebappInstallSource;
  19. struct AddToHomescreenParams;
  20. // Interface to be implemented by the embedder (such as Chrome or WebLayer) to
  21. // expose embedder specific logic.
  22. class WebappsClient {
  23. public:
  24. WebappsClient();
  25. WebappsClient(const WebappsClient&) = delete;
  26. WebappsClient& operator=(const WebappsClient&) = delete;
  27. virtual ~WebappsClient();
  28. // Return the webapps client.
  29. static WebappsClient* Get();
  30. virtual security_state::SecurityLevel GetSecurityLevelForWebContents(
  31. content::WebContents* web_contents) = 0;
  32. virtual infobars::ContentInfoBarManager* GetInfoBarManagerForWebContents(
  33. content::WebContents* web_contents) = 0;
  34. virtual WebappInstallSource GetInstallSource(
  35. content::WebContents* web_contents,
  36. InstallTrigger trigger) = 0;
  37. virtual AppBannerManager* GetAppBannerManager(
  38. content::WebContents* web_contents) = 0;
  39. #if BUILDFLAG(IS_ANDROID)
  40. virtual bool IsInstallationInProgress(content::WebContents* web_contents,
  41. const GURL& manifest_url) = 0;
  42. virtual bool CanShowAppBanners(content::WebContents* web_contents) = 0;
  43. virtual void OnWebApkInstallInitiatedFromAppMenu(
  44. content::WebContents* web_contents) = 0;
  45. virtual void InstallWebApk(content::WebContents* web_contents,
  46. const AddToHomescreenParams& params) = 0;
  47. virtual void InstallShortcut(content::WebContents* web_contents,
  48. const AddToHomescreenParams& params) = 0;
  49. #endif
  50. };
  51. } // namespace webapps
  52. #endif // COMPONENTS_WEBAPPS_BROWSER_WEBAPPS_CLIENT_H_