| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 mDelegate.queryIntentActivities(previousInte
nt))) { | 450 mDelegate.queryIntentActivities(previousInte
nt))) { |
| 451 return OverrideUrlLoadingResult.NO_OVERRIDE; | 451 return OverrideUrlLoadingResult.NO_OVERRIDE; |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 boolean isDirectInstantAppsIntent = isExternalProtocol | 457 boolean isDirectInstantAppsIntent = isExternalProtocol |
| 458 && SUPERVISOR_PKG.equals(intent.getPackage()); | 458 && SUPERVISOR_PKG.equals(intent.getPackage()); |
| 459 boolean shouldProxyForInstantApps = isDirectInstantAppsIntent | 459 boolean shouldProxyForInstantApps = isDirectInstantAppsIntent |
| 460 && mDelegate.isSerpReferrer(params.getReferrerUrl(), params.getT
ab()); | 460 && mDelegate.isSerpReferrer(params.getTab()); |
| 461 if (shouldProxyForInstantApps) { | 461 if (shouldProxyForInstantApps) { |
| 462 intent.putExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER, true); | 462 intent.putExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER, true); |
| 463 } else if (isDirectInstantAppsIntent) { | 463 } else if (isDirectInstantAppsIntent) { |
| 464 // For security reasons, we disable all intent:// URLs to Instant Ap
ps that are | 464 // For security reasons, we disable all intent:// URLs to Instant Ap
ps that are |
| 465 // not coming from SERP. | 465 // not coming from SERP. |
| 466 return OverrideUrlLoadingResult.NO_OVERRIDE; | 466 return OverrideUrlLoadingResult.NO_OVERRIDE; |
| 467 } else { | 467 } else { |
| 468 // Make sure this extra is not sent unless we've done the verificati
on. | 468 // Make sure this extra is not sent unless we've done the verificati
on. |
| 469 intent.removeExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER); | 469 intent.removeExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER); |
| 470 } | 470 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 if (defaultSmsPackageName == null) return null; | 589 if (defaultSmsPackageName == null) return null; |
| 590 // Makes sure that the default SMS app actually resolves the intent. | 590 // Makes sure that the default SMS app actually resolves the intent. |
| 591 for (ResolveInfo resolveInfo : resolvingComponentNames) { | 591 for (ResolveInfo resolveInfo : resolvingComponentNames) { |
| 592 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam
e)) { | 592 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam
e)) { |
| 593 return defaultSmsPackageName; | 593 return defaultSmsPackageName; |
| 594 } | 594 } |
| 595 } | 595 } |
| 596 return null; | 596 return null; |
| 597 } | 597 } |
| 598 } | 598 } |
| OLD | NEW |