| Index: chrome/android/java/src/org/chromium/chrome/browser/util/IntentUtils.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/util/IntentUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/util/IntentUtils.java
|
| index 4bc09d8437100744657457d97f9eb1036e75a381..40952d5cb02d28a8a561b094b7ef413893a1ed13 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/util/IntentUtils.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/util/IntentUtils.java
|
| @@ -4,6 +4,8 @@
|
|
|
| package org.chromium.chrome.browser.util;
|
|
|
| +import android.content.ActivityNotFoundException;
|
| +import android.content.Context;
|
| import android.content.Intent;
|
| import android.os.Binder;
|
| import android.os.Bundle;
|
| @@ -298,6 +300,21 @@ public class IntentUtils {
|
| }
|
|
|
| /**
|
| + * Catches any failures to start an Activity.
|
| + * @param context Context to use when starting the Activity.
|
| + * @param intent Intent to fire.
|
| + * @return Whether or not Android accepted the Intent.
|
| + */
|
| + public static boolean safeStartActivity(Context context, Intent intent) {
|
| + try {
|
| + context.startActivity(intent);
|
| + return true;
|
| + } catch (ActivityNotFoundException e) {
|
| + return false;
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Returns how large the Intent will be in Parcel form, which is helpful for gauging whether
|
| * Android will deliver the Intent instead of throwing a TransactionTooLargeException.
|
| *
|
|
|