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

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

Issue 2372313002: [Download Home] More effectively disable Download Home (Closed)
Patch Set: Rebasing Created 4 years, 3 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
*
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/util/FeatureUtilities.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698