Index: customtabs/src/android/support/customtabs/CustomTabsSession.java |
diff --git a/customtabs/src/android/support/customtabs/CustomTabsSession.java b/customtabs/src/android/support/customtabs/CustomTabsSession.java |
index a0df820efb9a0fa986cd7a5fed71ea6aa5f565fe..5275c220fe5ca50d939107e5f98f7ae80a4e4ee8 100644 |
--- a/customtabs/src/android/support/customtabs/CustomTabsSession.java |
+++ b/customtabs/src/android/support/customtabs/CustomTabsSession.java |
@@ -25,6 +25,7 @@ import android.os.IBinder; |
import android.os.RemoteException; |
import android.support.annotation.NonNull; |
import android.support.annotation.Nullable; |
+import android.support.customtabs.CustomTabsService.Relation; |
import android.support.customtabs.CustomTabsService.Result; |
import android.support.customtabs.CustomTabsSessionToken.DummyCallback; |
import android.view.View; |
@@ -197,6 +198,33 @@ public final class CustomTabsSession { |
} |
} |
+ /** |
+ * Request to validate a relationship between the application and an origin. |
+ * |
+ * If this method returns true, the validation result will be provided through |
+ * {@link CustomTabsCallback#onRelationshipValidationResult(int, Uri, boolean, Bundle)}. |
+ * Otherwise the request didn't succeed. The client must call |
+ * {@link CustomTabsClient#warmup(long)} before this. |
+ * |
+ * @param relation Relation to check, must be one of the {@code CustomTabsService#RELATION_* } |
+ * constants. |
+ * @param origin Origin. |
+ * @param extras Reserved for future use. |
+ * @return true if the request has been submitted successfully. |
+ */ |
+ public boolean validateRelationship(@Relation int relation, Uri origin, |
+ @Nullable Bundle extras) { |
+ if (relation < CustomTabsService.RELATION_USE_AS_ORIGIN || |
+ relation > CustomTabsService.RELATION_HANDLE_ALL_URLS) { |
+ return false; |
+ } |
+ try { |
+ return mService.validateRelationship(mCallback, relation, origin, extras); |
+ } catch (RemoteException e) { |
+ return false; |
+ } |
+ } |
+ |
/* package */ IBinder getBinder() { |
return mCallback.asBinder(); |
} |