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

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

Issue 2536373006: Instant apps: cleanup an unused parameter. (Closed)
Patch Set: Created 4 years 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 return PDF_EXTENSION.equals(fileExtension); 544 return PDF_EXTENSION.equals(fileExtension);
545 } 545 }
546 546
547 @Override 547 @Override
548 public void maybeRecordAppHandlersInIntent(Intent intent, List<ResolveInfo> infos) { 548 public void maybeRecordAppHandlersInIntent(Intent intent, List<ResolveInfo> infos) {
549 intent.putExtra(IntentHandler.EXTRA_EXTERNAL_NAV_PACKAGES, 549 intent.putExtra(IntentHandler.EXTRA_EXTERNAL_NAV_PACKAGES,
550 getSpecializedHandlersWithFilter(infos, null)); 550 getSpecializedHandlersWithFilter(infos, null));
551 } 551 }
552 552
553 @Override 553 @Override
554 public boolean isSerpReferrer(String referrerUrl, Tab tab) { 554 public boolean isSerpReferrer(Tab tab) {
555 if (tab == null || tab.getWebContents() == null) { 555 if (tab == null || tab.getWebContents() == null) return false;
556 return false;
557 }
558 556
559 NavigationController nController = tab.getWebContents().getNavigationCon troller(); 557 NavigationController nController = tab.getWebContents().getNavigationCon troller();
560 int index = nController.getLastCommittedEntryIndex(); 558 int index = nController.getLastCommittedEntryIndex();
561 if (index == -1) return false; 559 if (index == -1) return false;
562 560
563 NavigationEntry entry = nController.getEntryAtIndex(index); 561 NavigationEntry entry = nController.getEntryAtIndex(index);
564 if (entry == null) return false; 562 if (entry == null) return false;
565 563
566 return UrlUtilities.nativeIsGoogleSearchUrl(entry.getUrl()); 564 return UrlUtilities.nativeIsGoogleSearchUrl(entry.getUrl());
567 } 565 }
568 566
569 @Override 567 @Override
570 public boolean maybeLaunchInstantApp(Tab tab, String url, String referrerUrl , 568 public boolean maybeLaunchInstantApp(Tab tab, String url, String referrerUrl ,
571 boolean isIncomingRedirect) { 569 boolean isIncomingRedirect) {
572 if (tab == null || tab.getWebContents() == null) return false; 570 if (tab == null || tab.getWebContents() == null) return false;
573 571
574 InstantAppsHandler handler = InstantAppsHandler.getInstance(); 572 InstantAppsHandler handler = InstantAppsHandler.getInstance();
575 Intent intent = tab.getTabRedirectHandler() != null 573 Intent intent = tab.getTabRedirectHandler() != null
576 ? tab.getTabRedirectHandler().getInitialIntent() : null; 574 ? tab.getTabRedirectHandler().getInitialIntent() : null;
577 // TODO(mariakhomenko): consider also handling NDEF_DISCOVER action redi rects. 575 // TODO(mariakhomenko): consider also handling NDEF_DISCOVER action redi rects.
578 if (isIncomingRedirect && intent != null && intent.getAction() == Intent .ACTION_VIEW) { 576 if (isIncomingRedirect && intent != null && intent.getAction() == Intent .ACTION_VIEW) {
579 // Set the URL the redirect was resolved to for checking the existen ce of the 577 // Set the URL the redirect was resolved to for checking the existen ce of the
580 // instant app inside handleIncomingIntent(). 578 // instant app inside handleIncomingIntent().
581 Intent resolvedIntent = new Intent(intent); 579 Intent resolvedIntent = new Intent(intent);
582 resolvedIntent.setData(Uri.parse(url)); 580 resolvedIntent.setData(Uri.parse(url));
583 return handler.handleIncomingIntent(getAvailableContext(), resolvedI ntent, 581 return handler.handleIncomingIntent(getAvailableContext(), resolvedI ntent,
584 ChromeLauncherActivity.isCustomTabIntent(resolvedIntent)); 582 ChromeLauncherActivity.isCustomTabIntent(resolvedIntent));
585 } else if (!isIncomingRedirect) { 583 } else if (!isIncomingRedirect) {
586 // Check if the navigation is coming from SERP and skip instant app handling. 584 // Check if the navigation is coming from SERP and skip instant app handling.
587 if (isSerpReferrer(referrerUrl, tab)) return false; 585 if (isSerpReferrer(tab)) return false;
588 return handler.handleNavigation( 586 return handler.handleNavigation(
589 getAvailableContext(), url, 587 getAvailableContext(), url,
590 TextUtils.isEmpty(referrerUrl) ? null : Uri.parse(referrerUr l), 588 TextUtils.isEmpty(referrerUrl) ? null : Uri.parse(referrerUr l),
591 tab.getWebContents()); 589 tab.getWebContents());
592 } 590 }
593 return false; 591 return false;
594 } 592 }
595 593
596 /** 594 /**
597 * Dispatches the intent through a proxy activity, so that startActivityForR esult can be used 595 * Dispatches the intent through a proxy activity, so that startActivityForR esult can be used
598 * and the intent recipient can verify the caller. 596 * and the intent recipient can verify the caller.
599 * @param intent The bare intent we were going to send. 597 * @param intent The bare intent we were going to send.
600 */ 598 */
601 protected void dispatchAuthenticatedIntent(Intent intent) { 599 protected void dispatchAuthenticatedIntent(Intent intent) {
602 Intent proxyIntent = new Intent(Intent.ACTION_MAIN); 600 Intent proxyIntent = new Intent(Intent.ACTION_MAIN);
603 proxyIntent.setClass(getAvailableContext(), AuthenticatedProxyActivity.c lass); 601 proxyIntent.setClass(getAvailableContext(), AuthenticatedProxyActivity.c lass);
604 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 602 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
605 proxyIntent.putExtra(AuthenticatedProxyActivity.AUTHENTICATED_INTENT_EXT RA, intent); 603 proxyIntent.putExtra(AuthenticatedProxyActivity.AUTHENTICATED_INTENT_EXT RA, intent);
606 getAvailableContext().startActivity(proxyIntent); 604 getAvailableContext().startActivity(proxyIntent);
607 } 605 }
608 } 606 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698