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

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

Issue 2727483002: Instant Apps: refactor logic to encapsulate in the Instant Apps Handler. (Closed)
Patch Set: Fix findbugs issue. Created 3 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 import org.chromium.ui.base.WindowAndroid.PermissionCallback; 52 import org.chromium.ui.base.WindowAndroid.PermissionCallback;
53 import org.chromium.webapk.lib.client.WebApkValidator; 53 import org.chromium.webapk.lib.client.WebApkValidator;
54 54
55 import java.util.ArrayList; 55 import java.util.ArrayList;
56 import java.util.List; 56 import java.util.List;
57 57
58 /** 58 /**
59 * The main implementation of the {@link ExternalNavigationDelegate}. 59 * The main implementation of the {@link ExternalNavigationDelegate}.
60 */ 60 */
61 public class ExternalNavigationDelegateImpl implements ExternalNavigationDelegat e { 61 public class ExternalNavigationDelegateImpl implements ExternalNavigationDelegat e {
62 // Instant Apps system resolver activity on N-MR1+.
63 @VisibleForTesting
64 static final String EPHEMERAL_INSTALLER_CLASS =
65 "com.google.android.gms.instantapps.routing.EphemeralInstallerActivi ty";
66 private static final String PDF_VIEWER = "com.google.android.apps.docs"; 62 private static final String PDF_VIEWER = "com.google.android.apps.docs";
67 private static final String PDF_MIME = "application/pdf"; 63 private static final String PDF_MIME = "application/pdf";
68 private static final String PDF_SUFFIX = ".pdf"; 64 private static final String PDF_SUFFIX = ".pdf";
69 private static final String PDF_EXTENSION = "pdf"; 65 private static final String PDF_EXTENSION = "pdf";
70 66
71 protected final Context mApplicationContext; 67 protected final Context mApplicationContext;
72 private final Tab mTab; 68 private final Tab mTab;
73 69
74 public ExternalNavigationDelegateImpl(Tab tab) { 70 public ExternalNavigationDelegateImpl(Tab tab) {
75 mTab = tab; 71 mTab = tab;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 continue; 276 continue;
281 } 277 }
282 278
283 if (!TextUtils.isEmpty(filterPackageName) 279 if (!TextUtils.isEmpty(filterPackageName)
284 && (info.activityInfo == null 280 && (info.activityInfo == null
285 || !info.activityInfo.packageName.equals(filterPa ckageName))) { 281 || !info.activityInfo.packageName.equals(filterPa ckageName))) {
286 continue; 282 continue;
287 } 283 }
288 284
289 if (info.activityInfo != null) { 285 if (info.activityInfo != null) {
290 if (EPHEMERAL_INSTALLER_CLASS.equals(info.activityInfo.name)) { 286 if (InstantAppsHandler.getInstance().isInstantAppResolveInfo(inf o)) {
291 // Don't consider the Instant Apps resolver a specialized ap plication. 287 // Don't consider the Instant Apps resolver a specialized ap plication.
292 continue; 288 continue;
293 } 289 }
294 290
295 result.add(info.activityInfo.packageName); 291 result.add(info.activityInfo.packageName);
296 } else { 292 } else {
297 result.add(""); 293 result.add("");
298 } 294 }
299 } 295 }
300 return result; 296 return result;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 * @param intent The bare intent we were going to send. 600 * @param intent The bare intent we were going to send.
605 */ 601 */
606 protected void dispatchAuthenticatedIntent(Intent intent) { 602 protected void dispatchAuthenticatedIntent(Intent intent) {
607 Intent proxyIntent = new Intent(Intent.ACTION_MAIN); 603 Intent proxyIntent = new Intent(Intent.ACTION_MAIN);
608 proxyIntent.setClass(getAvailableContext(), AuthenticatedProxyActivity.c lass); 604 proxyIntent.setClass(getAvailableContext(), AuthenticatedProxyActivity.c lass);
609 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 605 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
610 proxyIntent.putExtra(AuthenticatedProxyActivity.AUTHENTICATED_INTENT_EXT RA, intent); 606 proxyIntent.putExtra(AuthenticatedProxyActivity.AUTHENTICATED_INTENT_EXT RA, intent);
611 getAvailableContext().startActivity(proxyIntent); 607 getAvailableContext().startActivity(proxyIntent);
612 } 608 }
613 } 609 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698