Commit bd186bb2 authored by Evan Stade's avatar Evan Stade Committed by Chromium LUCI CQ

Webapps: add WebappsClient::IsInstallInProgress

The implementation is embedder specific.

Bug: 1147268
Change-Id: I12e364aa76307946e5bbb10bf40603b51e24a699
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594244Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837943}
parent eb900895
......@@ -16,7 +16,6 @@
#include "chrome/android/chrome_jni_headers/AppBannerManagerHelper_jni.h"
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/android/tab_web_contents_delegate_android.h"
#include "chrome/browser/android/webapk/webapk_install_service.h"
#include "chrome/browser/android/webapk/webapk_metrics.h"
#include "chrome/browser/android/webapk/webapk_ukm_recorder.h"
#include "chrome/browser/android/webapk/webapk_web_manifest_checker.h"
......@@ -41,6 +40,7 @@
#include "components/webapps/android/webapps_utils.h"
#include "components/webapps/installable/installable_data.h"
#include "components/webapps/installable/installable_metrics.h"
#include "components/webapps/webapps_client.h"
#include "content/public/browser/manifest_icon_downloader.h"
#include "content/public/browser/web_contents.h"
#include "net/base/url_util.h"
......@@ -568,8 +568,8 @@ bool AppBannerManagerAndroid::IsWebAppConsideredInstalled() const {
// one is in flight for the current site.
return WebappsUtils::IsWebApkInstalled(web_contents()->GetBrowserContext(),
manifest_.start_url) ||
WebApkInstallService::Get(web_contents()->GetBrowserContext())
->IsInstallInProgress(manifest_url_);
WebappsClient::Get()->IsInstallationInProgress(web_contents(),
manifest_url_);
}
base::WeakPtr<AppBannerManager> AppBannerManagerAndroid::GetWeakPtr() {
......
......@@ -4,6 +4,7 @@
#include "chrome/browser/webapps/chrome_webapps_client.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
......@@ -12,6 +13,7 @@
#if defined(OS_ANDROID)
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/android/tab_web_contents_delegate_android.h"
#include "chrome/browser/android/webapk/webapk_install_service.h"
#endif
namespace webapps {
......@@ -68,4 +70,16 @@ WebappInstallSource ChromeWebappsClient::GetInstallSource(
return WebappInstallSource::COUNT;
}
bool ChromeWebappsClient::IsInstallationInProgress(
content::WebContents* web_contents,
const GURL& manifest_url) {
#if defined(OS_ANDROID)
return WebApkInstallService::Get(web_contents->GetBrowserContext())
->IsInstallInProgress(manifest_url);
#else
NOTREACHED();
return false;
#endif
}
} // namespace webapps
......@@ -24,6 +24,8 @@ class ChromeWebappsClient : public WebappsClient {
content::WebContents* web_contents) override;
WebappInstallSource GetInstallSource(content::WebContents* web_contents,
InstallTrigger trigger) override;
bool IsInstallationInProgress(content::WebContents* web_contents,
const GURL& manifest_url) override;
private:
friend base::NoDestructor<ChromeWebappsClient>;
......
......@@ -7,6 +7,8 @@
#include "components/security_state/core/security_state.h"
class GURL;
namespace content {
class WebContents;
} // namespace content
......@@ -41,6 +43,9 @@ class WebappsClient {
virtual WebappInstallSource GetInstallSource(
content::WebContents* web_contents,
InstallTrigger trigger) = 0;
virtual bool IsInstallationInProgress(content::WebContents* web_contents,
const GURL& manifest_url) = 0;
};
} // namespace webapps
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment