Chromium Code Reviews| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 // Sanitize the Intent, ensuring web pages can not bypass browser | 298 // Sanitize the Intent, ensuring web pages can not bypass browser |
| 299 // security (only access to BROWSABLE activities). | 299 // security (only access to BROWSABLE activities). |
| 300 intent.addCategory(Intent.CATEGORY_BROWSABLE); | 300 intent.addCategory(Intent.CATEGORY_BROWSABLE); |
| 301 intent.setComponent(null); | 301 intent.setComponent(null); |
| 302 Intent selector = intent.getSelector(); | 302 Intent selector = intent.getSelector(); |
| 303 if (selector != null) { | 303 if (selector != null) { |
| 304 selector.addCategory(Intent.CATEGORY_BROWSABLE); | 304 selector.addCategory(Intent.CATEGORY_BROWSABLE); |
| 305 selector.setComponent(null); | 305 selector.setComponent(null); |
| 306 } | 306 } |
| 307 | 307 |
| 308 List<ResolveInfo> resolvingInfos = mDelegate.queryIntentActivities(inten t); | 308 List<ResolveInfo> resolvingInfos = null; |
| 309 try { | |
| 310 resolvingInfos = mDelegate.queryIntentActivities(intent); | |
|
Maria
2016/10/10 21:31:36
I think we should do this try / catch in ExternalN
Ted C
2016/10/10 21:43:52
I was thinking that it was weird to introduce null
| |
| 311 } catch (RuntimeException ex) { | |
| 312 IntentUtils.logTransactionTooLargeOrRethrow(ex, intent); | |
| 313 return OverrideUrlLoadingResult.NO_OVERRIDE; | |
| 314 } | |
| 315 | |
| 309 boolean canResolveActivity = resolvingInfos.size() > 0; | 316 boolean canResolveActivity = resolvingInfos.size() > 0; |
| 310 // check whether the intent can be resolved. If not, we will see | 317 // check whether the intent can be resolved. If not, we will see |
| 311 // whether we can download it from the Market. | 318 // whether we can download it from the Market. |
| 312 if (!canResolveActivity) { | 319 if (!canResolveActivity) { |
| 313 if (hasBrowserFallbackUrl) { | 320 if (hasBrowserFallbackUrl) { |
| 314 return clobberCurrentTabWithFallbackUrl(browserFallbackUrl, para ms); | 321 return clobberCurrentTabWithFallbackUrl(browserFallbackUrl, para ms); |
| 315 } | 322 } |
| 316 | 323 |
| 317 String packagename = intent.getPackage(); | 324 String packagename = intent.getPackage(); |
| 318 if (packagename != null) { | 325 if (packagename != null) { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 if (defaultSmsPackageName == null) return null; | 559 if (defaultSmsPackageName == null) return null; |
| 553 // Makes sure that the default SMS app actually resolves the intent. | 560 // Makes sure that the default SMS app actually resolves the intent. |
| 554 for (ResolveInfo resolveInfo : resolvingComponentNames) { | 561 for (ResolveInfo resolveInfo : resolvingComponentNames) { |
| 555 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam e)) { | 562 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam e)) { |
| 556 return defaultSmsPackageName; | 563 return defaultSmsPackageName; |
| 557 } | 564 } |
| 558 } | 565 } |
| 559 return null; | 566 return null; |
| 560 } | 567 } |
| 561 } | 568 } |
| OLD | NEW |