Skip to content

Commit 76374f4

Browse files
author
Benoit Lize
committed
customtabs: Always call CustomTabsConnection.onHandledIntent().
Previously, only new intents going to the current active session would go through CustomTabsConnection.onHandledIntent(), which is not the intended behavior, as this is used to trigger preconnection to redirect endpoints. [email protected] (cherry picked from commit 67e17f3) Bug: 739165 Change-Id: Ie9da5dcf4e25f4d0ca2044cba20956a316f7a253 Reviewed-on: https://chromium-review.googlesource.com/581110 Commit-Queue: Benoit L <[email protected]> Reviewed-by: Yusuf Ozuysal <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#488952} Reviewed-on: https://chromium-review.googlesource.com/586551 Reviewed-by: Benoit L <[email protected]> Cr-Commit-Position: refs/branch-heads/3163@{#55} Cr-Branched-From: ff259ba-refs/heads/master@{#488528}
1 parent b7aaf6a commit 76374f4

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,24 +225,26 @@ public static void setActiveContentHandler(CustomTabContentHandler contentHandle
225225
}
226226

227227
/**
228-
* Used to check whether an incoming intent can be handled by the
229-
* current {@link CustomTabContentHandler}.
228+
* Called when a CustomTabs intent is handled.
229+
*
230+
* Used to check whether an incoming intent can be handled by the current
231+
* {@link CustomTabContentHandler}, and to perform action on new Intent.
232+
*
230233
* @return Whether the active {@link CustomTabContentHandler} has handled the intent.
231234
*/
232235
public static boolean handleInActiveContentIfNeeded(Intent intent) {
233-
if (sActiveContentHandler == null) return false;
234-
235-
if (sActiveContentHandler.shouldIgnoreIntent(intent)) {
236-
Log.w(TAG, "Incoming intent to Custom Tab was ignored.");
237-
return false;
238-
}
239-
240236
CustomTabsSessionToken session = CustomTabsSessionToken.getSessionTokenFromIntent(intent);
241-
if (session == null || !session.equals(sActiveContentHandler.getSession())) return false;
242237

243238
String url = IntentHandler.getUrlFromIntent(intent);
244239
if (TextUtils.isEmpty(url)) return false;
245240
CustomTabsConnection.getInstance().onHandledIntent(session, url, intent);
241+
242+
if (sActiveContentHandler == null) return false;
243+
if (session == null || !session.equals(sActiveContentHandler.getSession())) return false;
244+
if (sActiveContentHandler.shouldIgnoreIntent(intent)) {
245+
Log.w(TAG, "Incoming intent to Custom Tab was ignored.");
246+
return false;
247+
}
246248
sActiveContentHandler.loadUrlAndTrackFromTimestamp(new LoadUrlParams(url),
247249
IntentHandler.getTimestampFromIntent(intent));
248250
return true;

0 commit comments

Comments
 (0)