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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 if (handler.isFromCustomTabIntent()) { | 209 if (handler.isFromCustomTabIntent()) { |
210 // http://crbug.com/613667 : Custom tabs forbids external naviga
tion for the first | 210 // http://crbug.com/613667 : Custom tabs forbids external naviga
tion for the first |
211 // url, unless the first url is a redirect. | 211 // url, unless the first url is a redirect. |
212 if (!params.isRedirect()) return OverrideUrlLoadingResult.NO_OVE
RRIDE; | 212 if (!params.isRedirect()) return OverrideUrlLoadingResult.NO_OVE
RRIDE; |
213 } else if (handler.shouldStayInChrome(isExternalProtocol) | 213 } else if (handler.shouldStayInChrome(isExternalProtocol) |
214 || handler.shouldNotOverrideUrlLoading()) { | 214 || handler.shouldNotOverrideUrlLoading()) { |
215 return OverrideUrlLoadingResult.NO_OVERRIDE; | 215 return OverrideUrlLoadingResult.NO_OVERRIDE; |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
| 219 // http://crbug.com/647569 : Stay in a PWA window for a URL within the s
ame scope. |
| 220 if (mDelegate.isWithinCurrentWebappScope(params.getUrl())) { |
| 221 return OverrideUrlLoadingResult.NO_OVERRIDE; |
| 222 } |
| 223 |
219 // http://crbug.com/149218: We want to show the intent picker for ordina
ry links, providing | 224 // http://crbug.com/149218: We want to show the intent picker for ordina
ry links, providing |
220 // the link is not an incoming intent from another application, unless i
t's a redirect (see | 225 // the link is not an incoming intent from another application, unless i
t's a redirect (see |
221 // below). | 226 // below). |
222 boolean linkNotFromIntent = isLink && !isFromIntent; | 227 boolean linkNotFromIntent = isLink && !isFromIntent; |
223 | 228 |
224 boolean isOnEffectiveIntentRedirect = params.getRedirectHandler() == nul
l ? false | 229 boolean isOnEffectiveIntentRedirect = params.getRedirectHandler() == nul
l ? false |
225 : params.getRedirectHandler().isOnEffectiveIntentRedirectChain()
; | 230 : params.getRedirectHandler().isOnEffectiveIntentRedirectChain()
; |
226 | 231 |
227 // http://crbug.com/170925: We need to show the intent picker when we re
ceive an intent from | 232 // http://crbug.com/170925: We need to show the intent picker when we re
ceive an intent from |
228 // another app that 30x redirects to a YouTube/Google Maps/Play Store/Go
ogle+ URL etc. | 233 // another app that 30x redirects to a YouTube/Google Maps/Play Store/Go
ogle+ URL etc. |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 if (defaultSmsPackageName == null) return null; | 536 if (defaultSmsPackageName == null) return null; |
532 // Makes sure that the default SMS app actually resolves the intent. | 537 // Makes sure that the default SMS app actually resolves the intent. |
533 for (ResolveInfo resolveInfo : resolvingComponentNames) { | 538 for (ResolveInfo resolveInfo : resolvingComponentNames) { |
534 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam
e)) { | 539 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam
e)) { |
535 return defaultSmsPackageName; | 540 return defaultSmsPackageName; |
536 } | 541 } |
537 } | 542 } |
538 return null; | 543 return null; |
539 } | 544 } |
540 } | 545 } |
OLD | NEW |