From fb5839d5ebb91408fcea203a3d9dca98074d088e Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Tue, 26 Oct 2021 22:55:06 +0200 Subject: [PATCH] Release 94.0.4606.109 --- CHANGELOG.md | 5 + build/RELEASE | 2 +- build/bromite_patches_list.txt | 3 +- .../Automated-domain-substitution.patch | 30 +- build/patches/Bromite-auto-updater.patch | 4 +- .../Enable-native-Android-autofill.patch | 490 ++++++++++++++++++ ...> Experimental-user-scripts-support.patch} | 35 +- ...-support-for-ISupportHelpAndFeedback.patch | 44 -- 8 files changed, 531 insertions(+), 82 deletions(-) create mode 100644 build/patches/Enable-native-Android-autofill.patch rename build/patches/{experimental-user-scripts-support.patch => Experimental-user-scripts-support.patch} (99%) delete mode 100644 build/patches/add-support-for-ISupportHelpAndFeedback.patch diff --git a/CHANGELOG.md b/CHANGELOG.md index 84817594..58cdd29a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 94.0.4606.109 +* experimental user scripts support (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/792) +* Bromite auto-update notifications enabled by default +* enable Android native autofill (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/547) + # 94.0.4606.102 * add flag to disable pull-to-refresh effect * add recents, offlinepage and send to home screen for always incognito (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1182 and https://github.com/bromite/bromite/issues/1362) diff --git a/build/RELEASE b/build/RELEASE index 44c135c5..95485dae 100644 --- a/build/RELEASE +++ b/build/RELEASE @@ -1 +1 @@ -94.0.4606.102 +94.0.4606.109 diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index f3a7aea9..c9f518e0 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -161,5 +161,6 @@ Enable-share-intent.patch Site-setting-for-images.patch Bromite-auto-updater.patch Add-flag-to-disable-pull-to-refresh-effect.patch +Experimental-user-scripts-support.patch +Enable-native-Android-autofill.patch Automated-domain-substitution.patch -experimental-user-scripts-support.patch diff --git a/build/patches/Automated-domain-substitution.patch b/build/patches/Automated-domain-substitution.patch index bf9203f3..b858f041 100644 --- a/build/patches/Automated-domain-substitution.patch +++ b/build/patches/Automated-domain-substitution.patch @@ -4239,7 +4239,7 @@ diff --git a/chrome/app/theme/PRESUBMIT.py b/chrome/app/theme/PRESUBMIT.py diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -323,14 +323,14 @@ const FeatureEntry::Choice kTouchTextSelectionStrategyChoices[] = { +@@ -324,14 +324,14 @@ const FeatureEntry::Choice kTouchTextSelectionStrategyChoices[] = { const FeatureEntry::Choice kTraceUploadURL[] = { {flags_ui::kGenericExperimentChoiceDisabled, "", ""}, {flag_descriptions::kTraceUploadUrlChoiceOther, switches::kTraceUploadURL, @@ -4258,7 +4258,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc const FeatureEntry::Choice kLiteVideoDefaultDownlinkBandwidthKbps[] = { {flags_ui::kGenericExperimentChoiceDefault, "", ""}, -@@ -3712,7 +3712,7 @@ const FeatureEntry kFeatureEntries[] = { +@@ -3713,7 +3713,7 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kSyncSandboxDescription, kOsAll, SINGLE_VALUE_TYPE_AND_VALUE( switches::kSyncServiceURL, @@ -4267,7 +4267,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc #if !defined(OS_ANDROID) {"media-router-cast-allow-all-ips", flag_descriptions::kMediaRouterCastAllowAllIPsName, -@@ -3920,7 +3920,7 @@ const FeatureEntry kFeatureEntries[] = { +@@ -3921,7 +3921,7 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kSetMarketUrlForTestingName, flag_descriptions::kSetMarketUrlForTestingDescription, kOsAndroid, SINGLE_VALUE_TYPE_AND_VALUE(switches::kMarketUrlForTesting, @@ -8203,7 +8203,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro CHAR_LIMIT guidelines: Certain strings need character limits to prevent a long translation from breaking the UI. -@@ -911,7 +911,7 @@ Privacy Sandbox trials are still in active development and are available in sele +@@ -914,7 +914,7 @@ Privacy Sandbox trials are still in active development and are available in sele Choose another provider @@ -8212,7 +8212,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro This setting is disabled on managed browsers -@@ -948,7 +948,7 @@ Privacy Sandbox trials are still in active development and are available in sele +@@ -951,7 +951,7 @@ Privacy Sandbox trials are still in active development and are available in sele The selected data has been removed from Chrome and your synced devices. @@ -8221,7 +8221,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro Cached images and files -@@ -991,10 +991,10 @@ Your Google account may have other forms of browsing history like searches and a +@@ -994,10 +994,10 @@ Your Google account may have other forms of browsing history like searches and a Record history even in incognito mode @@ -8234,7 +8234,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro <link1>Search history</link1> and <link2>other forms of activity</link2> may be saved in your Google Account when you’re signed in. You can delete them anytime. -@@ -1063,7 +1063,7 @@ Your Google account may have other forms of browsing history like searches and a +@@ -1066,7 +1066,7 @@ Your Google account may have other forms of browsing history like searches and a Basic @@ -8243,7 +8243,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro Blocked site -@@ -1485,7 +1485,7 @@ Your Google account may have other forms of browsing history like searches and a +@@ -1488,7 +1488,7 @@ Your Google account may have other forms of browsing history like searches and a In Lite mode, Chrome loads pages faster and uses up to 60 percent less data. To optimize the pages that you visit, Chrome sends your web traffic to Google. <link>Learn more</link> @@ -8252,7 +8252,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro Turn on Lite mode -@@ -1686,10 +1686,10 @@ Your Google account may have other forms of browsing history like searches and a +@@ -1689,10 +1689,10 @@ Your Google account may have other forms of browsing history like searches and a Waiting for details of parents. @@ -8265,7 +8265,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro Content -@@ -1748,22 +1748,22 @@ Your Google account may have other forms of browsing history like searches and a +@@ -1751,22 +1751,22 @@ Your Google account may have other forms of browsing history like searches and a Google Terms of Service @@ -8292,7 +8292,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro -@@ -1780,7 +1780,7 @@ Your Google account may have other forms of browsing history like searches and a +@@ -1783,7 +1783,7 @@ Your Google account may have other forms of browsing history like searches and a Also clear your Chrome data from this device @@ -8301,7 +8301,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro Contacting Google. This may take a minute… -@@ -1885,7 +1885,7 @@ Your Google account may have other forms of browsing history like searches and a +@@ -1888,7 +1888,7 @@ Your Google account may have other forms of browsing history like searches and a Your data was encrypted with your <learnmore>sync passphrase</learnmore> on %1$sSept 1, 2012. Enter it to start sync. @@ -8310,7 +8310,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro This field cannot be blank -@@ -3927,7 +3927,7 @@ To change this setting, <resetlink>reset sync

<resetlink>reset sync

@@ -8319,7 +8319,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro No compatible devices found -@@ -3961,7 +3961,7 @@ To change this setting, <resetlink>reset sync

<resetlink>reset sync

@@ -8328,7 +8328,7 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro Got it -@@ -4321,7 +4321,7 @@ To change this setting, <resetlink>reset sync

<resetlink>reset sync

%1$sTanya's Pixel 2... diff --git a/build/patches/Bromite-auto-updater.patch b/build/patches/Bromite-auto-updater.patch index abb71c13..0e34bacb 100644 --- a/build/patches/Bromite-auto-updater.patch +++ b/build/patches/Bromite-auto-updater.patch @@ -111,7 +111,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/about_settings/ + (ChromeSwitchPreference) findPreference(PREF_ALLOW_INLINE_UPDATE); + allowInlineUpdate.setChecked( + OmahaBase.getSharedPreferences() -+ .getBoolean(OmahaBase.PREF_ALLOW_INLINE_UPDATE, false)); ++ .getBoolean(OmahaBase.PREF_ALLOW_INLINE_UPDATE, true)); + allowInlineUpdate.setOnPreferenceChangeListener(this); } @@ -422,7 +422,7 @@ new file mode 100644 + + private void pullCurrentState() { + if (OmahaBase.getSharedPreferences() -+ .getBoolean(OmahaBase.PREF_ALLOW_INLINE_UPDATE, false) == false) { ++ .getBoolean(OmahaBase.PREF_ALLOW_INLINE_UPDATE, true) == false) { + Log.i(TAG, "BromiteUpdater: disabled by user"); + return; + } diff --git a/build/patches/Enable-native-Android-autofill.patch b/build/patches/Enable-native-Android-autofill.patch new file mode 100644 index 00000000..2b919faf --- /dev/null +++ b/build/patches/Enable-native-Android-autofill.patch @@ -0,0 +1,490 @@ +From: uazo +Date: Sun, 24 Oct 2021 16:54:04 +0000 +Subject: Enable native Android autofill + +There are 2 different types of autofill: one managed via GCM and the +native Android one that uses the provider assigned by the user +(which can be any user installed app like Bitwarden for example). +In chromium GCM is active while in the WebView the latter. +This patch uses the WebView code to activate native Android autofill. + +See also: https://github.com/bromite/bromite/issues/547 +--- + chrome/android/BUILD.gn | 1 + + .../settings/PasswordSettings.java | 58 ++++++++++++++++++- + .../chromium/chrome/browser/tab/TabImpl.java | 43 ++++++++++++++ + .../browser/tab/TabViewAndroidDelegate.java | 14 +++++ + chrome/browser/BUILD.gn | 8 +++ + chrome/browser/android/tab_android.cc | 26 +++++++++ + chrome/browser/android/tab_android.h | 2 + + .../strings/android_chrome_strings.grd | 3 + + chrome/browser/ui/tab_helpers.cc | 6 +- + .../autofill/core/common/autofill_prefs.cc | 5 ++ + .../autofill/core/common/autofill_prefs.h | 1 + + .../embedder_support/view/ContentView.java | 48 +++++++++++++++ + .../chromium/ui/base/ViewAndroidDelegate.java | 8 +++ + 13 files changed, 221 insertions(+), 2 deletions(-) + +diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn +--- a/chrome/android/BUILD.gn ++++ b/chrome/android/BUILD.gn +@@ -410,6 +410,7 @@ android_library("chrome_java") { + "//chrome/browser/xsurface:java", + "//components/autofill/android:autofill_java", + "//components/autofill_assistant/browser:proto_java", ++ "//components/android_autofill/browser:java", + "//components/background_task_scheduler:background_task_scheduler_java", + "//components/background_task_scheduler:background_task_scheduler_task_ids_java", + "//components/bookmarks/common/android:bookmarks_java", +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java +@@ -52,12 +52,18 @@ import org.chromium.ui.text.SpanApplier; + + import java.util.Locale; + ++import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; ++import org.chromium.chrome.browser.ui.messages.snackbar.INeedSnackbarManager; ++import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; ++import org.chromium.chrome.browser.ApplicationLifetime; ++ + /** + * The "Passwords" screen in Settings, which allows the user to enable or disable password saving, + * to view saved passwords (just the username and URL), and to delete saved passwords. + */ + public class PasswordSettings extends PreferenceFragmentCompat +- implements PasswordManagerHandler.PasswordListObserver, Preference.OnPreferenceClickListener { ++ implements PasswordManagerHandler.PasswordListObserver, Preference.OnPreferenceClickListener, ++ INeedSnackbarManager { + // Keys for name/password dictionaries. + public static final String PASSWORD_LIST_URL = "url"; + public static final String PASSWORD_LIST_NAME = "name"; +@@ -75,6 +81,10 @@ public class PasswordSettings extends PreferenceFragmentCompat + public static final String PREF_TRUSTED_VAULT_OPT_IN = "trusted_vault_opt_in"; + public static final String PREF_KEY_MANAGE_ACCOUNT_LINK = "manage_account_link"; + public static final String PREF_KEY_SECURITY_KEY_LINK = "security_key_link"; ++ public static final String PREF_ANDROID_AUTOFILL_SWITCH = "android_autofill_switch"; ++ ++ private SnackbarManager mSnackbarManager; ++ private Snackbar mSnackbar; + + // A PasswordEntryViewer receives a boolean value with this key. If set true, the the entry was + +@@ -110,6 +120,7 @@ public class PasswordSettings extends PreferenceFragmentCompat + private Preference mLinkPref; + private Preference mSecurityKey; + private ChromeSwitchPreference mSavePasswordsSwitch; ++ private ChromeSwitchPreference mEnableAndroidAutofillSwitch; + private ChromeSwitchPreference mAutoSignInSwitch; + private ChromeBasePreference mCheckPasswords; + private ChromeBasePreference mTrustedVaultOptIn; +@@ -274,6 +285,7 @@ public class PasswordSettings extends PreferenceFragmentCompat + getPreferenceScreen().removeAll(); + if (mSearchQuery == null) { + createSavePasswordsSwitch(); ++ createEnableAndroidAutofillSwitch(); + createAutoSignInCheckbox(); + if (mPasswordCheck != null) { + createCheckPasswords(); +@@ -517,6 +529,50 @@ public class PasswordSettings extends PreferenceFragmentCompat + getPrefService().getBoolean(Pref.CREDENTIALS_ENABLE_SERVICE)); + } + ++ private void createEnableAndroidAutofillSwitch() { ++ if (mSnackbar == null) { ++ mSnackbar = Snackbar.make(getActivity().getString(R.string.ui_relaunch_notice), ++ new SnackbarManager.SnackbarController() { ++ @Override ++ public void onDismissNoAction(Object actionData) { } ++ ++ @Override ++ public void onAction(Object actionData) { ++ ApplicationLifetime.terminate(true); ++ } ++ }, Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_UNKNOWN) ++ .setSingleLine(false) ++ .setAction(getActivity().getString(R.string.relaunch), ++ /*actionData*/null) ++ .setDuration(/*durationMs*/70000); ++ } ++ ++ mEnableAndroidAutofillSwitch = new ChromeSwitchPreference(getStyledContext(), null); ++ mEnableAndroidAutofillSwitch.setKey(PREF_ANDROID_AUTOFILL_SWITCH); ++ mEnableAndroidAutofillSwitch.setTitle(R.string.enable_android_autofill); ++ mEnableAndroidAutofillSwitch.setOrder(ORDER_SWITCH); ++ mEnableAndroidAutofillSwitch.setSummaryOn(R.string.text_on); ++ mEnableAndroidAutofillSwitch.setSummaryOff(R.string.text_off); ++ ++ try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) { ++ getPreferenceScreen().addPreference(mEnableAndroidAutofillSwitch); ++ } ++ ++ mEnableAndroidAutofillSwitch.setChecked( ++ getPrefService().getBoolean(Pref.AUTOFILL_ANDROID_ENABLED)); ++ ++ mEnableAndroidAutofillSwitch.setOnPreferenceChangeListener((preference, newValue) -> { ++ getPrefService().setBoolean(Pref.AUTOFILL_ANDROID_ENABLED, (boolean) newValue); ++ if (!mSnackbarManager.isShowing()) ++ mSnackbarManager.showSnackbar(mSnackbar); ++ return true; ++ }); ++ } ++ ++ public void setSnackbarManager(SnackbarManager manager) { ++ mSnackbarManager = manager; ++ } ++ + private void createAutoSignInCheckbox() { + mAutoSignInSwitch = new ChromeSwitchPreference(getStyledContext(), null); + mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH); +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java +@@ -72,6 +72,18 @@ import org.chromium.url.GURL; + + import java.nio.ByteBuffer; + ++import android.os.Build; ++import android.util.SparseArray; ++import org.chromium.base.annotations.VerifiesOnO; ++import org.chromium.ui.base.EventOffsetHandler; ++import android.view.ViewStructure; ++import android.view.autofill.AutofillValue; ++import org.chromium.components.autofill.AutofillProvider; ++import org.chromium.components.autofill.AutofillActionModeCallback; ++import org.chromium.content_public.browser.SelectionPopupController; ++import org.chromium.chrome.browser.preferences.Pref; ++import org.chromium.components.user_prefs.UserPrefs; ++ + /** + * Implementation of the interface {@link Tab}. Contains and manages a {@link ContentView}. + * This class is not intended to be extended. +@@ -215,6 +227,8 @@ public class TabImpl implements Tab, TabObscuringHandler.Observer { + /** Whether or not the user manually changed the user agent. */ + private boolean mUserForcedUserAgent; + ++ AutofillProvider mAutofillProvider; ++ + /** + * Creates an instance of a {@link TabImpl}. + * +@@ -765,6 +779,11 @@ public class TabImpl implements Tab, TabObscuringHandler.Observer { + for (TabObserver observer : mObservers) observer.onDestroyed(this); + mObservers.clear(); + ++ if (mAutofillProvider != null) { ++ mAutofillProvider.destroy(); ++ mAutofillProvider = null; ++ } ++ + mUserDataHost.destroy(); + mTabViewManager.destroy(); + hideNativePage(false, null); +@@ -1356,6 +1375,16 @@ public class TabImpl implements Tab, TabObscuringHandler.Observer { + return tabsPtrArray; + } + ++ public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) { ++ if (mAutofillProvider != null) ++ mAutofillProvider.onProvideAutoFillVirtualStructure(structure, flags); ++ } ++ ++ public void autofill(final SparseArray values) { ++ if (mAutofillProvider != null) ++ mAutofillProvider.autofill(values); ++ } ++ + /** + * Initializes the {@link WebContents}. Completes the browser content components initialization + * around a native WebContents pointer. +@@ -1405,6 +1434,19 @@ public class TabImpl implements Tab, TabObscuringHandler.Observer { + mDelegateFactory.createContextMenuPopulatorFactory(this), this)); + + mWebContents.notifyRendererPreferenceUpdate(); ++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && ++ UserPrefs.get(Profile.getLastUsedRegularProfile()) ++ .getBoolean(Pref.AUTOFILL_ANDROID_ENABLED) == true) { ++ SelectionPopupController selectionController = ++ SelectionPopupController.fromWebContents(mWebContents); ++ ++ mAutofillProvider = new AutofillProvider(getContext(), cv, webContents, "bromite"); ++ TabImplJni.get().initializeAutofillIfNecessary(mNativeTabAndroid); ++ mAutofillProvider.setWebContents(webContents); ++ cv.setWebContents(webContents); ++ selectionController.setNonSelectionActionModeCallback( ++ new AutofillActionModeCallback(mThemedApplicationContext, mAutofillProvider)); ++ } + TabHelpers.initWebContentsHelpers(this); + notifyContentChanged(); + } finally { +@@ -1765,5 +1807,6 @@ public class TabImpl implements Tab, TabObscuringHandler.Observer { + void setActiveNavigationEntryTitleForUrl(long nativeTabAndroid, String url, String title); + void loadOriginalImage(long nativeTabAndroid); + boolean handleNonNavigationAboutURL(GURL url); ++ void initializeAutofillIfNecessary(long nativeTabAndroid); + } + } +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java +@@ -14,6 +14,10 @@ import org.chromium.content_public.browser.RenderWidgetHostView; + import org.chromium.ui.base.ViewAndroidDelegate; + import org.chromium.ui.base.WindowAndroid; + ++import android.util.SparseArray; ++import android.view.autofill.AutofillValue; ++import android.view.ViewStructure; ++ + /** + * Implementation of the abstract class {@link ViewAndroidDelegate} for Chrome. + */ +@@ -101,4 +105,14 @@ public class TabViewAndroidDelegate extends ViewAndroidDelegate { + protected int getViewportInsetBottom() { + return mApplicationViewportInsetBottomPx; + } ++ ++ @Override ++ public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) { ++ mTab.onProvideAutofillVirtualStructure(structure, flags); ++ } ++ ++ @Override ++ public void autofill(final SparseArray values) { ++ mTab.autofill(values); ++ } + } +diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn +--- a/chrome/browser/BUILD.gn ++++ b/chrome/browser/BUILD.gn +@@ -2352,6 +2352,14 @@ static_library("browser") { + "//ui/webui/resources/cr_components/customize_themes:mojom", + "//ui/webui/resources/cr_components/most_visited:mojom", + ] ++ ++ if (is_android) { ++ deps += [ ++ "//components/android_autofill/browser", ++ "//components/android_autofill/browser:android" ++ ] ++ } ++ + if (is_chromeos_ash) { + testonly = enable_weston_test + sources += [ +diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc +--- a/chrome/browser/android/tab_android.cc ++++ b/chrome/browser/android/tab_android.cc +@@ -65,6 +65,13 @@ + #include "url/android/gurl_android.h" + #include "url/gurl.h" + ++#include "components/android_autofill/browser/android_autofill_manager.h" ++#include "components/android_autofill/browser/autofill_provider.h" ++#include "components/android_autofill/browser/autofill_provider_android.h" ++#include "components/autofill/content/browser/content_autofill_driver_factory.h" ++#include "chrome/browser/ui/autofill/chrome_autofill_client.h" ++#include "chrome/browser/browser_process.h" ++ + using base::android::AttachCurrentThread; + using base::android::ConvertUTF8ToJavaString; + using base::android::JavaParamRef; +@@ -437,3 +444,22 @@ static void JNI_TabImpl_Init(JNIEnv* env, const JavaParamRef& obj) { + // This will automatically bind to the Java object and pass ownership there. + new TabAndroid(env, obj); + } ++ ++void TabAndroid::InitializeAutofillIfNecessary(JNIEnv* env) { ++ if (!autofill::ContentAutofillDriverFactory::FromWebContents( ++ web_contents_.get())) { ++ content::WebContents* web_contents = web_contents_.get(); ++ DCHECK( ++ !autofill::ContentAutofillDriverFactory::FromWebContents(web_contents)); ++ DCHECK(autofill::AutofillProvider::FromWebContents(web_contents)); ++ ++ autofill::ChromeAutofillClient::CreateForWebContents(web_contents); ++ ++ autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( ++ web_contents, ++ autofill::ChromeAutofillClient::FromWebContents(web_contents), ++ g_browser_process->GetApplicationLocale(), ++ autofill::BrowserAutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER, ++ base::BindRepeating(&autofill::AndroidAutofillManager::Create)); ++ } ++} +diff --git a/chrome/browser/android/tab_android.h b/chrome/browser/android/tab_android.h +--- a/chrome/browser/android/tab_android.h ++++ b/chrome/browser/android/tab_android.h +@@ -150,6 +150,8 @@ class TabAndroid : public base::SupportsUserData { + + void SetDevToolsAgentHost(scoped_refptr host); + ++ void InitializeAutofillIfNecessary(JNIEnv* env); ++ + private: + JavaObjectWeakGlobalRef weak_java_tab_; + +diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd +--- a/chrome/browser/ui/android/strings/android_chrome_strings.grd ++++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd +@@ -558,6 +558,9 @@ CHAR_LIMIT guidelines: + + Save passwords + ++ ++ Enable native Android autofill ++ + + Auto Sign-in + +diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc +--- a/chrome/browser/ui/tab_helpers.cc ++++ b/chrome/browser/ui/tab_helpers.cc +@@ -125,6 +125,9 @@ + #include "chrome/browser/ui/android/context_menu_helper.h" + #include "chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_android.h" + #include "chrome/browser/video_tutorials/video_tutorial_tab_helper.h" ++#include "components/android_autofill/browser/android_autofill_manager.h" ++#include "components/android_autofill/browser/autofill_provider.h" ++#include "components/android_autofill/browser/autofill_provider_android.h" + #else + #include "chrome/browser/accuracy_tips/accuracy_service_factory.h" + #include "chrome/browser/banners/app_banner_manager_desktop.h" +@@ -244,7 +247,8 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { + web_contents, + autofill::ChromeAutofillClient::FromWebContents(web_contents), + g_browser_process->GetApplicationLocale(), +- autofill::BrowserAutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); ++ autofill::BrowserAutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER, ++ base::BindRepeating(&autofill::AndroidAutofillManager::Create)); + chrome_browser_net::NetErrorTabHelper::CreateForWebContents(web_contents); + ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( + web_contents, +diff --git a/components/autofill/core/common/autofill_prefs.cc b/components/autofill/core/common/autofill_prefs.cc +--- a/components/autofill/core/common/autofill_prefs.cc ++++ b/components/autofill/core/common/autofill_prefs.cc +@@ -135,6 +135,9 @@ const char kAutofillWalletImportStorageCheckboxState[] = + const char kAutocompleteLastVersionRetentionPolicy[] = + "autocomplete.retention_policy_last_version"; + ++// Boolean that is true to enable native Android Autofill ++const char kAutofillAndroidEnabled[] = "autofill.android_autofill_enabled"; ++ + void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { + // Synced prefs. Used for cross-device choices, e.g., credit card Autofill. + registry->RegisterBooleanPref( +@@ -167,6 +170,8 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterBooleanPref( + prefs::kAutofillCreditCardFidoAuthOfferCheckboxState, true); + #endif ++ registry->RegisterBooleanPref( ++ prefs::kAutofillAndroidEnabled, true); + registry->RegisterIntegerPref( + prefs::kAutofillCreditCardSigninPromoImpressionCount, 0); + registry->RegisterBooleanPref(prefs::kAutofillWalletImportEnabled, true); +diff --git a/components/autofill/core/common/autofill_prefs.h b/components/autofill/core/common/autofill_prefs.h +--- a/components/autofill/core/common/autofill_prefs.h ++++ b/components/autofill/core/common/autofill_prefs.h +@@ -48,6 +48,7 @@ extern const char kAutofillUploadEventsLastResetTimestamp[]; + extern const char kAutofillWalletImportEnabled[]; + extern const char kAutofillWalletImportStorageCheckboxState[]; + extern const char kAutocompleteLastVersionRetentionPolicy[]; ++extern const char kAutofillAndroidEnabled[]; + + namespace sync_transport_opt_in { + enum Flags { +diff --git a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/view/ContentView.java b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/view/ContentView.java +--- a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/view/ContentView.java ++++ b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/view/ContentView.java +@@ -36,6 +36,12 @@ import org.chromium.content_public.browser.WebContentsAccessibility; + import org.chromium.ui.base.EventForwarder; + import org.chromium.ui.base.EventOffsetHandler; + ++import org.chromium.base.Log; ++import org.chromium.base.annotations.VerifiesOnO; ++import android.util.SparseArray; ++import android.view.autofill.AutofillValue; ++import org.chromium.ui.base.ViewAndroidDelegate; ++ + /** + * The containing view for {@link WebContents} that exists in the Android UI hierarchy and exposes + * the various {@link View} functionality to it. +@@ -82,6 +88,8 @@ public class ContentView extends FrameLayout + */ + public static ContentView createContentView(Context context, + @Nullable EventOffsetHandler eventOffsetHandler, @Nullable WebContents webContents) { ++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) ++ return new ContentViewWithAutofill(context, eventOffsetHandler, webContents); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + return new ContentViewApi23(context, eventOffsetHandler, webContents); + } +@@ -549,4 +557,44 @@ public class ContentView extends FrameLayout + if (wcax != null) wcax.onProvideVirtualStructure(structure, false); + } + } ++ ++ /** ++ * API level 26 implementation that includes autofill. ++ */ ++ @VerifiesOnO ++ public static class ContentViewWithAutofill extends ContentViewApi23 { ++ private ViewAndroidDelegate viewAndroidDelegate; ++ ++ private ContentViewWithAutofill(Context context, EventOffsetHandler eventOffsetHandler, WebContents webContents) { ++ super(context, eventOffsetHandler, webContents); ++ ++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { ++ // The Autofill system-level infrastructure has heuristics for which Views it considers ++ // important for autofill; only these Views will be queried for their autofill ++ // structure on notifications that a new (virtual) View was entered. By default, ++ // FrameLayout is not considered important for autofill. Thus, for ContentView to be ++ // queried for its autofill structure, we must explicitly inform the autofill system ++ // that this View is important for autofill. ++ setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES); ++ } ++ } ++ ++ @Override ++ public void setWebContents(WebContents webContents) { ++ viewAndroidDelegate = webContents.getViewAndroidDelegate(); ++ super.setWebContents(webContents); ++ } ++ ++ @Override ++ public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) { ++ if (viewAndroidDelegate != null) ++ viewAndroidDelegate.onProvideAutofillVirtualStructure(structure, flags); ++ } ++ ++ @Override ++ public void autofill(final SparseArray values) { ++ if (viewAndroidDelegate != null) ++ viewAndroidDelegate.autofill(values); ++ } ++ } + } +diff --git a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java +--- a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java ++++ b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java +@@ -26,6 +26,10 @@ import org.chromium.base.annotations.JNINamespace; + import org.chromium.base.compat.ApiHelperForN; + import org.chromium.ui.mojom.CursorType; + ++import android.util.SparseArray; ++import android.view.autofill.AutofillValue; ++import android.view.ViewStructure; ++ + /** + * Class to acquire, position, and remove anchor views from the implementing View. + */ +@@ -488,4 +492,8 @@ public class ViewAndroidDelegate { + protected int[] getDisplayFeature() { + return null; + } ++ ++ public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {} ++ ++ public void autofill(final SparseArray values) {} + } +-- +2.17.1 + diff --git a/build/patches/experimental-user-scripts-support.patch b/build/patches/Experimental-user-scripts-support.patch similarity index 99% rename from build/patches/experimental-user-scripts-support.patch rename to build/patches/Experimental-user-scripts-support.patch index 8eaaa52c..6a38df4d 100644 --- a/build/patches/experimental-user-scripts-support.patch +++ b/build/patches/Experimental-user-scripts-support.patch @@ -2,28 +2,25 @@ From: uazo Date: Fri, 13 Aug 2021 17:10:47 +0000 Subject: Experimental user scripts support -Activate userscripts as in the desktop version -of chromium. +Activate the user scripts functionality for Android, +as it is available in the Desktop version. -is possible to add them in two ways: by selecting -files from the picker in the settings or downloading -the scripts and opening it from downloads -(only if ends with .user.js) +It is possible to add user scripts in two ways: by +selecting files from the picker in the settings or +downloading the scripts and opening them from downloads +(only if such files end with '.user.js'). -new imported scripts are disabled by default: they -can be activated via the ui. +New imported scripts are disabled by default: they +can be activated via the UI. -enabled headers are: name, version, description, +Parsed user script headers are: name, version, description, include, exclude, match, exclude_match (only http and -https), run-at (document-start, document-end, +https), run-at (document-start, document-end, document-idle), homepage, url_source -ui, among other things, allows you to see the source -of the script. +The UI also allows you to see the source of the script. -needs add-support-for-ISupportHelpAndFeedback.patch - -see also: README.md +See also: components/user_scripts/README.md --- chrome/android/BUILD.gn | 5 + .../android/java/res/xml/main_preferences.xml | 5 + @@ -273,7 +270,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/Downlo import java.io.File; -@@ -400,6 +401,11 @@ public class DownloadUtils { +@@ -414,6 +415,11 @@ public class DownloadUtils { public static boolean openFile(String filePath, String mimeType, String downloadGuid, OTRProfileID otrProfileID, String originalUrl, String referrer, @DownloadOpenSource int source, Context context) { @@ -348,7 +345,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc #include "components/version_info/version_info.h" #include "components/viz/common/features.h" #include "components/viz/common/switches.h" -@@ -6387,6 +6388,10 @@ const FeatureEntry kFeatureEntries[] = { +@@ -6386,6 +6387,10 @@ const FeatureEntry kFeatureEntries[] = { FEATURE_VALUE_TYPE(features::kUserDataSnapshot)}, #endif @@ -375,7 +372,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc -@@ -5239,6 +5239,11 @@ const char kUserDataSnapshotDescription[] = +@@ -5249,6 +5249,11 @@ const char kUserDataSnapshotDescription[] = "update and restoring them after a version rollback."; #endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) @@ -390,7 +387,7 @@ diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descripti diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h -@@ -3046,6 +3046,9 @@ extern const char kUserDataSnapshotName[]; +@@ -3052,6 +3052,9 @@ extern const char kUserDataSnapshotName[]; extern const char kUserDataSnapshotDescription[]; #endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) diff --git a/build/patches/add-support-for-ISupportHelpAndFeedback.patch b/build/patches/add-support-for-ISupportHelpAndFeedback.patch deleted file mode 100644 index f576c637..00000000 --- a/build/patches/add-support-for-ISupportHelpAndFeedback.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: uazo -Date: Mon, 17 May 2021 12:30:12 +0000 -Subject: Add support for ISupportHelpAndFeedback - ---- - .../chrome/browser/settings/SettingsActivity.java | 10 +++++++--- - .../components/browser_ui/settings/SettingsUtils.java | 4 ++++ - 2 files changed, 11 insertions(+), 3 deletions(-) - -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java ---- a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java -@@ -282,9 +282,13 @@ public class SettingsActivity extends ChromeBaseAppCompatActivity - finish(); - return true; - } else if (item.getItemId() == R.id.menu_id_general_help) { -- HelpAndFeedbackLauncherImpl.getInstance().show(this, -- getString(R.string.help_context_settings), Profile.getLastUsedRegularProfile(), -- null); -+ if (mainFragment instanceof SettingsUtils.ISupportHelpAndFeedback) { -+ ((SettingsUtils.ISupportHelpAndFeedback)mainFragment).onHelpAndFeebackPressed(); -+ } else { -+ HelpAndFeedbackLauncherImpl.getInstance().show(this, -+ getString(R.string.help_context_settings), Profile.getLastUsedRegularProfile(), -+ null); -+ } - return true; - } - return super.onOptionsItemSelected(item); -diff --git a/components/browser_ui/settings/android/java/src/org/chromium/components/browser_ui/settings/SettingsUtils.java b/components/browser_ui/settings/android/java/src/org/chromium/components/browser_ui/settings/SettingsUtils.java ---- a/components/browser_ui/settings/android/java/src/org/chromium/components/browser_ui/settings/SettingsUtils.java -+++ b/components/browser_ui/settings/android/java/src/org/chromium/components/browser_ui/settings/SettingsUtils.java -@@ -126,4 +126,8 @@ public class SettingsUtils { - ImageView imageButton = (ImageView) button; - return imageButton.getDrawable() == parentMenu.getOverflowIcon(); - } -+ -+ public interface ISupportHelpAndFeedback { -+ void onHelpAndFeebackPressed(); -+ } - } --- -2.17.1 -