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

Unified Diff: chrome/browser/android/webapps/add_to_homescreen_manager.cc

Issue 2669133003: Update AddToHomescreenDataFetcher to accept badge icon for WebAPK. (Closed)
Patch Set: Addressing comments Created 3 years, 11 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
« no previous file with comments | « chrome/browser/android/webapps/add_to_homescreen_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/webapps/add_to_homescreen_manager.cc
diff --git a/chrome/browser/android/webapps/add_to_homescreen_manager.cc b/chrome/browser/android/webapps/add_to_homescreen_manager.cc
index ddfa514fc8dc3048dab65afd25409693f86e33d7..3608e943e34200d435da7aae84e1ee3567502880 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_manager.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_manager.cc
@@ -70,7 +70,7 @@ void AddToHomescreenManager::AddShortcut(
if (data_fetcher_->is_ready()) {
// If the fetcher isn't ready yet, the shortcut will be added when it is
// via OnDataAvailable();
- AddShortcut(data_fetcher_->shortcut_info(), data_fetcher_->shortcut_icon());
+ AddShortcut(data_fetcher_->shortcut_info(), data_fetcher_->primary_icon());
}
}
@@ -88,6 +88,7 @@ void AddToHomescreenManager::Start(content::WebContents* web_contents) {
ShortcutHelper::GetMinimumHomescreenIconSizeInPx(),
ShortcutHelper::GetIdealSplashImageSizeInPx(),
ShortcutHelper::GetMinimumSplashImageSizeInPx(),
+ ShortcutHelper::GetIdealBadgeIconSizeInPx(),
check_webapk_compatible, this);
}
@@ -163,27 +164,29 @@ void AddToHomescreenManager::OnUserTitleAvailable(
}
void AddToHomescreenManager::OnDataAvailable(const ShortcutInfo& info,
- const SkBitmap& icon) {
+ const SkBitmap& primary_icon,
+ const SkBitmap& badge_icon) {
if (is_webapk_compatible_) {
+ // TODO(zpeng): Add badge to WebAPK installation flow.
WebApkInstallService* install_service =
WebApkInstallService::Get(
data_fetcher_->web_contents()->GetBrowserContext());
if (install_service->IsInstallInProgress(info.manifest_url))
ShortcutHelper::ShowWebApkInstallInProgressToast();
else
- CreateInfoBarForWebApk(info, icon);
+ CreateInfoBarForWebApk(info, primary_icon);
return;
}
JNIEnv* env = base::android::AttachCurrentThread();
ScopedJavaLocalRef<jobject> java_bitmap;
- if (icon.getSize())
- java_bitmap = gfx::ConvertToJavaBitmap(&icon);
+ if (!primary_icon.drawsNothing())
+ java_bitmap = gfx::ConvertToJavaBitmap(&primary_icon);
Java_AddToHomescreenManager_onReadyToAdd(env, java_ref_, java_bitmap);
if (add_shortcut_pending_)
- AddShortcut(info, icon);
+ AddShortcut(info, primary_icon);
}
void AddToHomescreenManager::CreateInfoBarForWebApk(const ShortcutInfo& info,
« no previous file with comments | « chrome/browser/android/webapps/add_to_homescreen_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698