Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java

Issue 1786813003: Fix bug in specialized handler logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.Manifest.permission; 7 import android.Manifest.permission;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.DialogInterface; 10 import android.content.DialogInterface;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 @Override 214 @Override
215 public boolean willChromeHandleIntent(Intent intent) { 215 public boolean willChromeHandleIntent(Intent intent) {
216 return willChromeHandleIntent(mApplicationContext, intent, false); 216 return willChromeHandleIntent(mApplicationContext, intent, false);
217 } 217 }
218 218
219 @Override 219 @Override
220 public boolean isSpecializedHandlerAvailable(List<ResolveInfo> infos) { 220 public boolean isSpecializedHandlerAvailable(List<ResolveInfo> infos) {
221 return isPackageSpecializedHandler(infos, null); 221 return isPackageSpecializedHandler(infos, null);
222 } 222 }
223 223
224 private static boolean isPackageSpecializedHandler(List<ResolveInfo> handler s, 224 static boolean isPackageSpecializedHandler(List<ResolveInfo> handlers,
225 String packageName) { 225 String packageName) {
226 if (handlers == null || handlers.size() == 0) return false; 226 if (handlers == null || handlers.size() == 0) return false;
227 for (ResolveInfo resolveInfo : handlers) { 227 for (ResolveInfo resolveInfo : handlers) {
228 IntentFilter filter = resolveInfo.filter; 228 IntentFilter filter = resolveInfo.filter;
229 if (filter == null) { 229 if (filter == null) {
230 // No intent filter matches this intent? 230 // No intent filter matches this intent?
231 // Error on the side of staying in the browser, ignore 231 // Error on the side of staying in the browser, ignore
232 continue; 232 continue;
233 } 233 }
234 if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) { 234 if (filter.countDataAuthorities() == 0 && filter.countDataPaths() == 0) {
235 // Generic handler, skip 235 // Generic handler, skip
236 continue; 236 continue;
237 } 237 }
238 if (TextUtils.isEmpty(packageName)) return true; 238 if (TextUtils.isEmpty(packageName)) return true;
239 ActivityInfo activityInfo = resolveInfo.activityInfo; 239 ActivityInfo activityInfo = resolveInfo.activityInfo;
240 if (activityInfo == null) continue; 240 if (activityInfo == null) continue;
241 if (!activityInfo.packageName.equals(packageName)) continue; 241 if (!activityInfo.packageName.equals(packageName)) continue;
242 return true; 242 return true;
243 } 243 }
244 244
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 } 461 }
462 462
463 private void closeTab(Tab tab) { 463 private void closeTab(Tab tab) {
464 Context context = tab.getWindowAndroid().getContext().get(); 464 Context context = tab.getWindowAndroid().getContext().get();
465 if (context instanceof ChromeActivity) { 465 if (context instanceof ChromeActivity) {
466 ((ChromeActivity) context).getTabModelSelector().closeTab(tab); 466 ((ChromeActivity) context).getTabModelSelector().closeTab(tab);
467 } 467 }
468 } 468 }
469 } 469 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698