diff options
| author | yusufo <yusufo@chromium.org> | 2016-02-19 14:49:49 -0800 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-02-19 22:50:48 +0000 |
| commit | 739d5d698b9ffae0b36c3ec69548021fbd4712d6 (patch) | |
| tree | 1a0aef0f3cf3bffec4f7120b024b23d575a70dc5 | |
| parent | 57f800cdf11e2a6ea2d4437d617ffb4a4de59b38 (diff) | |
| download | chromium_src-739d5d698b9ffae0b36c3ec69548021fbd4712d6.zip chromium_src-739d5d698b9ffae0b36c3ec69548021fbd4712d6.tar.gz chromium_src-739d5d698b9ffae0b36c3ec69548021fbd4712d6.tar.bz2 | |
Set the client package early on for external navigation handling
In custom tabs InterceptNavigationHandler was being created before
setting the package name for the client on the tab and we weren't
guarding against the package name being null or empty.
BUG=575387
Review URL: https://codereview.chromium.org/1720453002
Cr-Commit-Position: refs/heads/master@{#376560}
2 files changed, 3 insertions, 3 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java index 745e050..5c9ab6c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java @@ -278,8 +278,6 @@ public class CustomTabActivity extends ChromeActivity { CustomTabsConnection.getInstance(getApplication()) .getClientPackageNameForSession(mSession), IntentHandler.getUrlFromIntent(getIntent())); - mainTab.setAppAssociatedWith(CustomTabsConnection.getInstance(getApplication()) - .getClientPackageNameForSession(mSession)); recordClientPackageName(); loadUrlInCurrentTab(new LoadUrlParams(IntentHandler.getUrlFromIntent(getIntent())), IntentHandler.getTimestampFromIntent(getIntent())); @@ -300,6 +298,7 @@ public class CustomTabActivity extends ChromeActivity { TabLaunchType.FROM_EXTERNAL_APP, null, null); CustomTabsConnection customTabsConnection = CustomTabsConnection.getInstance(getApplication()); + tab.setAppAssociatedWith(customTabsConnection.getClientPackageNameForSession(mSession)); WebContents webContents = customTabsConnection.takePrerenderedUrl(mSession, url, referrerUrl); if (webContents == null) { diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java index 0d7eb6d..0d4c76c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java @@ -9,6 +9,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.TransactionTooLargeException; +import android.text.TextUtils; import org.chromium.base.Log; import org.chromium.base.VisibleForTesting; @@ -59,7 +60,7 @@ public class CustomTabDelegateFactory extends TabDelegateFactory { try { // For a URL chrome can handle and there is no default set, handle it ourselves. if (!hasDefaultHandler) { - if (isPackageSpecializedHandler( + if (!TextUtils.isEmpty(mClientPackageName) && isPackageSpecializedHandler( mApplicationContext, mClientPackageName, intent)) { intent.setPackage(mClientPackageName); } else if (!isExternalProtocol) { |
