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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // startActivityIfNeeded or startActivity. | 390 // startActivityIfNeeded or startActivity. |
391 if (!isExternalProtocol) { | 391 if (!isExternalProtocol) { |
392 if (!mDelegate.isSpecializedHandlerAvailable(resolvingInfos)) { | 392 if (!mDelegate.isSpecializedHandlerAvailable(resolvingInfos)) { |
393 if (params.webApkPackageName() != null) { | 393 if (params.webApkPackageName() != null) { |
394 intent.setPackage(mDelegate.getPackageName()); | 394 intent.setPackage(mDelegate.getPackageName()); |
395 mDelegate.startActivity(intent); | 395 mDelegate.startActivity(intent); |
396 return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTEN
T; | 396 return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTEN
T; |
397 } | 397 } |
398 | 398 |
399 if (linkNotFromIntent && !params.isIncognito() && mDelegate.mayb
eLaunchInstantApp( | 399 if (linkNotFromIntent && !params.isIncognito() && mDelegate.mayb
eLaunchInstantApp( |
400 params.getUrl(), params.getReferrerUrl())) { | 400 params.getTab(), params.getUrl(), params.getReferrerUrl(
))) { |
401 return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTEN
T; | 401 return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTEN
T; |
402 } | 402 } |
403 | 403 |
404 return OverrideUrlLoadingResult.NO_OVERRIDE; | 404 return OverrideUrlLoadingResult.NO_OVERRIDE; |
405 } | 405 } |
406 | 406 |
407 if (params.getReferrerUrl() != null && (isLink || isFormSubmit)) { | 407 if (params.getReferrerUrl() != null && (isLink || isFormSubmit)) { |
408 // Current URL has at least one specialized handler available. F
or navigations | 408 // Current URL has at least one specialized handler available. F
or navigations |
409 // within the same host, keep the navigation inside the browser
unless the set of | 409 // within the same host, keep the navigation inside the browser
unless the set of |
410 // available apps to handle the new navigation is different. htt
p://crbug.com/463138 | 410 // available apps to handle the new navigation is different. htt
p://crbug.com/463138 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 if (defaultSmsPackageName == null) return null; | 552 if (defaultSmsPackageName == null) return null; |
553 // Makes sure that the default SMS app actually resolves the intent. | 553 // Makes sure that the default SMS app actually resolves the intent. |
554 for (ResolveInfo resolveInfo : resolvingComponentNames) { | 554 for (ResolveInfo resolveInfo : resolvingComponentNames) { |
555 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam
e)) { | 555 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam
e)) { |
556 return defaultSmsPackageName; | 556 return defaultSmsPackageName; |
557 } | 557 } |
558 } | 558 } |
559 return null; | 559 return null; |
560 } | 560 } |
561 } | 561 } |
OLD | NEW |