Chromium Code Reviews| 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 03f310df77862c70d77693472cc0a6d7b0d92444..c644f5d10bb03ec590d746ce09f495b278b66b20 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" |
| @@ -24,19 +25,30 @@ |
| using content::Manifest; |
| -jlong Initialize(JNIEnv* env, jobject obj, jobject java_web_contents) { |
| +jlong Initialize(JNIEnv* env, |
| + jobject obj, |
| + jobject java_web_contents, |
| + jint ideal_splash_icon_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_icon_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_icon_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_icon_size_in_dp, |
| + ideal_icon_size_in_dp, |
| + this)) { |
| java_ref_.Reset(env, obj); |
| } |
| @@ -56,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()) |
| @@ -122,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; |
| @@ -130,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_->FetchSplashscreenIcon(uid); |
|
mlamouri (slow - plz ping)
2015/08/24 16:43:54
This is slightly different from what I had in mind
Lalit Maganti
2015/08/25 11:38:44
Retained this behavior as discussed.
|
| } |
| bool AddToHomescreenDialogHelper::RegisterAddToHomescreenDialogHelper( |