350 lines
17 KiB
Diff
350 lines
17 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)
|
|
Disable deeplinks
|
|
|
|
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
|
---
|
|
.../browser/AutofillOptionsLauncher.java | 1 +
|
|
.../chrome_password_manager_client.cc | 4 --
|
|
.../ui/autofill/chrome_autofill_client.cc | 9 ---
|
|
.../ui/autofill/chrome_autofill_client.h | 1 -
|
|
.../browser/android_autofill_client.cc | 11 ----
|
|
.../browser/android_autofill_client.h | 1 -
|
|
.../autofill_crowdsourcing_manager.cc | 63 ++-----------------
|
|
.../autofill_crowdsourcing_manager.h | 2 -
|
|
.../browser/crowdsourcing/votes_uploader.cc | 3 -
|
|
.../browser/foundations/autofill_client.h | 4 --
|
|
.../browser/foundations/autofill_manager.cc | 19 ------
|
|
.../autofill/core/common/autofill_features.cc | 1 +
|
|
.../autofill/core/common/autofill_prefs.cc | 8 +--
|
|
.../password_generation_frame_helper.cc | 5 --
|
|
14 files changed, 11 insertions(+), 121 deletions(-)
|
|
|
|
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AutofillOptionsLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/AutofillOptionsLauncher.java
|
|
--- a/chrome/android/java/src/org/chromium/chrome/browser/AutofillOptionsLauncher.java
|
|
+++ b/chrome/android/java/src/org/chromium/chrome/browser/AutofillOptionsLauncher.java
|
|
@@ -43,6 +43,7 @@ public final class AutofillOptionsLauncher extends Activity {
|
|
}
|
|
|
|
private static boolean isDeepLinkFeatureEnabled() {
|
|
+ if ((true)) return false;
|
|
return ContextUtils.getApplicationContext()
|
|
.getSharedPreferences(
|
|
AUTOFILL_OPTIONS_DEEP_LINK_SHARED_PREFS_FILE, Context.MODE_PRIVATE)
|
|
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
|
|
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
|
|
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
|
|
@@ -1131,10 +1131,6 @@ ChromePasswordManagerClient::GetHttpAuthManager() {
|
|
|
|
autofill::AutofillCrowdsourcingManager*
|
|
ChromePasswordManagerClient::GetAutofillCrowdsourcingManager() {
|
|
- if (auto* client =
|
|
- autofill::ContentAutofillClient::FromWebContents(web_contents())) {
|
|
- return &client->GetCrowdsourcingManager();
|
|
- }
|
|
return nullptr;
|
|
}
|
|
|
|
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
|
|
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
|
|
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
|
|
@@ -465,15 +465,6 @@ ChromeAutofillClient::GetURLLoaderFactory() {
|
|
->GetURLLoaderFactoryForBrowserProcess();
|
|
}
|
|
|
|
-AutofillCrowdsourcingManager& ChromeAutofillClient::GetCrowdsourcingManager() {
|
|
- if (!crowdsourcing_manager_) {
|
|
- // Lazy initialization to avoid virtual function calls in the constructor.
|
|
- crowdsourcing_manager_ =
|
|
- std::make_unique<AutofillCrowdsourcingManager>(this, GetChannel());
|
|
- }
|
|
- return *crowdsourcing_manager_;
|
|
-}
|
|
-
|
|
VotesUploader& ChromeAutofillClient::GetVotesUploader() {
|
|
return votes_uploader_;
|
|
}
|
|
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.h b/chrome/browser/ui/autofill/chrome_autofill_client.h
|
|
--- a/chrome/browser/ui/autofill/chrome_autofill_client.h
|
|
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.h
|
|
@@ -122,7 +122,6 @@ class ChromeAutofillClient : public ContentAutofillClient {
|
|
version_info::Channel GetChannel() const final;
|
|
bool IsOffTheRecord() const final;
|
|
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() final;
|
|
- AutofillCrowdsourcingManager& GetCrowdsourcingManager() final;
|
|
VotesUploader& GetVotesUploader() final;
|
|
AutofillOptimizationGuideDecider* GetAutofillOptimizationGuideDecider()
|
|
const final;
|
|
diff --git a/components/android_autofill/browser/android_autofill_client.cc b/components/android_autofill/browser/android_autofill_client.cc
|
|
--- a/components/android_autofill/browser/android_autofill_client.cc
|
|
+++ b/components/android_autofill/browser/android_autofill_client.cc
|
|
@@ -79,17 +79,6 @@ AndroidAutofillClient::GetURLLoaderFactory() {
|
|
->GetURLLoaderFactoryForBrowserProcess();
|
|
}
|
|
|
|
-autofill::AutofillCrowdsourcingManager&
|
|
-AndroidAutofillClient::GetCrowdsourcingManager() {
|
|
- if (!crowdsourcing_manager_) {
|
|
- // Lazy initialization to avoid virtual function calls in the constructor.
|
|
- crowdsourcing_manager_ =
|
|
- std::make_unique<autofill::AutofillCrowdsourcingManager>(this,
|
|
- GetChannel());
|
|
- }
|
|
- return *crowdsourcing_manager_;
|
|
-}
|
|
-
|
|
autofill::VotesUploader& AndroidAutofillClient::GetVotesUploader() {
|
|
return votes_uploader_;
|
|
}
|
|
diff --git a/components/android_autofill/browser/android_autofill_client.h b/components/android_autofill/browser/android_autofill_client.h
|
|
--- a/components/android_autofill/browser/android_autofill_client.h
|
|
+++ b/components/android_autofill/browser/android_autofill_client.h
|
|
@@ -90,7 +90,6 @@ class AndroidAutofillClient : public autofill::ContentAutofillClient {
|
|
const std::string& GetAppLocale() const final;
|
|
bool IsOffTheRecord() const final;
|
|
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() final;
|
|
- autofill::AutofillCrowdsourcingManager& GetCrowdsourcingManager() final;
|
|
autofill::VotesUploader& GetVotesUploader() override;
|
|
bool HasPersonalDataManager() const final;
|
|
autofill::PersonalDataManager& GetPersonalDataManager() final;
|
|
diff --git a/components/autofill/core/browser/crowdsourcing/autofill_crowdsourcing_manager.cc b/components/autofill/core/browser/crowdsourcing/autofill_crowdsourcing_manager.cc
|
|
--- a/components/autofill/core/browser/crowdsourcing/autofill_crowdsourcing_manager.cc
|
|
+++ b/components/autofill/core/browser/crowdsourcing/autofill_crowdsourcing_manager.cc
|
|
@@ -503,33 +503,6 @@ std::optional<std::string> GetUploadPayloadForApi(
|
|
return std::move(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(CrowdsourcingRequestType::kRequestQuery, "1234", "GET")
|
|
-// will return "/v1/pages/1234".
|
|
-// * GetAPIMethodUrl(CrowdsourcingRequestType::kRequestQuery, "1234", "POST")
|
|
-// will return "/v1/pages:get".
|
|
-// * GetAPIMethodUrl(CrowdsourcingRequestType::kRequestUpload, "", "POST")
|
|
-// will return "/v1/forms:vote".
|
|
-std::string GetAPIMethodUrl(CrowdsourcingRequestType type,
|
|
- std::string_view resource_id,
|
|
- std::string_view method) {
|
|
- const char* api_method_url = [&] {
|
|
- switch (type) {
|
|
- case CrowdsourcingRequestType::kRequestQuery:
|
|
- return method == "POST" ? "/v1/pages:get" : "/v1/pages";
|
|
- case CrowdsourcingRequestType::kRequestUpload:
|
|
- return "/v1/forms:vote";
|
|
- }
|
|
- NOTREACHED();
|
|
- }();
|
|
- 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.
|
|
std::optional<std::string> GetAPIBodyPayload(std::string payload,
|
|
CrowdsourcingRequestType type) {
|
|
@@ -561,15 +534,7 @@ std::optional<std::string> GetAPIQueryPayload(
|
|
}
|
|
|
|
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.
|
|
- return google_apis::GetAPIKey(channel);
|
|
+ return std::string();
|
|
}
|
|
|
|
std::optional<std::vector<variations::VariationID>>& GetActiveExperiments() {
|
|
@@ -891,31 +856,13 @@ size_t AutofillCrowdsourcingManager::GetPayloadLength(
|
|
|
|
std::tuple<GURL, std::string> AutofillCrowdsourcingManager::GetRequestURLAndMethod(
|
|
const FormRequestData& request_data) const {
|
|
- // ID of the resource to add to the API request URL. Nothing will be added if
|
|
- // `resource_id` is empty.
|
|
- std::string resource_id;
|
|
- std::string method = "POST";
|
|
-
|
|
- if (request_data.request_type == CrowdsourcingRequestType::kRequestQuery) {
|
|
- if (GetPayloadLength(request_data.payload) <= kMaxQueryGetSize) {
|
|
- resource_id = request_data.payload;
|
|
- method = "GET";
|
|
- }
|
|
- base::UmaHistogramBoolean(kUmaMethod, method != "GET");
|
|
- }
|
|
-
|
|
- // Make the canonical URL to query the API, e.g.,
|
|
- // https://autofill.googleapis.com/v1/forms/1234?alt=proto.
|
|
- GURL url = autofill_server_url_.Resolve(
|
|
- GetAPIMethodUrl(request_data.request_type, resource_id, method));
|
|
-
|
|
- // Add the query parameter to set the response format to a serialized proto.
|
|
- url = net::AppendQueryParameter(url, "alt", "proto");
|
|
-
|
|
- return std::make_tuple(std::move(url), std::move(method));
|
|
+ std::string method2("GET");
|
|
+ GURL url2 = GURL("about:blank");
|
|
+ return std::make_tuple(std::move(url2), std::move(method2));
|
|
}
|
|
|
|
bool AutofillCrowdsourcingManager::StartRequest(FormRequestData request_data) {
|
|
+ if ((true)) return false;
|
|
// kRequestUploads take no IsolationInfo because Password Manager uploads when
|
|
// RenderFrameHostImpl::DidCommitNavigation() is called, in which case
|
|
// AutofillDriver::IsolationInfo() may crash because there is no committing
|
|
diff --git a/components/autofill/core/browser/crowdsourcing/autofill_crowdsourcing_manager.h b/components/autofill/core/browser/crowdsourcing/autofill_crowdsourcing_manager.h
|
|
--- a/components/autofill/core/browser/crowdsourcing/autofill_crowdsourcing_manager.h
|
|
+++ b/components/autofill/core/browser/crowdsourcing/autofill_crowdsourcing_manager.h
|
|
@@ -38,8 +38,6 @@ namespace autofill {
|
|
|
|
class AutofillClient;
|
|
|
|
-inline constexpr 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/crowdsourcing/votes_uploader.cc b/components/autofill/core/browser/crowdsourcing/votes_uploader.cc
|
|
--- a/components/autofill/core/browser/crowdsourcing/votes_uploader.cc
|
|
+++ b/components/autofill/core/browser/crowdsourcing/votes_uploader.cc
|
|
@@ -517,9 +517,6 @@ void VotesUploader::UploadVote(
|
|
client_->GetUkmRecorder(), ukm_source_id, *submitted_form,
|
|
submission_timestamp);
|
|
}
|
|
- client_->GetCrowdsourcingManager().StartUploadRequest(
|
|
- std::move(upload_contents), submitted_form->submission_source(),
|
|
- /*is_password_manager_upload=*/false);
|
|
}
|
|
|
|
} // namespace autofill
|
|
diff --git a/components/autofill/core/browser/foundations/autofill_client.h b/components/autofill/core/browser/foundations/autofill_client.h
|
|
--- a/components/autofill/core/browser/foundations/autofill_client.h
|
|
+++ b/components/autofill/core/browser/foundations/autofill_client.h
|
|
@@ -329,10 +329,6 @@ class AutofillClient {
|
|
// Returns the VotesUploader.
|
|
virtual VotesUploader& GetVotesUploader() = 0;
|
|
|
|
- // Returns the AutofillCrowdsourcingManager for communication with the
|
|
- // Autofill server.
|
|
- virtual AutofillCrowdsourcingManager& GetCrowdsourcingManager() = 0;
|
|
-
|
|
// Returns whether the client has a PersonalDataManager.
|
|
//
|
|
// TODO(crbug.com/455121491) This is a temporary fix to avoid crashes when
|
|
diff --git a/components/autofill/core/browser/foundations/autofill_manager.cc b/components/autofill/core/browser/foundations/autofill_manager.cc
|
|
--- a/components/autofill/core/browser/foundations/autofill_manager.cc
|
|
+++ b/components/autofill/core/browser/foundations/autofill_manager.cc
|
|
@@ -312,12 +312,6 @@ void AutofillManager::QueryServerPredictions(
|
|
// StartQueryRequest() expects to include the queried forms. This would allow
|
|
// StartQueryRequest() to provide the queried forms to the callback
|
|
// automatically, instead of passing them in separately here.
|
|
- auto on_loaded =
|
|
- base::BindOnce(&AutofillManager::OnLoadedServerPredictions, GetWeakPtr(),
|
|
- queryable_forms, form_seen_timestamp);
|
|
- client().GetCrowdsourcingManager().StartQueryRequest(
|
|
- std::move(queryable_forms), driver().GetIsolationInfo(),
|
|
- std::move(on_loaded));
|
|
}
|
|
|
|
void AutofillManager::OnFormsParsed(const std::vector<FormData>& forms,
|
|
@@ -354,19 +348,6 @@ void AutofillManager::OnFormsParsed(const std::vector<FormData>& forms,
|
|
features::kAutofillServerQueryPredictionsEarly)) {
|
|
return;
|
|
}
|
|
-
|
|
- // Query the server if at least one of the forms was parsed.
|
|
- if (!queryable_forms.empty()) {
|
|
- NotifyObservers(&Observer::OnBeforeLoadedServerPredictions);
|
|
- // If language detection is currently reparsing the form, wait until the
|
|
- // server response is processed, to ensure server predictions are not lost.
|
|
- auto on_loaded =
|
|
- base::BindOnce(&AutofillManager::OnLoadedServerPredictions,
|
|
- GetWeakPtr(), queryable_forms, form_seen_timestamp);
|
|
- client().GetCrowdsourcingManager().StartQueryRequest(
|
|
- std::move(queryable_forms), driver().GetIsolationInfo(),
|
|
- std::move(on_loaded));
|
|
- }
|
|
}
|
|
|
|
void AutofillManager::OnCaretMovedInFormField(const FormData& form,
|
|
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
|
|
@@ -884,6 +884,7 @@ BASE_FEATURE(kAutofillPopupDontAcceptNonVisibleEnoughSuggestion,
|
|
// affect their functionality.
|
|
BASE_FEATURE(kAutofillPopupZOrderSecuritySurface,
|
|
base::FEATURE_ENABLED_BY_DEFAULT);
|
|
+SET_CROMITE_FEATURE_ENABLED(kAutofillPopupZOrderSecuritySurface);
|
|
|
|
// When enabled, we prefer a `PHONE_HOME_COUNTRY_CODE` heuristic type over a
|
|
// `HtmlFieldType::kCountryCode`.
|
|
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
|
|
@@ -35,7 +35,7 @@ constexpr char kAutofillRanExtraDeduplication[] =
|
|
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
|
// Synced prefs. Used for cross-device choices, e.g., credit card Autofill.
|
|
registry->RegisterBooleanPref(
|
|
- kAutofillProfileEnabled, true,
|
|
+ kAutofillProfileEnabled, false,
|
|
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
|
registry->RegisterIntegerPref(
|
|
kAutofillLastVersionDeduped, 0,
|
|
@@ -63,10 +63,10 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
|
kAutofillHasSeenIban, false,
|
|
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
|
registry->RegisterBooleanPref(
|
|
- kAutofillCreditCardEnabled, true,
|
|
+ kAutofillCreditCardEnabled, false,
|
|
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
|
registry->RegisterBooleanPref(
|
|
- kAutofillPaymentCvcStorage, true,
|
|
+ kAutofillPaymentCvcStorage, false,
|
|
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
|
registry->RegisterBooleanPref(
|
|
kAutofillPaymentCardBenefits, true,
|
|
@@ -165,7 +165,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
|
}
|
|
|
|
// Deprecated prefs registered for migration.
|
|
- registry->RegisterBooleanPref(kAutofillEnabledDeprecated, true);
|
|
+ registry->RegisterBooleanPref(kAutofillEnabledDeprecated, false);
|
|
registry->RegisterStringPref(kAutofillAblationSeedPref, "");
|
|
#if BUILDFLAG(IS_ANDROID)
|
|
registry->RegisterBooleanPref(kFacilitatedPaymentsPixAccountLinkingDeprecated,
|
|
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
|
|
@@ -103,7 +103,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;
|
|
@@ -113,10 +112,6 @@ bool PasswordGenerationFrameHelper::IsGenerationEnabled(
|
|
}
|
|
|
|
GURL url = driver_->GetLastCommittedURL();
|
|
- if (url.DomainIs("google.com")) {
|
|
- return false;
|
|
- }
|
|
-
|
|
if (!password_manager_util::IsAbleToSavePasswords(client_)) {
|
|
if (logger) {
|
|
logger->LogMessage(
|
|
--
|