Commit aa1f1cca authored by Giovanni Ortuño Urquidi's avatar Giovanni Ortuño Urquidi Committed by Commit Bot

Revert "👹 Add adaptable homescreen shortcuts for maskable icons."

This reverts commit ff026011.

Reason for revert: AddToHomescreen tests failing on Android CFI

https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Android%20CFI/3851

JNI ERROR (app bug): expected jboolean (0/1) but got value of 255 as argument 2 to void org.chromium.chrome.browser.webapps.AddToHomescreenManager.onIconAvailable(android.graphics.Bitmap, boolean)

Original change's description:
> 👹 Add adaptable homescreen shortcuts for maskable icons.
> 
> The Add to Homescreen feature will now consider "maskable" icons from
> the web app manifest [1]. If a maskable icon is present and we are on
> an Android O+ device, turn that "maskable" icon into an Android Adaptive
> icon [2].
> 
> The icon is scaled to ensure that the safe zone is preserved [3].
> 
> [1]: https://w3c.github.io/manifest/#purpose-member
> [2]: https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
> [3]: https://github.com/w3c/manifest/issues/555#issuecomment-404097653
> 
> Bug: 904354
> Change-Id: Iedfe61ace0fda4ca7f3ed3da6a5d07f2bff81443
> Reviewed-on: https://chromium-review.googlesource.com/c/1341998
> Commit-Queue: Peter Conn <peconn@chromium.org>
> Reviewed-by: Matt Giuca <mgiuca@chromium.org>
> Reviewed-by: Peter Beverloo <peter@chromium.org>
> Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
> Reviewed-by: Dominick Ng <dominickn@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#612218}

TBR=yfriedman@chromium.org,peter@chromium.org,mgiuca@chromium.org,peconn@chromium.org,dominickn@chromium.org

Change-Id: I2cccbcbd5fc01f68e1004516b470465db1e663ac
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 904354
Reviewed-on: https://chromium-review.googlesource.com/c/1356166Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612513}
parent 1d2514d8
......@@ -108,30 +108,6 @@ public class ShortcutHelper {
private static final float GENERATED_ICON_PADDING_RATIO = 1.0f / 12.0f;
private static final float GENERATED_ICON_FONT_SIZE_RATIO = 1.0f / 3.0f;
// Constants for figuring out the amount of padding required to transform a web manifest
// maskable icon to an Android adaptive icon.
//
// The web standard for maskable icons specifies a larger safe zone inside the icon
// than Android adaptive icons define. Therefore we need to pad the image so that
// the maskable icon's safe zone is reduced to the dimensions expected by Android. See
// https://github.com/w3c/manifest/issues/555#issuecomment-404097653.
//
// The *_RATIO variables give the diameter of the safe zone divided by the width of the icon.
// Sources:
// - https://www.w3.org/TR/appmanifest/#icon-masks
// - https://medium.com/google-design/designing-adaptive-icons-515af294c783
//
// We subtract 1 from the scaling factor to give the amount we need to increase by, then divide
// it by two to get the amount of padding that we will add to both sides.
private static final float MASKABLE_SAFE_ZONE_RATIO = 4.0f / 5.0f;
private static final float ADAPTABLE_SAFE_ZONE_RATIO = 66.0f / 108.0f;
private static final float MASKABLE_TO_ADAPTABLE_SCALING_FACTOR =
MASKABLE_SAFE_ZONE_RATIO / ADAPTABLE_SAFE_ZONE_RATIO;
private static final float MASKABLE_ICON_PADDING_RATIO =
(MASKABLE_TO_ADAPTABLE_SCALING_FACTOR - 1.0f) / 2.0f;
// True when Android O's ShortcutManager.requestPinShortcut() is supported.
private static boolean sIsRequestPinShortcutSupported;
......@@ -144,15 +120,13 @@ public class ShortcutHelper {
public static class Delegate {
/**
* Request Android to add a shortcut to the home screen.
* @param title Title of the shortcut.
* @param icon Image that represents the shortcut.
* @param iconAdaptable Whether to create an Android Adaptable icon.
* @param shortcutIntent Intent to fire when the shortcut is activated.
* @param title Title of the shortcut.
* @param icon Image that represents the shortcut.
* @param intent Intent to fire when the shortcut is activated.
*/
public void addShortcutToHomescreen(
String title, Bitmap icon, boolean iconAdaptable, Intent shortcutIntent) {
public void addShortcutToHomescreen(String title, Bitmap icon, Intent shortcutIntent) {
if (isRequestPinShortcutSupported()) {
addShortcutWithShortcutManager(title, icon, iconAdaptable, shortcutIntent);
addShortcutWithShortcutManager(title, icon, shortcutIntent);
return;
}
Intent intent = createAddToHomeIntent(title, icon, shortcutIntent);
......@@ -186,9 +160,9 @@ public class ShortcutHelper {
@CalledByNative
private static void addWebapp(final String id, final String url, final String scopeUrl,
final String userTitle, final String name, final String shortName, final String iconUrl,
final Bitmap icon, boolean iconAdaptable, @WebDisplayMode final int displayMode,
final int orientation, final int source, final long themeColor,
final long backgroundColor, final String splashScreenUrl, final long callbackPointer) {
final Bitmap icon, @WebDisplayMode final int displayMode, final int orientation,
final int source, final long themeColor, final long backgroundColor,
final String splashScreenUrl, final long callbackPointer) {
new AsyncTask<Intent>() {
@Override
protected Intent doInBackground() {
......@@ -211,7 +185,7 @@ public class ShortcutHelper {
}
@Override
protected void onPostExecute(final Intent resultIntent) {
sDelegate.addShortcutToHomescreen(userTitle, icon, iconAdaptable, resultIntent);
sDelegate.addShortcutToHomescreen(userTitle, icon, resultIntent);
// Store the webapp data so that it is accessible without the intent. Once this
// process is complete, call back to native code to start the splash image
......@@ -234,14 +208,14 @@ public class ShortcutHelper {
*/
@SuppressWarnings("unused")
@CalledByNative
private static void addShortcut(String id, String url, String userTitle, Bitmap icon,
boolean iconAdaptable, int source) {
private static void addShortcut(
String id, String url, String userTitle, Bitmap icon, int source) {
Context context = ContextUtils.getApplicationContext();
final Intent shortcutIntent = createShortcutIntent(url);
shortcutIntent.putExtra(EXTRA_ID, id);
shortcutIntent.putExtra(EXTRA_SOURCE, source);
shortcutIntent.setPackage(context.getPackageName());
sDelegate.addShortcutToHomescreen(userTitle, icon, iconAdaptable, shortcutIntent);
sDelegate.addShortcutToHomescreen(userTitle, icon, shortcutIntent);
if (shouldShowToastWhenAddingShortcut()) {
showAddedToHomescreenToast(userTitle);
}
......@@ -249,17 +223,14 @@ public class ShortcutHelper {
@TargetApi(Build.VERSION_CODES.O)
private static void addShortcutWithShortcutManager(
String title, Bitmap bitmap, boolean isMaskableIcon, Intent shortcutIntent) {
String title, Bitmap icon, Intent shortcutIntent) {
String id = shortcutIntent.getStringExtra(ShortcutHelper.EXTRA_ID);
Context context = ContextUtils.getApplicationContext();
Icon icon = isMaskableIcon ? Icon.createWithAdaptiveBitmap(bitmap)
: Icon.createWithBitmap(bitmap);
ShortcutInfo shortcutInfo = new ShortcutInfo.Builder(context, id)
.setShortLabel(title)
.setLongLabel(title)
.setIcon(icon)
.setIcon(Icon.createWithBitmap(icon))
.setIntent(shortcutIntent)
.build();
try {
......@@ -439,12 +410,12 @@ public class ShortcutHelper {
* Adapts a website's icon (e.g. favicon or touch icon) to make it suitable for the home screen.
* This involves adding padding if the icon is a full sized square.
*
* @param context Context used to create the intent.
* @param webIcon The website's favicon or touch icon.
* @param maskable Whether the icon is suitable for creating an adaptive icon.
* @return Bitmap Either the touch-icon or the newly created favicon.
*/
@CalledByNative
public static Bitmap createHomeScreenIconFromWebIcon(Bitmap webIcon, boolean maskable) {
public static Bitmap createHomeScreenIconFromWebIcon(Bitmap webIcon) {
// getLauncherLargeIconSize() is just a guess at the launcher icon size, and is often
// wrong -- the launcher can show icons at any size it pleases. Instead of resizing the
// icon to the supposed launcher size and then having the launcher resize the icon again,
......@@ -455,21 +426,18 @@ public class ShortcutHelper {
int maxInnerSize = Math.round(am.getLauncherLargeIconSize() * MAX_INNER_SIZE_RATIO);
int innerSize = Math.min(maxInnerSize, Math.max(webIcon.getWidth(), webIcon.getHeight()));
int outerSize = innerSize;
Rect innerBounds = new Rect(0, 0, innerSize, innerSize);
int padding = 0;
if (maskable) {
// See comments for MASKABLE_ICON_PADDING_RATIO.
padding = Math.round(MASKABLE_ICON_PADDING_RATIO * innerSize);
} else if (shouldPadIcon(webIcon)) {
// Draw the icon with padding around it if all four corners are not transparent.
padding = Math.round(ICON_PADDING_RATIO * innerSize);
}
int outerSize = 2 * padding + innerSize;
innerBounds.offset(padding, padding);
// Draw the icon with padding around it if all four corners are not transparent. Otherwise,
// don't add padding.
if (shouldPadIcon(webIcon)) {
int padding = Math.round(ICON_PADDING_RATIO * innerSize);
outerSize += 2 * padding;
innerBounds.offset(padding, padding);
}
Bitmap bitmap;
Bitmap bitmap = null;
try {
bitmap = Bitmap.createBitmap(outerSize, outerSize, Bitmap.Config.ARGB_8888);
} catch (OutOfMemoryError e) {
......
......@@ -4,12 +4,9 @@
package org.chromium.chrome.browser.webapps;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.drawable.Icon;
import android.os.Build;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.TextUtils;
......@@ -232,27 +229,13 @@ public class AddToHomescreenDialog implements View.OnClickListener {
/**
* Called when the home screen icon is available. Must be called after onUserTitleAvailable().
* @param icon that will be used in the launcher.
* @param icon Icon to use in the launcher.
*/
public void onIconAvailable(Bitmap icon) {
mIconView.setImageBitmap(icon);
setIconAvailable();
}
/**
* Called when the home screen icon is available and was generated to be an Android adaptable
* icon. Must be called after onUserTitleAvailable().
* @param icon that will be used in the launcher.
*/
@TargetApi(Build.VERSION_CODES.O)
public void onAdaptableIconAvailable(Bitmap icon) {
mIconView.setImageIcon(Icon.createWithAdaptiveBitmap(icon));
setIconAvailable();
}
private void setIconAvailable() {
mProgressBarView.setVisibility(View.GONE);
mIconView.setVisibility(View.VISIBLE);
mIconView.setImageBitmap(icon);
mHasIcon = true;
updateAddButtonEnabledState();
}
......
......@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.webapps;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Build;
import android.text.TextUtils;
import org.chromium.base.annotations.CalledByNative;
......@@ -94,13 +93,8 @@ public class AddToHomescreenManager implements AddToHomescreenDialog.Delegate {
}
@CalledByNative
private void onIconAvailable(Bitmap icon, boolean iconAdaptable) {
if (iconAdaptable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mDialog.onAdaptableIconAvailable(icon);
} else {
assert !iconAdaptable : "Adaptive icons should not be provided pre-Android O.";
mDialog.onIconAvailable(icon);
}
private void onIconAvailable(Bitmap icon) {
mDialog.onIconAvailable(icon);
}
private native long nativeInitializeAndStart(WebContents webContents);
......
......@@ -189,8 +189,7 @@ public class AppBannerManagerTest {
AppBannerManager.setIsSupported(true);
ShortcutHelper.setDelegateForTests(new ShortcutHelper.Delegate() {
@Override
public void addShortcutToHomescreen(
String title, Bitmap icon, boolean iconAdaptive, Intent shortcutIntent) {
public void addShortcutToHomescreen(String title, Bitmap icon, Intent shortcutIntent) {
// Ignore to prevent adding homescreen shortcuts.
}
});
......
......@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.webapps;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.support.test.filters.SmallTest;
import android.text.TextUtils;
......@@ -19,7 +18,6 @@ import org.junit.runner.RunWith;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Restriction;
import org.chromium.base.test.util.RetryOnFailure;
......@@ -84,23 +82,14 @@ public class AddToHomescreenManagerTest {
+ "<title>" + META_APP_NAME_PAGE_TITLE + "</title>"
+ "</head><body>Webapp capable</body></html>");
private static final String NON_MASKABLE_MANIFEST_TEST_PAGE_PATH =
"/chrome/test/data/banners/manifest_test_page.html";
private static final String MASKABLE_MANIFEST_TEST_PAGE_PATH =
"/chrome/test/data/banners/manifest_test_page.html?manifest=manifest_maskable.json";
private static final String MANIFEST_TEST_PAGE_TITLE = "Web app banner test page";
private static class TestShortcutHelperDelegate extends ShortcutHelper.Delegate {
public String mRequestedShortcutTitle;
public Intent mRequestedShortcutIntent;
public boolean mRequestedShortcutAdaptable;
@Override
public void addShortcutToHomescreen(
String title, Bitmap icon, boolean iconAdaptable, Intent shortcutIntent) {
public void addShortcutToHomescreen(String title, Bitmap icon, Intent shortcutIntent) {
mRequestedShortcutTitle = title;
mRequestedShortcutIntent = shortcutIntent;
mRequestedShortcutAdaptable = iconAdaptable;
}
@Override
......@@ -111,7 +100,6 @@ public class AddToHomescreenManagerTest {
public void clearRequestedShortcutData() {
mRequestedShortcutTitle = null;
mRequestedShortcutIntent = null;
mRequestedShortcutAdaptable = false;
}
}
......@@ -209,31 +197,6 @@ public class AddToHomescreenManagerTest {
Assert.assertEquals(mActivity.getPackageName(), newLaunchIntent.getPackage());
}
@Test
@SmallTest
@Feature("{Webapp}")
// The test manifest fulfills the requirements of a WebAPK so disable WebAPKs to force plain old
// add to home screen.
@CommandLineFlags.Add({"disable-features=ImprovedA2HS"})
@DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.O)
public void testAddAdaptableShortcut() throws Exception {
// Test the baseline of no adaptive icon.
loadUrl(mTestServerRule.getServer().getURL(NON_MASKABLE_MANIFEST_TEST_PAGE_PATH),
MANIFEST_TEST_PAGE_TITLE);
addShortcutToTab(mTab, "", true);
Assert.assertFalse(mShortcutHelperDelegate.mRequestedShortcutAdaptable);
mShortcutHelperDelegate.clearRequestedShortcutData();
// Test the adaptive icon.
loadUrl(mTestServerRule.getServer().getURL(MASKABLE_MANIFEST_TEST_PAGE_PATH),
MANIFEST_TEST_PAGE_TITLE);
addShortcutToTab(mTab, "", true);
Assert.assertTrue(mShortcutHelperDelegate.mRequestedShortcutAdaptable);
}
@Test
@SmallTest
@Feature("{Webapp}")
......
......@@ -79,7 +79,6 @@ void GetHomescreenIconAndSplashImageSizes() {
void AddWebappWithSkBitmap(const ShortcutInfo& info,
const std::string& webapp_id,
const SkBitmap& icon_bitmap,
bool is_icon_maskable,
const base::Closure& splash_image_callback) {
// Send the data to the Java side to create the shortcut.
JNIEnv* env = base::android::AttachCurrentThread();
......@@ -114,8 +113,8 @@ void AddWebappWithSkBitmap(const ShortcutInfo& info,
Java_ShortcutHelper_addWebapp(
env, java_webapp_id, java_url, java_scope_url, java_user_title, java_name,
java_short_name, java_best_primary_icon_url, java_bitmap,
is_icon_maskable, info.display, info.orientation, info.source,
java_short_name, java_best_primary_icon_url, java_bitmap, info.display,
info.orientation, info.source,
OptionalSkColorToJavaColor(info.theme_color),
OptionalSkColorToJavaColor(info.background_color), java_splash_screen_url,
callback_pointer);
......@@ -124,8 +123,7 @@ void AddWebappWithSkBitmap(const ShortcutInfo& info,
// Adds a shortcut which opens in a browser tab to the launcher.
void AddShortcutWithSkBitmap(const ShortcutInfo& info,
const std::string& id,
const SkBitmap& icon_bitmap,
bool is_icon_maskable) {
const SkBitmap& icon_bitmap) {
JNIEnv* env = base::android::AttachCurrentThread();
ScopedJavaLocalRef<jstring> java_id =
base::android::ConvertUTF8ToJavaString(env, id);
......@@ -138,7 +136,7 @@ void AddShortcutWithSkBitmap(const ShortcutInfo& info,
java_bitmap = gfx::ConvertToJavaBitmap(&icon_bitmap);
Java_ShortcutHelper_addShortcut(env, java_id, java_url, java_user_title,
java_bitmap, is_icon_maskable, info.source);
java_bitmap, info.source);
}
} // anonymous namespace
......@@ -173,20 +171,19 @@ std::unique_ptr<ShortcutInfo> ShortcutHelper::CreateShortcutInfo(
void ShortcutHelper::AddToLauncherWithSkBitmap(
content::WebContents* web_contents,
const ShortcutInfo& info,
const SkBitmap& icon_bitmap,
bool is_icon_maskable) {
const SkBitmap& icon_bitmap) {
std::string webapp_id = base::GenerateGUID();
if (info.display == blink::kWebDisplayModeStandalone ||
info.display == blink::kWebDisplayModeFullscreen ||
info.display == blink::kWebDisplayModeMinimalUi) {
AddWebappWithSkBitmap(
info, webapp_id, icon_bitmap, is_icon_maskable,
info, webapp_id, icon_bitmap,
base::Bind(&ShortcutHelper::FetchSplashScreenImage, web_contents,
info.splash_image_url, info.ideal_splash_image_size_in_px,
info.minimum_splash_image_size_in_px, webapp_id));
return;
}
AddShortcutWithSkBitmap(info, webapp_id, icon_bitmap, is_icon_maskable);
AddShortcutWithSkBitmap(info, webapp_id, icon_bitmap);
}
void ShortcutHelper::ShowWebApkInstallInProgressToast() {
......@@ -258,7 +255,6 @@ void ShortcutHelper::StoreWebappSplashImage(const std::string& webapp_id,
// static
SkBitmap ShortcutHelper::FinalizeLauncherIconInBackground(
const SkBitmap& bitmap,
bool is_icon_maskable,
const GURL& url,
bool* is_generated) {
base::AssertLongCPUWorkAllowed();
......@@ -272,8 +268,8 @@ SkBitmap ShortcutHelper::FinalizeLauncherIconInBackground(
bitmap.height())) {
ScopedJavaLocalRef<jobject> java_bitmap =
gfx::ConvertToJavaBitmap(&bitmap);
result = Java_ShortcutHelper_createHomeScreenIconFromWebIcon(
env, java_bitmap, is_icon_maskable);
result =
Java_ShortcutHelper_createHomeScreenIconFromWebIcon(env, java_bitmap);
}
}
......
......@@ -42,8 +42,7 @@ class ShortcutHelper {
// added depends on the properties in |info|.
static void AddToLauncherWithSkBitmap(content::WebContents* web_contents,
const ShortcutInfo& info,
const SkBitmap& icon_bitmap,
bool is_icon_maskable);
const SkBitmap& icon_bitmap);
// Shows toast notifying user that a WebAPK install is already in progress
// when user tries to queue a new install for the same WebAPK.
......@@ -86,7 +85,6 @@ class ShortcutHelper {
// |is_generated| will be set to |true|.
// Must be called on a background worker thread.
static SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon,
bool is_icon_maskable,
const GURL& url,
bool* is_generated);
......
......@@ -95,10 +95,8 @@ void WebApkInstallService::OnFinishedInstall(
if (!web_contents)
return;
// TODO(https://crbug.com/861643): Support maskable icons here.
ShortcutHelper::AddToLauncherWithSkBitmap(web_contents, shortcut_info,
primary_icon,
/*is_icon_maskable=*/false);
primary_icon);
}
}
......
......@@ -46,8 +46,10 @@ GURL GetShortcutUrl(content::WebContents* web_contents) {
}
bool DoesAndroidSupportMaskableIcons() {
// TODO(peconn): Enable once Chrome on Android correctly handles maskable
// icons (https://crbug.com/904354).
return base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SDK_VERSION_OREO;
base::android::SDK_VERSION_OREO && false;
}
InstallableParams ParamsToPerformManifestAndIconFetch() {
......@@ -75,11 +77,10 @@ InstallableParams ParamsToPerformInstallableCheck() {
// - the generated icon
// - whether |icon| was used in generating the launcher icon
std::pair<SkBitmap, bool> CreateLauncherIconInBackground(const GURL& start_url,
const SkBitmap& icon,
bool maskable) {
const SkBitmap& icon) {
bool is_generated = false;
SkBitmap primary_icon = ShortcutHelper::FinalizeLauncherIconInBackground(
icon, maskable, start_url, &is_generated);
icon, start_url, &is_generated);
return std::make_pair(primary_icon, is_generated);
}
......@@ -98,8 +99,7 @@ std::pair<SkBitmap, bool> CreateLauncherIconFromFaviconInBackground(
gfx::PNGCodec::Decode(bitmap_result.bitmap_data->front(),
bitmap_result.bitmap_data->size(), &decoded);
}
return CreateLauncherIconInBackground(start_url, decoded,
/* maskable */ false);
return CreateLauncherIconInBackground(start_url, decoded);
}
void RecordAddToHomescreenDialogDuration(base::TimeDelta duration) {
......@@ -238,7 +238,6 @@ void AddToHomescreenDataFetcher::OnDidGetManifestAndIcons(
}
raw_primary_icon_ = *data.primary_icon;
has_maskable_primary_icon_ = data.has_maskable_primary_icon;
shortcut_info_.best_primary_icon_url = data.primary_icon_url;
// Save the splash screen URL for the later download.
......@@ -347,8 +346,7 @@ void AddToHomescreenDataFetcher::CreateLauncherIcon(const SkBitmap& icon) {
FROM_HERE,
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(&CreateLauncherIconInBackground, shortcut_info_.url, icon,
has_maskable_primary_icon_),
base::BindOnce(&CreateLauncherIconInBackground, shortcut_info_.url, icon),
base::BindOnce(&AddToHomescreenDataFetcher::NotifyObserver,
weak_ptr_factory_.GetWeakPtr()));
}
......
......@@ -66,7 +66,6 @@ class AddToHomescreenDataFetcher : public content::WebContentsObserver {
const SkBitmap& badge_icon() const { return badge_icon_; }
const SkBitmap& primary_icon() const { return primary_icon_; }
ShortcutInfo& shortcut_info() { return shortcut_info_; }
bool has_maskable_primary_icon() const { return has_maskable_primary_icon_; }
private:
// Called to stop the timeout timer.
......@@ -100,7 +99,6 @@ class AddToHomescreenDataFetcher : public content::WebContentsObserver {
SkBitmap badge_icon_;
SkBitmap primary_icon_;
ShortcutInfo shortcut_info_;
bool has_maskable_primary_icon_;
base::CancelableTaskTracker favicon_task_tracker_;
base::OneShotTimer data_timeout_timer_;
......
......@@ -77,10 +77,9 @@ void AddToHomescreenManager::AddToHomescreen(
base::string16 user_title =
base::android::ConvertJavaStringToUTF16(env, j_user_title);
data_fetcher_->shortcut_info().user_title = user_title;
ShortcutHelper::AddToLauncherWithSkBitmap(
web_contents, data_fetcher_->shortcut_info(),
data_fetcher_->primary_icon(),
data_fetcher_->has_maskable_primary_icon());
ShortcutHelper::AddToLauncherWithSkBitmap(web_contents,
data_fetcher_->shortcut_info(),
data_fetcher_->primary_icon());
}
// Fire the appinstalled event and do install time logging.
......@@ -144,6 +143,5 @@ void AddToHomescreenManager::OnDataAvailable(const ShortcutInfo& info,
java_bitmap = gfx::ConvertToJavaBitmap(&primary_icon);
JNIEnv* env = base::android::AttachCurrentThread();
Java_AddToHomescreenManager_onIconAvailable(
env, java_ref_, java_bitmap, data_fetcher_->has_maskable_primary_icon());
Java_AddToHomescreenManager_onIconAvailable(env, java_ref_, java_bitmap);
}
......@@ -318,10 +318,8 @@ void AppBannerUiDelegateAndroid::InstallLegacyWebApp(
AppBannerSettingsHelper::RecordBannerInstallEvent(
web_contents, shortcut_info_->url.spec(), AppBannerSettingsHelper::WEB);
// TODO(https://crbug.com/861643): Support maskable icons here.
ShortcutHelper::AddToLauncherWithSkBitmap(web_contents, *shortcut_info_,
primary_icon_,
/*is_icon_maskable=*/false);
primary_icon_);
}
void AppBannerUiDelegateAndroid::SendBannerAccepted() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment