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

Side by Side Diff: chrome/browser/android/webapps/add_to_homescreen_manager.cc

Issue 2669133003: Update AddToHomescreenDataFetcher to accept badge icon for WebAPK. (Closed)
Patch Set: Format Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/webapps/add_to_homescreen_manager.h" 5 #include "chrome/browser/android/webapps/add_to_homescreen_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 check_webapk_compatible = true; 81 check_webapk_compatible = true;
82 } else { 82 } else {
83 ShowDialog(); 83 ShowDialog();
84 } 84 }
85 85
86 data_fetcher_ = new AddToHomescreenDataFetcher( 86 data_fetcher_ = new AddToHomescreenDataFetcher(
87 web_contents, ShortcutHelper::GetIdealHomescreenIconSizeInPx(), 87 web_contents, ShortcutHelper::GetIdealHomescreenIconSizeInPx(),
88 ShortcutHelper::GetMinimumHomescreenIconSizeInPx(), 88 ShortcutHelper::GetMinimumHomescreenIconSizeInPx(),
89 ShortcutHelper::GetIdealSplashImageSizeInPx(), 89 ShortcutHelper::GetIdealSplashImageSizeInPx(),
90 ShortcutHelper::GetMinimumSplashImageSizeInPx(), 90 ShortcutHelper::GetMinimumSplashImageSizeInPx(),
91 ShortcutHelper::GetIdealBadgeIconSizeInPx(),
92 ShortcutHelper::GetIdealBadgeIconSizeInPx(),
91 check_webapk_compatible, this); 93 check_webapk_compatible, this);
92 } 94 }
93 95
94 AddToHomescreenManager::~AddToHomescreenManager() { 96 AddToHomescreenManager::~AddToHomescreenManager() {
95 if (data_fetcher_) { 97 if (data_fetcher_) {
96 data_fetcher_->set_weak_observer(nullptr); 98 data_fetcher_->set_weak_observer(nullptr);
97 data_fetcher_ = nullptr; 99 data_fetcher_ = nullptr;
98 } 100 }
99 } 101 }
100 102
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return; 158 return;
157 JNIEnv* env = base::android::AttachCurrentThread(); 159 JNIEnv* env = base::android::AttachCurrentThread();
158 ScopedJavaLocalRef<jstring> j_user_title = 160 ScopedJavaLocalRef<jstring> j_user_title =
159 base::android::ConvertUTF16ToJavaString(env, user_title); 161 base::android::ConvertUTF16ToJavaString(env, user_title);
160 Java_AddToHomescreenManager_onUserTitleAvailable(env, 162 Java_AddToHomescreenManager_onUserTitleAvailable(env,
161 java_ref_, 163 java_ref_,
162 j_user_title); 164 j_user_title);
163 } 165 }
164 166
165 void AddToHomescreenManager::OnDataAvailable(const ShortcutInfo& info, 167 void AddToHomescreenManager::OnDataAvailable(const ShortcutInfo& info,
166 const SkBitmap& icon) { 168 const SkBitmap& icon,
169 const SkBitmap& badge) {
167 if (is_webapk_compatible_) { 170 if (is_webapk_compatible_) {
171 // TODO(zpeng): Add badge to WebAPK installation flow.
168 WebApkInstallService* install_service = 172 WebApkInstallService* install_service =
169 WebApkInstallService::Get( 173 WebApkInstallService::Get(
170 data_fetcher_->web_contents()->GetBrowserContext()); 174 data_fetcher_->web_contents()->GetBrowserContext());
171 if (install_service->IsInstallInProgress(info.manifest_url)) 175 if (install_service->IsInstallInProgress(info.manifest_url))
172 ShortcutHelper::ShowWebApkInstallInProgressToast(); 176 ShortcutHelper::ShowWebApkInstallInProgressToast();
173 else 177 else
174 CreateInfoBarForWebApk(info, icon); 178 CreateInfoBarForWebApk(info, icon);
175 return; 179 return;
176 } 180 }
177 181
(...skipping 18 matching lines...) Expand all
196 200
197 SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground( 201 SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground(
198 const SkBitmap& bitmap, 202 const SkBitmap& bitmap,
199 const GURL& url, 203 const GURL& url,
200 bool* is_generated) { 204 bool* is_generated) {
201 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 205 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
202 206
203 return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url, 207 return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url,
204 is_generated); 208 is_generated);
205 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698