| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.externalnav; | 5 package org.chromium.chrome.browser.externalnav; |
| 6 | 6 |
| 7 import android.content.ActivityNotFoundException; | 7 import android.content.ActivityNotFoundException; |
| 8 import android.content.ComponentName; | 8 import android.content.ComponentName; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.pm.ResolveInfo; | 10 import android.content.pm.ResolveInfo; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 mDelegate.startFileIntent( | 199 mDelegate.startFileIntent( |
| 200 intent, params.getReferrerUrl(), params.getTab(), | 200 intent, params.getReferrerUrl(), params.getTab(), |
| 201 params.shouldCloseContentsOnOverrideUrlLoadingAndLaunchInten
t()); | 201 params.shouldCloseContentsOnOverrideUrlLoadingAndLaunchInten
t()); |
| 202 return OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION; | 202 return OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION; |
| 203 } | 203 } |
| 204 | 204 |
| 205 // http://crbug/331571 : Do not override a navigation started from user
typing. | 205 // http://crbug/331571 : Do not override a navigation started from user
typing. |
| 206 // http://crbug/424029 : Need to stay in Chrome for an intent heading ex
plicitly to Chrome. | 206 // http://crbug/424029 : Need to stay in Chrome for an intent heading ex
plicitly to Chrome. |
| 207 if (params.getRedirectHandler() != null) { | 207 if (params.getRedirectHandler() != null) { |
| 208 TabRedirectHandler handler = params.getRedirectHandler(); | 208 TabRedirectHandler handler = params.getRedirectHandler(); |
| 209 if (handler.isFromCustomTabIntent()) { | 209 if (handler.shouldStayInChrome(isExternalProtocol) |
| 210 // http://crbug.com/613667 : Custom tabs forbids external naviga
tion for the first | |
| 211 // url, unless the first url is a redirect. | |
| 212 if (!params.isRedirect()) return OverrideUrlLoadingResult.NO_OVE
RRIDE; | |
| 213 } else if (handler.shouldStayInChrome(isExternalProtocol) | |
| 214 || handler.shouldNotOverrideUrlLoading()) { | 210 || handler.shouldNotOverrideUrlLoading()) { |
| 215 return OverrideUrlLoadingResult.NO_OVERRIDE; | 211 return OverrideUrlLoadingResult.NO_OVERRIDE; |
| 216 } | 212 } |
| 217 } | 213 } |
| 218 | 214 |
| 219 // http://crbug.com/647569 : Stay in a PWA window for a URL within the s
ame scope. | 215 // http://crbug.com/647569 : Stay in a PWA window for a URL within the s
ame scope. |
| 220 if (mDelegate.isWithinCurrentWebappScope(params.getUrl())) { | 216 if (mDelegate.isWithinCurrentWebappScope(params.getUrl())) { |
| 221 return OverrideUrlLoadingResult.NO_OVERRIDE; | 217 return OverrideUrlLoadingResult.NO_OVERRIDE; |
| 222 } | 218 } |
| 223 | 219 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if (defaultSmsPackageName == null) return null; | 548 if (defaultSmsPackageName == null) return null; |
| 553 // Makes sure that the default SMS app actually resolves the intent. | 549 // Makes sure that the default SMS app actually resolves the intent. |
| 554 for (ResolveInfo resolveInfo : resolvingComponentNames) { | 550 for (ResolveInfo resolveInfo : resolvingComponentNames) { |
| 555 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam
e)) { | 551 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam
e)) { |
| 556 return defaultSmsPackageName; | 552 return defaultSmsPackageName; |
| 557 } | 553 } |
| 558 } | 554 } |
| 559 return null; | 555 return null; |
| 560 } | 556 } |
| 561 } | 557 } |
| OLD | NEW |