Index: chrome/browser/android/banners/app_banner_data_fetcher_android.cc |
diff --git a/chrome/browser/android/banners/app_banner_data_fetcher_android.cc b/chrome/browser/android/banners/app_banner_data_fetcher_android.cc |
index 10164088aa5ddfb2cfc92468681e243ffb5e2a2e..461cb960217f02cc8ad8a59b239a67565266fcf2 100644 |
--- a/chrome/browser/android/banners/app_banner_data_fetcher_android.cc |
+++ b/chrome/browser/android/banners/app_banner_data_fetcher_android.cc |
@@ -8,6 +8,7 @@ |
#include "base/bind.h" |
#include "base/callback.h" |
+#include "base/command_line.h" |
#include "base/memory/ptr_util.h" |
#include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
#include "chrome/browser/android/shortcut_helper.h" |
@@ -15,6 +16,7 @@ |
#include "chrome/browser/infobars/infobar_service.h" |
#include "chrome/browser/manifest/manifest_icon_selector.h" |
#include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" |
+#include "chrome/common/chrome_switches.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
namespace banners { |
@@ -32,6 +34,7 @@ AppBannerDataFetcherAndroid::AppBannerDataFetcherAndroid( |
ideal_icon_size_in_dp, |
minimum_icon_size_in_dp, |
is_debug_mode), |
+ webapp_type_(ShortcutInfo::Type::OTHER), |
ideal_splash_image_size_in_dp_(ideal_splash_image_size_in_dp), |
minimum_splash_image_size_in_dp_(minimum_splash_image_size_in_dp) {} |
@@ -54,6 +57,20 @@ bool AppBannerDataFetcherAndroid::ContinueFetching( |
return FetchAppIcon(GetWebContents(), image_url); |
} |
+bool AppBannerDataFetcherAndroid::CheckManifest( |
+ const content::Manifest& manifest, |
+ OutputDeveloperMessageCode* code) { |
+ bool manifest_valid_for_webapp = |
+ AppBannerDataFetcher::CheckManifest(manifest, code); |
+ if (manifest_valid_for_webapp) { |
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
+ webapp_type_ = command_line->HasSwitch(switches::kEnableWebApk) |
+ ? ShortcutInfo::Type::WEBAPK |
+ : ShortcutInfo::Type::WEBAPP; |
+ } |
+ return manifest_valid_for_webapp; |
+} |
+ |
std::string AppBannerDataFetcherAndroid::GetAppIdentifier() { |
return native_app_data_.is_null() |
? AppBannerDataFetcher::GetAppIdentifier() : native_app_package_; |
@@ -85,7 +102,8 @@ void AppBannerDataFetcherAndroid::ShowBanner(const GURL& icon_url, |
std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
new AppBannerInfoBarDelegateAndroid(event_request_id(), this, title, |
icon_url, new SkBitmap(*icon), |
- manifest_url(), manifest())); |
+ manifest_url(), manifest(), |
+ webapp_type_)); |
infobar = new AppBannerInfoBarAndroid(std::move(delegate), |
manifest().start_url); |