Files
cromite/build/patches/autofill-miscellaneous.patch
T
2022-09-22 11:05:02 +02:00

214 lines
10 KiB
Diff

From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Mon, 11 Apr 2022 23:29:29 +0200
Subject: autofill: miscellaneous
Make sure that autofill is disabled by default (Jan Engelhardt <jengelh@inai.de>)
Disable autofill download manager (Jan Engelhardt <jengelh@inai.de>)
Disable autofill assistant and CC (csagan5)
Disable autofill server communication by default (Daniel Micay <danielmicay@gmail.com>)
Do not skip google.com domains for password generation (csagan5)
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
.../core/browser/autofill_download_manager.cc | 35 +++----------------
.../core/browser/autofill_download_manager.h | 2 --
.../autofill/core/browser/autofill_manager.cc | 20 -----------
.../core/browser/browser_autofill_manager.h | 4 +--
.../autofill/core/common/autofill_features.cc | 2 +-
.../autofill/core/common/autofill_prefs.cc | 4 +--
.../AutofillAssistantPreferencesUtil.java | 2 +-
.../password_generation_frame_helper.cc | 4 ---
8 files changed, 11 insertions(+), 62 deletions(-)
diff --git a/components/autofill/core/browser/autofill_download_manager.cc b/components/autofill/core/browser/autofill_download_manager.cc
--- a/components/autofill/core/browser/autofill_download_manager.cc
+++ b/components/autofill/core/browser/autofill_download_manager.cc
@@ -509,35 +509,6 @@ bool GetUploadPayloadForApi(const AutofillUploadContents& upload,
return upload_request.SerializeToString(payload);
}
-// Gets an API method URL given its type (query or upload), an optional
-// resource ID, and the HTTP method to be used.
-// Example usage:
-// * GetAPIMethodUrl(REQUEST_QUERY, "1234", "GET") will return "/v1/pages/1234".
-// * GetAPIMethodUrl(REQUEST_QUERY, "1234", "POST") will return "/v1/pages:get".
-// * GetAPIMethodUrl(REQUEST_UPLOAD, "", "POST") will return "/v1/forms:vote".
-std::string GetAPIMethodUrl(AutofillDownloadManager::RequestType type,
- base::StringPiece resource_id,
- base::StringPiece method) {
- const char* api_method_url;
- if (type == AutofillDownloadManager::REQUEST_QUERY) {
- if (method == "POST") {
- api_method_url = "/v1/pages:get";
- } else {
- api_method_url = "/v1/pages";
- }
- } else if (type == AutofillDownloadManager::REQUEST_UPLOAD) {
- api_method_url = "/v1/forms:vote";
- } else {
- // This should not be reached, but we never know.
- NOTREACHED() << "Request of type " << type << " is invalid";
- return "";
- }
- if (resource_id.empty()) {
- return std::string(api_method_url);
- }
- return base::StrCat({api_method_url, "/", resource_id});
-}
-
// Gets HTTP body payload for API POST request.
bool GetAPIBodyPayload(const std::string& payload,
AutofillDownloadManager::RequestType type,
@@ -773,6 +744,7 @@ std::tuple<GURL, std::string> AutofillDownloadManager::GetRequestURLAndMethod(
// ID of the resource to add to the API request URL. Nothing will be added if
// |resource_id| is empty.
std::string resource_id;
+#if 0
std::string method = "POST";
if (request_data.request_type == AutofillDownloadManager::REQUEST_QUERY) {
@@ -793,7 +765,10 @@ std::tuple<GURL, std::string> AutofillDownloadManager::GetRequestURLAndMethod(
// Add the query parameter to set the response format to a serialized proto.
url = net::AppendQueryParameter(url, "alt", "proto");
-
+#else
+ std::string method("GET");
+ GURL url = GURL("about:blank");
+#endif
return std::make_tuple(std::move(url), std::move(method));
}
diff --git a/components/autofill/core/browser/autofill_download_manager.h b/components/autofill/core/browser/autofill_download_manager.h
--- a/components/autofill/core/browser/autofill_download_manager.h
+++ b/components/autofill/core/browser/autofill_download_manager.h
@@ -36,8 +36,6 @@ namespace autofill {
class AutofillDriver;
class LogManager;
-const size_t kMaxQueryGetSize = 10240; // 10 KiB
-
// A helper to make sure that tests which modify the set of active autofill
// experiments do not interfere with one another.
struct ScopedActiveAutofillExperiments {
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -96,19 +96,6 @@ bool CachedFormNeedsUpdate(const FormData& live_form,
return false;
}
-std::string GetAPIKeyForUrl(version_info::Channel channel) {
- // First look if we can get API key from command line flag.
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kAutofillAPIKey))
- return command_line.GetSwitchValueASCII(switches::kAutofillAPIKey);
-
- // Get the API key from Chrome baked keys.
- if (channel == version_info::Channel::STABLE)
- return google_apis::GetAPIKey();
- return google_apis::GetNonStableAPIKey();
-}
-
} // namespace
// static
@@ -144,13 +131,6 @@ AutofillManager::AutofillManager(AutofillDriver* driver,
client_(client),
log_manager_(client ? client->GetLogManager() : nullptr),
form_interactions_ukm_logger_(CreateFormInteractionsUkmLogger()) {
- if (enable_download_manager) {
- download_manager_ = std::make_unique<AutofillDownloadManager>(
- driver, this, GetAPIKeyForUrl(channel),
- AutofillDownloadManager::IsRawMetadataUploadingEnabled(
- IsRawMetadataUploadingEnabled(channel)),
- log_manager_);
- }
if (client) {
translate::TranslateDriver* translate_driver = client->GetTranslateDriver();
if (translate_driver) {
diff --git a/components/autofill/core/browser/browser_autofill_manager.h b/components/autofill/core/browser/browser_autofill_manager.h
--- a/components/autofill/core/browser/browser_autofill_manager.h
+++ b/components/autofill/core/browser/browser_autofill_manager.h
@@ -699,9 +699,9 @@ class BrowserAutofillManager : public AutofillManager,
std::unique_ptr<CreditCardFormEventLogger> credit_card_form_event_logger_;
// Have we logged whether Autofill is enabled for this page load?
- bool has_logged_autofill_enabled_ = false;
+ bool has_logged_autofill_enabled_ = true;
// Have we logged an address suggestions count metric for this page?
- bool has_logged_address_suggestions_count_ = false;
+ bool has_logged_address_suggestions_count_ = true;
// Have we shown Autofill suggestions at least once?
bool did_show_suggestions_ = false;
// Has the user manually edited at least one form field among the autofillable
diff --git a/components/autofill/core/common/autofill_features.cc b/components/autofill/core/common/autofill_features.cc
--- a/components/autofill/core/common/autofill_features.cc
+++ b/components/autofill/core/common/autofill_features.cc
@@ -509,7 +509,7 @@ const base::FeatureParam<int> kAutofillServerBehaviorsParam{
// "upload" resources.
// i.e., https://other.autofill.server:port/tbproxy/af/
const base::Feature kAutofillServerCommunication{
- "AutofillServerCommunication", base::FEATURE_ENABLED_BY_DEFAULT};
+ "AutofillServerCommunication", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether Autofill may fill across origins as part of the
// AutofillAcrossIframes experiment.
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
@@ -120,7 +120,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
prefs::kAutofillEnabledDeprecated, true,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(
- prefs::kAutofillProfileEnabled, true,
+ prefs::kAutofillProfileEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterIntegerPref(
prefs::kAutofillLastVersionDeduped, 0,
@@ -130,7 +130,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
prefs::kAutofillLastVersionDisusedAddressesDeleted, 0,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(
- prefs::kAutofillCreditCardEnabled, true,
+ prefs::kAutofillCreditCardEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(
prefs::kAutofillIBANEnabled, true,
diff --git a/components/autofill_assistant/android/public/java/src/org/chromium/components/autofill_assistant/AutofillAssistantPreferencesUtil.java b/components/autofill_assistant/android/public/java/src/org/chromium/components/autofill_assistant/AutofillAssistantPreferencesUtil.java
--- a/components/autofill_assistant/android/public/java/src/org/chromium/components/autofill_assistant/AutofillAssistantPreferencesUtil.java
+++ b/components/autofill_assistant/android/public/java/src/org/chromium/components/autofill_assistant/AutofillAssistantPreferencesUtil.java
@@ -32,7 +32,7 @@ public class AutofillAssistantPreferencesUtil {
/** Checks whether the Autofill Assistant switch preference in settings is on. */
public static boolean isAutofillAssistantSwitchOn() {
- return getAssistantEnabledPreference(true);
+ return getAssistantEnabledPreference(false);
}
/** Checks whether proactive help is enabled. */
diff --git a/components/password_manager/core/browser/password_generation_frame_helper.cc b/components/password_manager/core/browser/password_generation_frame_helper.cc
--- a/components/password_manager/core/browser/password_generation_frame_helper.cc
+++ b/components/password_manager/core/browser/password_generation_frame_helper.cc
@@ -85,7 +85,6 @@ void PasswordGenerationFrameHelper::ProcessPasswordRequirements(
// In order for password generation to be enabled, we need to make sure:
// (1) Password sync is enabled, and
// (2) Password saving is enabled
-// (3) The current page is not *.google.com.
bool PasswordGenerationFrameHelper::IsGenerationEnabled(
bool log_debug_data) const {
std::unique_ptr<Logger> logger;
@@ -95,9 +94,6 @@ bool PasswordGenerationFrameHelper::IsGenerationEnabled(
}
GURL url = driver_->GetLastCommittedURL();
- if (url.DomainIs("google.com"))
- return false;
-
if (!client_->IsSavingAndFillingEnabled(url)) {
if (logger)
logger->LogMessage(Logger::STRING_GENERATION_DISABLED_SAVING_DISABLED);
--
2.25.1