Commit 9bd31cfc authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

[Android] Smooth path for AuthenticatorNavigationInterceptor c14n

We are shortly going to componentize the
AuthenticatorNavigationInterceptor interface for reuse by WebLayer.
However, this interface is used downstream: it is both implemented
and returned by an implementation of
AppHooks#createAuthenticatorNavigationInterceptor(). This CL paves the
road for allowing this componentization to occur upstream without
breaking downstream:

- We introduce an identical //components-level interface.
- We add a new method to AppHooks that returns an instance of the
  //components-level interface.

Downstream we can then have the subclass implement both the //chrome-
and //components-level interfaces, and implement the new AppHooks
method by returning the instance of the subclass (like the
implementation of the current AppHooks method). This will in turn
allow us to transition upstream to talking in terms of the
//components-level interface without breaking downstream. Finally, we
will be able to clean up by removing the upstream interface and all
references to it downstream, followed by removing them upstream.

A happy technical note: As git does content-based similarity
comparisons, it picks up the new file as being the same as the
//chrome-level one (i.e. git log --follow on the new file shows the
history of the //chrome-level one).

Bug: 1031465
Change-Id: Ifc843a550a3b96c5cbeb62cde6a3a1b140614db1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144172
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758174}
parent f13dee83
...@@ -45,7 +45,6 @@ import org.chromium.chrome.browser.rlz.RevenueStats; ...@@ -45,7 +45,6 @@ import org.chromium.chrome.browser.rlz.RevenueStats;
import org.chromium.chrome.browser.signin.GoogleActivityController; import org.chromium.chrome.browser.signin.GoogleActivityController;
import org.chromium.chrome.browser.survey.SurveyController; import org.chromium.chrome.browser.survey.SurveyController;
import org.chromium.chrome.browser.sync.TrustedVaultClient; import org.chromium.chrome.browser.sync.TrustedVaultClient;
import org.chromium.chrome.browser.tab.AuthenticatorNavigationInterceptor;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.ui.ImmersiveModeManager; import org.chromium.chrome.browser.ui.ImmersiveModeManager;
import org.chromium.chrome.browser.usage_stats.DigitalWellbeingClient; import org.chromium.chrome.browser.usage_stats.DigitalWellbeingClient;
...@@ -111,8 +110,22 @@ public abstract class AppHooks { ...@@ -111,8 +110,22 @@ public abstract class AppHooks {
/** /**
* Return a {@link AuthenticatorNavigationInterceptor} for the given {@link Tab}. * Return a {@link AuthenticatorNavigationInterceptor} for the given {@link Tab}.
* This can be null if there are no applicable interceptor to be built. * This can be null if there are no applicable interceptor to be built.
* NOTE: This method will be transitioned to talk in terms of the //components-level interface
* once downstream has been transitioned.
*/ */
public AuthenticatorNavigationInterceptor createAuthenticatorNavigationInterceptor(Tab tab) { public org.chromium.chrome.browser.tab.AuthenticatorNavigationInterceptor
createAuthenticatorNavigationInterceptor(Tab tab) {
return null;
}
/**
* Return a {@link AuthenticatorNavigationInterceptor} for the given {@link Tab}.
* This can be null if there are no applicable interceptor to be built.
* NOTE: This method exists only to allow downstream to transition to talking in terms of the
* //components-level interface. It will be deleted once the transition is complete.
*/
public org.chromium.components.external_intents.AuthenticatorNavigationInterceptor
createAuthenticatorNavigationInterceptorV2(Tab tab) {
return null; return null;
} }
......
...@@ -6,6 +6,9 @@ package org.chromium.chrome.browser.tab; ...@@ -6,6 +6,9 @@ package org.chromium.chrome.browser.tab;
/** /**
* Handles intercepting navigation requests for an external authenticator application. * Handles intercepting navigation requests for an external authenticator application.
* NOTE: DO NOT CHANGE ANYTHING IN THIS INTERFACE. It will be removed in favor of the identical one
* in //components once downstream has been transitioned to use the //components-level one rather
* than this one.
*/ */
public interface AuthenticatorNavigationInterceptor { public interface AuthenticatorNavigationInterceptor {
/** /**
......
...@@ -6,6 +6,7 @@ import("//build/config/android/rules.gni") ...@@ -6,6 +6,7 @@ import("//build/config/android/rules.gni")
android_library("java") { android_library("java") {
sources = [ sources = [
"java/src/org/chromium/components/external_intents/AuthenticatorNavigationInterceptor.java",
"java/src/org/chromium/components/external_intents/ExternalIntentsFeatureList.java", "java/src/org/chromium/components/external_intents/ExternalIntentsFeatureList.java",
"java/src/org/chromium/components/external_intents/ExternalIntentsSwitches.java", "java/src/org/chromium/components/external_intents/ExternalIntentsSwitches.java",
"java/src/org/chromium/components/external_intents/ExternalNavigationDelegate.java", "java/src/org/chromium/components/external_intents/ExternalNavigationDelegate.java",
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.components.external_intents;
/**
* Handles intercepting navigation requests for an external authenticator application.
* NOTE: DO NOT CHANGE ANYTHING IN THIS INTERFACE. It needs to stay identical to the one in //chrome
* until downstream has been transitioned to use this one, at which point this comment will be
* eliminated.
*/
public interface AuthenticatorNavigationInterceptor {
/**
* To be called by a Tab to check whether the passed in URL, which is about to be loaded,
* should be processed by an external Authenticator application.
*
* @param url the URL about to be loaded in the tab
* @return True if the URL has been handled by the Authenticator, false if it hasn't and
* should be processed normally by the Tab.
*/
boolean handleAuthenticatorUrl(String url);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment