Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc

Issue 1310223002: webapps: initial addition of splash screen icon downloading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webapps-database-exp
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
diff --git a/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc b/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
index 93bc0fa9dc03ececabda86f6e3f2c6a4f4d42123..9070e087f894f9f05b904c7691caa847417d2fef 100644
--- a/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
+++ b/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
@@ -6,6 +6,7 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
+#include "base/guid.h"
#include "base/location.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
@@ -38,12 +39,14 @@ namespace banners {
AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid(
int event_request_id,
+ scoped_refptr<AppBannerDataFetcherAndroid> data_fetcher,
const base::string16& app_title,
SkBitmap* app_icon,
const content::Manifest& web_app_data)
- : app_title_(app_title),
+ : event_request_id_(event_request_id),
+ data_fetcher_(data_fetcher),
+ app_title_(app_title),
app_icon_(app_icon),
- event_request_id_(event_request_id),
web_app_data_(web_app_data),
has_user_interaction_(false) {
DCHECK(!web_app_data.IsEmpty());
@@ -57,9 +60,9 @@ AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid(
const base::android::ScopedJavaGlobalRef<jobject>& native_app_data,
const std::string& native_app_package,
const std::string& referrer)
- : app_title_(app_title),
+ : event_request_id_(event_request_id),
+ app_title_(app_title),
app_icon_(app_icon),
- event_request_id_(event_request_id),
native_app_data_(native_app_data),
native_app_package_(native_app_package),
referrer_(referrer),
@@ -240,12 +243,16 @@ bool AppBannerInfoBarDelegateAndroid::Accept() {
ShortcutInfo info(GURL::EmptyGURL());
info.UpdateFromManifest(web_app_data_);
info.UpdateSource(ShortcutInfo::SOURCE_APP_BANNER);
+
+ const std::string& uid = base::GenerateGUID();
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
base::Bind(&ShortcutHelper::AddShortcutInBackgroundWithSkBitmap,
info,
+ uid,
*app_icon_.get()));
+ data_fetcher_->FetchWebappSplashScreenImage(uid);
SendBannerAccepted(web_contents, "web");
return true;

Powered by Google App Engine
This is Rietveld 408576698