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

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

Issue 2026953002: Disable external navigation for file downloads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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
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.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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // http://crbug.com/441284 : Disallow firing external intent while Chrom e is in the 142 // http://crbug.com/441284 : Disallow firing external intent while Chrom e is in the
143 // background. 143 // background.
144 if (params.isApplicationMustBeInForeground() && !mDelegate.isChromeAppIn Foreground()) { 144 if (params.isApplicationMustBeInForeground() && !mDelegate.isChromeAppIn Foreground()) {
145 return OverrideUrlLoadingResult.NO_OVERRIDE; 145 return OverrideUrlLoadingResult.NO_OVERRIDE;
146 } 146 }
147 // http://crbug.com/464669 : Disallow firing external intent from backgr ound tab. 147 // http://crbug.com/464669 : Disallow firing external intent from backgr ound tab.
148 if (params.isBackgroundTabNavigation()) { 148 if (params.isBackgroundTabNavigation()) {
149 return OverrideUrlLoadingResult.NO_OVERRIDE; 149 return OverrideUrlLoadingResult.NO_OVERRIDE;
150 } 150 }
151 151
152 // http://crbug.com/605302 : Allow Chrome to handle all pdf file downloa ds.
153 if (mDelegate.isPdfDownload(params.getUrl())) {
154 return OverrideUrlLoadingResult.NO_OVERRIDE;
155 }
156
152 // pageTransition is a combination of an enumeration (core value) and bi tmask. 157 // pageTransition is a combination of an enumeration (core value) and bi tmask.
153 int pageTransitionCore = params.getPageTransition() & PageTransition.COR E_MASK; 158 int pageTransitionCore = params.getPageTransition() & PageTransition.COR E_MASK;
154 boolean isLink = pageTransitionCore == PageTransition.LINK; 159 boolean isLink = pageTransitionCore == PageTransition.LINK;
155 boolean isFormSubmit = pageTransitionCore == PageTransition.FORM_SUBMIT; 160 boolean isFormSubmit = pageTransitionCore == PageTransition.FORM_SUBMIT;
156 boolean isFromIntent = (params.getPageTransition() & PageTransition.FROM _API) != 0; 161 boolean isFromIntent = (params.getPageTransition() & PageTransition.FROM _API) != 0;
157 boolean isForwardBackNavigation = 162 boolean isForwardBackNavigation =
158 (params.getPageTransition() & PageTransition.FORWARD_BACK) != 0; 163 (params.getPageTransition() & PageTransition.FORWARD_BACK) != 0;
159 boolean isExternalProtocol = !UrlUtilities.isAcceptedScheme(params.getUr l()); 164 boolean isExternalProtocol = !UrlUtilities.isAcceptedScheme(params.getUr l());
160 165
161 // http://crbug.com/169549 : If you type in a URL that then redirects in server side to an 166 // http://crbug.com/169549 : If you type in a URL that then redirects in server side to an
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 if (defaultSmsPackageName == null) return null; 474 if (defaultSmsPackageName == null) return null;
470 // Makes sure that the default SMS app actually resolves the intent. 475 // Makes sure that the default SMS app actually resolves the intent.
471 for (ResolveInfo resolveInfo : resolvingComponentNames) { 476 for (ResolveInfo resolveInfo : resolvingComponentNames) {
472 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam e)) { 477 if (defaultSmsPackageName.equals(resolveInfo.activityInfo.packageNam e)) {
473 return defaultSmsPackageName; 478 return defaultSmsPackageName;
474 } 479 }
475 } 480 }
476 return null; 481 return null;
477 } 482 }
478 } 483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698