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 024b456678bcbab1d3a3bd7c6a0208a5491127b1..d18eb59f058d297612600e3c46a6fb644af42965 100644 |
--- a/chrome/browser/android/banners/app_banner_data_fetcher_android.cc |
+++ b/chrome/browser/android/banners/app_banner_data_fetcher_android.cc |
@@ -5,18 +5,23 @@ |
#include "chrome/browser/android/banners/app_banner_data_fetcher_android.h" |
#include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
+#include "chrome/browser/android/shortcut_helper.h" |
#include "chrome/browser/banners/app_banner_metrics.h" |
#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 "third_party/skia/include/core/SkBitmap.h" |
+#include "ui/gfx/screen.h" |
namespace banners { |
AppBannerDataFetcherAndroid::AppBannerDataFetcherAndroid( |
content::WebContents* web_contents, |
base::WeakPtr<Delegate> weak_delegate, |
- int ideal_icon_size) |
- : AppBannerDataFetcher(web_contents, weak_delegate, ideal_icon_size) { |
+ int ideal_splash_image_size_in_dp, |
+ int ideal_icon_size_in_dp) |
+ : AppBannerDataFetcher(web_contents, weak_delegate, ideal_icon_size_in_dp), |
+ ideal_splash_image_size_in_dp_(ideal_splash_image_size_in_dp) { |
} |
AppBannerDataFetcherAndroid::~AppBannerDataFetcherAndroid() { |
@@ -43,6 +48,20 @@ std::string AppBannerDataFetcherAndroid::GetAppIdentifier() { |
? AppBannerDataFetcher::GetAppIdentifier() : native_app_package_; |
} |
+void AppBannerDataFetcherAndroid::FetchWebappSplashScreenImage( |
+ const std::string& webapp_id) { |
+ content::WebContents* web_contents = GetWebContents(); |
+ DCHECK(web_contents); |
+ |
+ GURL image_url = ManifestIconSelector::FindBestMatchingIcon( |
+ web_app_data().icons, |
+ ideal_splash_image_size_in_dp_, |
+ gfx::Screen::GetScreenFor(web_contents->GetNativeView())); |
+ |
+ ShortcutHelper::FetchSplashScreenImage( |
+ web_contents, image_url, ideal_splash_image_size_in_dp_, webapp_id); |
+} |
+ |
void AppBannerDataFetcherAndroid::ShowBanner(const SkBitmap* icon, |
const base::string16& title, |
const std::string& referrer) { |
@@ -53,7 +72,8 @@ void AppBannerDataFetcherAndroid::ShowBanner(const SkBitmap* icon, |
if (native_app_data_.is_null()) { |
scoped_ptr<AppBannerInfoBarDelegateAndroid> delegate( |
new AppBannerInfoBarDelegateAndroid( |
- event_request_id(), title, new SkBitmap(*icon), web_app_data())); |
+ event_request_id(), this, title, new SkBitmap(*icon), |
+ web_app_data())); |
infobar = |
new AppBannerInfoBarAndroid(delegate.Pass(), web_app_data().start_url); |