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

Unified Diff: customtabs/src/android/support/customtabs/CustomTabsSessionToken.java

Issue 1559043005: Update support lib to last released state (Closed) Base URL: https://chromium.googlesource.com/external/github.com/GoogleChrome/custom-tabs-client.git@master
Patch Set: Added aidl changes Created 4 years, 12 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: customtabs/src/android/support/customtabs/CustomTabsSessionToken.java
diff --git a/customtabs/src/android/support/customtabs/CustomTabsSessionToken.java b/customtabs/src/android/support/customtabs/CustomTabsSessionToken.java
index 479d1d9c7ca1a2ca06dd577539e5841defc0a279..189d6fa421cbd98c146f322037526638b9c8bab4 100644
--- a/customtabs/src/android/support/customtabs/CustomTabsSessionToken.java
+++ b/customtabs/src/android/support/customtabs/CustomTabsSessionToken.java
@@ -16,10 +16,11 @@
package android.support.customtabs;
-import android.net.Uri;
+import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
+import android.support.v4.app.BundleCompat;
import android.util.Log;
/**
@@ -31,6 +32,20 @@ public class CustomTabsSessionToken {
private final ICustomTabsCallback mCallbackBinder;
private final CustomTabsCallback mCallback;
+ /**
+ * Obtain a {@link CustomTabsSessionToken} from an intent. See {@link CustomTabsIntent.Builder}
+ * for ways to generate an intent for custom tabs.
+ * @param intent The intent to generate the token from. This has to include an extra for
+ * {@link CustomTabsIntent#EXTRA_SESSION}.
+ * @return The token that was generated.
+ */
+ public static CustomTabsSessionToken getSessionTokenFromIntent(Intent intent) {
+ Bundle b = intent.getExtras();
+ IBinder binder = BundleCompat.getBinder(b, CustomTabsIntent.EXTRA_SESSION);
+ if (binder == null) return null;
+ return new CustomTabsSessionToken(ICustomTabsCallback.Stub.asInterface(binder));
+ }
+
/**@hide*/
CustomTabsSessionToken(ICustomTabsCallback callbackBinder) {
mCallbackBinder = callbackBinder;

Powered by Google App Engine
This is Rietveld 408576698