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

Unified Diff: chrome/browser/android/webapps/add_to_homescreen_dialog_helper.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: Fix compile Created 5 years, 3 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/webapps/add_to_homescreen_dialog_helper.cc
diff --git a/chrome/browser/android/webapps/add_to_homescreen_dialog_helper.cc b/chrome/browser/android/webapps/add_to_homescreen_dialog_helper.cc
index 658cd3d1824f1a4448cdf4cd33a5b6d4b004e920..a206314e8c9cbd353a61f8dec6534d98bd551d6c 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_dialog_helper.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_dialog_helper.cc
@@ -9,6 +9,7 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/basictypes.h"
+#include "base/guid.h"
#include "base/location.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
@@ -26,19 +27,28 @@ using content::Manifest;
jlong Initialize(JNIEnv* env,
const JavaParamRef<jobject>& obj,
- const JavaParamRef<jobject>& java_web_contents) {
+ const JavaParamRef<jobject>& java_web_contents,
+ jint ideal_splash_image_size_in_dp,
+ jint ideal_icon_size_in_dp) {
content::WebContents* web_contents =
content::WebContents::FromJavaWebContents(java_web_contents);
AddToHomescreenDialogHelper* add_to_homescreen_helper =
- new AddToHomescreenDialogHelper(env, obj, web_contents);
+ new AddToHomescreenDialogHelper(env, obj, web_contents,
+ ideal_splash_image_size_in_dp, ideal_icon_size_in_dp);
return reinterpret_cast<intptr_t>(add_to_homescreen_helper);
}
-AddToHomescreenDialogHelper::AddToHomescreenDialogHelper(JNIEnv* env,
- jobject obj,
- content::WebContents* web_contents)
+AddToHomescreenDialogHelper::AddToHomescreenDialogHelper(
+ JNIEnv* env,
+ jobject obj,
+ content::WebContents* web_contents,
+ int ideal_splash_image_size_in_dp,
+ int ideal_icon_size_in_dp)
: add_shortcut_pending_(false),
- data_fetcher_(new AddToHomescreenDataFetcher(web_contents, this)) {
+ data_fetcher_(new AddToHomescreenDataFetcher(web_contents,
+ ideal_splash_image_size_in_dp,
+ ideal_icon_size_in_dp,
+ this)) {
java_ref_.Reset(env, obj);
}
@@ -58,7 +68,7 @@ void AddToHomescreenDialogHelper::OnUserTitleAvailable(
}
void AddToHomescreenDialogHelper::OnDataAvailable(const ShortcutInfo& info,
- const SkBitmap& icon) {
+ const SkBitmap& icon) {
JNIEnv* env = base::android::AttachCurrentThread();
ScopedJavaLocalRef<jobject> java_bitmap;
if (icon.getSize())
@@ -124,7 +134,7 @@ void AddToHomescreenDialogHelper::AddShortcut(JNIEnv* env,
}
void AddToHomescreenDialogHelper::AddShortcut(const ShortcutInfo& info,
- const SkBitmap& icon) {
+ const SkBitmap& icon) {
DCHECK(add_shortcut_pending_);
if (!add_shortcut_pending_)
return;
@@ -132,12 +142,16 @@ void AddToHomescreenDialogHelper::AddShortcut(const ShortcutInfo& info,
RecordAddToHomescreen();
+ const std::string& uid = base::GenerateGUID();
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
base::Bind(&ShortcutHelper::AddShortcutInBackgroundWithSkBitmap,
info,
+ uid,
icon));
+
+ data_fetcher_->FetchSplashScreenImage(uid);
}
bool AddToHomescreenDialogHelper::RegisterAddToHomescreenDialogHelper(
« no previous file with comments | « chrome/browser/android/webapps/add_to_homescreen_dialog_helper.h ('k') | chrome/browser/banners/app_banner_data_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698