Chromium Code Reviews| 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..ef4be038fd7f87d820fbdd660b67a524ee0171aa 100644 |
| --- a/chrome/browser/android/banners/app_banner_data_fetcher_android.cc |
| +++ b/chrome/browser/android/banners/app_banner_data_fetcher_android.cc |
| @@ -4,19 +4,27 @@ |
| #include "chrome/browser/android/banners/app_banner_data_fetcher_android.h" |
| +#include "base/bind.h" |
|
mlamouri (slow - plz ping)
2015/09/03 22:58:40
do you need that #include?
Lalit Maganti
2015/09/04 11:13:24
Not any more.
|
| #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" |
| +#include "chrome/browser/android/shortcut_helper.h" |
| +#include "chrome/browser/banners/app_banner_debug_log.h" |
|
mlamouri (slow - plz ping)
2015/09/03 22:58:40
and that one?
Lalit Maganti
2015/09/04 11:13:24
ditto
|
| #include "chrome/browser/banners/app_banner_metrics.h" |
| #include "chrome/browser/infobars/infobar_service.h" |
| +#include "chrome/browser/manifest/manifest_icon_downloader.h" |
|
mlamouri (slow - plz ping)
2015/09/03 22:58:40
what about that one?
Lalit Maganti
2015/09/04 11:13:24
ditto
|
| +#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 +51,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 +75,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); |