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

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

Issue 1310223002: webapps: initial addition of splash screen icon downloading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webapps-database-exp
Patch Set: Add call to webapp storage Created 5 years, 4 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/ShortcutHelper.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
index ecb2acdea553ba595f9bc8bddd9d754555f935c8..9bc0aa3f1937cf0aa24d3967a779dcb07f198a7d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
@@ -33,6 +33,7 @@ import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.webapps.WebappDataStorage;
import org.chromium.chrome.browser.webapps.WebappLauncherActivity;
import org.chromium.chrome.browser.widget.RoundedIconGenerator;
import org.chromium.content_public.common.ScreenOrientationConstants;
@@ -40,7 +41,6 @@ import org.chromium.ui.widget.Toast;
import java.io.ByteArrayOutputStream;
import java.util.List;
-import java.util.UUID;
/**
* This is a helper class to create shortcuts on the Android home screen.
@@ -113,9 +113,9 @@ public class ShortcutHelper {
*/
@SuppressWarnings("unused")
@CalledByNative
- private static void addShortcut(Context context, String url, String userTitle, String name,
- String shortName, Bitmap icon, boolean isWebappCapable, int orientation, int source,
- long themeColor, long backgroundColor) {
+ private static void addShortcut(Context context, String id, String url, String userTitle,
+ String name, String shortName, Bitmap icon, boolean isWebappCapable, int orientation,
+ int source, long themeColor, long backgroundColor) {
Intent shortcutIntent;
if (isWebappCapable) {
// Encode the icon as a base64 string (Launcher drops Bitmaps in the Intent).
@@ -131,7 +131,7 @@ public class ShortcutHelper {
shortcutIntent = new Intent();
shortcutIntent.setAction(sDelegate.getFullscreenAction());
shortcutIntent.putExtra(EXTRA_ICON, encodedIcon);
- shortcutIntent.putExtra(EXTRA_ID, UUID.randomUUID().toString());
+ shortcutIntent.putExtra(EXTRA_ID, id);
shortcutIntent.putExtra(EXTRA_NAME, name);
shortcutIntent.putExtra(EXTRA_SHORT_NAME, shortName);
shortcutIntent.putExtra(EXTRA_URL, url);
@@ -167,6 +167,16 @@ public class ShortcutHelper {
}
/**
+ * TODO(lalitm)
+ */
+ @SuppressWarnings("unused")
+ @CalledByNative
+ private static void addSplashscreenIconToWebappData(Context context,
+ String id, Bitmap splashIcon) {
+ WebappDataStorage.open(context, id).putSplashIcon(splashIcon);
+ }
+
+ /**
* Creates an intent that will add a shortcut to the home screen.
* @param shortcutIntent Intent to fire when the shortcut is activated.
* @param url URL of the shortcut.

Powered by Google App Engine
This is Rietveld 408576698