diff --git a/android/brave_java_sources.gni b/android/brave_java_sources.gni index 081b9a7af41a..2ca0a981941b 100644 --- a/android/brave_java_sources.gni +++ b/android/brave_java_sources.gni @@ -14,6 +14,7 @@ brave_java_sources = [ "../../brave/android/java/org/chromium/chrome/browser/BraveBadge.java", "../../brave/android/java/org/chromium/chrome/browser/BraveFeatureList.java", "../../brave/android/java/org/chromium/chrome/browser/BraveHelper.java", + "../../brave/android/java/org/chromium/chrome/browser/BraveIntentHandler.java", "../../brave/android/java/org/chromium/chrome/browser/BraveRelaunchUtils.java", "../../brave/android/java/org/chromium/chrome/browser/BraveSyncWorker.java", "../../brave/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java", diff --git a/android/java/org/chromium/chrome/browser/BraveIntentHandler.java b/android/java/org/chromium/chrome/browser/BraveIntentHandler.java new file mode 100644 index 000000000000..f8db1adc38cc --- /dev/null +++ b/android/java/org/chromium/chrome/browser/BraveIntentHandler.java @@ -0,0 +1,30 @@ +/* Copyright (c) 2020 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.chromium.chrome.browser; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; + +public class BraveIntentHandler extends IntentHandler { + private static final String CONNECTION_INFO_HELP_URL = + "https://support.google.com/chrome?p=android_connection_info"; + private static final String BRAVE_CONNECTION_INFO_HELP_URL = + "https://support.brave.com/hc/en-us/articles/360018185871-How-do-I-check-if-a-site-s-connection-is-secure-"; + + public BraveIntentHandler(IntentHandlerDelegate delegate, String packageName) { + super(delegate, packageName); + } + + public boolean onNewIntent(Intent intent) { + // Redirect requests if necessary + String url = getUrlFromIntent(intent); + if (url != null && url.equals(CONNECTION_INFO_HELP_URL)) { + intent.setData(Uri.parse(BRAVE_CONNECTION_INFO_HELP_URL)); + } + return super.onNewIntent(intent); + } +} diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeActivity.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeActivity.java.patch new file mode 100644 index 000000000000..c0558aeac98a --- /dev/null +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeActivity.java.patch @@ -0,0 +1,13 @@ +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java +index 3fdc4ba9b8005026571356579e2a0ca645746d55..228d4a0702ae126bdf7665da6e7fe2b211602ff9 100644 +--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java +@@ -758,7 +758,7 @@ public abstract class ChromeActivity + + IntentHandler.setTestIntentsEnabled( + CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)); +- mIntentHandler = new IntentHandler(createIntentHandlerDelegate(), getPackageName()); ++ mIntentHandler = new BraveIntentHandler(createIntentHandlerDelegate(), getPackageName()); + + // This also ensures that subsequent native library and resource loading takes place + // immediately, needed by restored tabs that use DFM.