Index: chrome/android/java/src/org/chromium/chrome/browser/BookmarkUtils.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BookmarkUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/BookmarkUtils.java |
index 0f318b3e9995e58ee3faab696f059076945c480b..53a491f62ebef5f1def476318d4b16a5cc89b410 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/BookmarkUtils.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/BookmarkUtils.java |
@@ -7,6 +7,8 @@ package org.chromium.chrome.browser; |
import android.app.ActivityManager; |
import android.content.Context; |
import android.content.Intent; |
+import android.content.pm.PackageManager; |
+import android.content.pm.ResolveInfo; |
import android.graphics.Bitmap; |
import android.graphics.Canvas; |
import android.graphics.Color; |
@@ -26,6 +28,8 @@ import android.util.TypedValue; |
import org.chromium.chrome.R; |
+import java.util.List; |
+ |
/** |
* Util class for bookmarks. |
*/ |
@@ -93,6 +97,19 @@ public class BookmarkUtils { |
} |
/** |
+ * Utility method to check if a shortcut can be added to the homescreen. |
+ * @param context Context used to get the package manager. |
+ * @return if a shortcut can be added to the homescreen under the current profile. |
+ */ |
+ public static boolean isAddToHomeIntentSupported(Context context) { |
+ PackageManager pm = context.getPackageManager(); |
+ Intent i = new Intent(INSTALL_SHORTCUT); |
+ List<ResolveInfo> receivers = pm.queryBroadcastReceivers( |
+ i, PackageManager.GET_INTENT_FILTERS); |
+ return !receivers.isEmpty(); |
+ } |
+ |
+ /** |
* Creates an icon to be associated with this bookmark. If available, the touch icon |
* will be used, else we draw our own. |
* @param context Context used to create the intent. |