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 b8dd12d87021e58ccb76f0cfadb1561f97822f81..797b2328d4262b30a5ee8968122d84c8b0e53eef 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_; |
@@ -84,7 +101,7 @@ void AppBannerDataFetcherAndroid::ShowBanner(const SkBitmap* icon, |
std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
new AppBannerInfoBarDelegateAndroid(event_request_id(), this, title, |
new SkBitmap(*icon), |
- web_app_data())); |
+ web_app_data(), webapp_type_)); |
infobar = new AppBannerInfoBarAndroid(std::move(delegate), |
web_app_data().start_url); |