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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/bookmark/ShortcutActivity.java

Issue 1420743002: Web app: set a flag on the Intent if the icon was generated by Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@splashscreen-even-more-tests
Patch Set: review comments Created 5 years, 2 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/android/java/src/org/chromium/chrome/browser/bookmark/ShortcutActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmark/ShortcutActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmark/ShortcutActivity.java
index 6c8bae699604d79a84fca2e351a4abafa52b06f3..b052e0246f0a495bc8ae1f6a613bd4bbcea9e164 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/bookmark/ShortcutActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmark/ShortcutActivity.java
@@ -71,9 +71,15 @@ public class ShortcutActivity extends AsyncInitializationActivity implements
@Override
public void onBookmarkSelected(String url, String title, Bitmap favicon) {
- int dominantColor = FaviconHelper.getDominantColorForBitmap(favicon);
- Bitmap launcherIcon = ShortcutHelper.createLauncherIcon(this, favicon, url,
- Color.red(dominantColor), Color.green(dominantColor), Color.blue(dominantColor));
+ Bitmap launcherIcon;
+ if (ShortcutHelper.isIconLargeEnoughForLauncher(this, favicon)) {
+ launcherIcon = ShortcutHelper.modifyIconForLauncher(this, favicon);
+ } else {
+ int dominantColor = FaviconHelper.getDominantColorForBitmap(favicon);
+ launcherIcon = ShortcutHelper.generateLauncherIcon(this, url, Color.red(dominantColor),
+ Color.green(dominantColor), Color.blue(dominantColor));
+ }
+
Intent intent = ShortcutHelper.createAddToHomeIntent(url, title, launcherIcon);
intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.BOOKMARK_SHORTCUT_WIDGET);
setResult(RESULT_OK, intent);

Powered by Google App Engine
This is Rietveld 408576698