forked from uazo/cromite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautofill-miscellaneous.patch
244 lines (226 loc) · 11.2 KB
/
autofill-miscellaneous.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
From: csagan5 <[email protected]>
Date: Mon, 11 Apr 2022 23:29:29 +0200
Subject: autofill: miscellaneous
Make sure that autofill is disabled by default (Jan Engelhardt <[email protected]>)
Disable autofill download manager (Jan Engelhardt <[email protected]>)
Disable autofill assistant and CC (csagan5)
Disable autofill server communication by default (Daniel Micay <[email protected]>)
Do not skip google.com domains for password generation (csagan5)
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
chrome/browser/prefs/browser_prefs.cc | 2 +-
.../ui/autofill/chrome_autofill_client.cc | 7 +-
.../core/browser/browser_autofill_manager.h | 4 +-
.../autofill_crowdsourcing_manager.cc | 69 ++-----------------
.../autofill_crowdsourcing_manager.h | 2 -
.../autofill/core/common/autofill_features.cc | 1 +
.../autofill/core/common/autofill_prefs.cc | 10 +--
.../password_generation_frame_helper.cc | 4 --
8 files changed, 15 insertions(+), 84 deletions(-)
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1344,7 +1344,7 @@ void RegisterProfilePrefsForMigration(
#endif
// Deprecated 12/2023.
- registry->RegisterBooleanPref(kDownloadDuplicateFilePromptEnabled, true);
+ registry->RegisterBooleanPref(kDownloadDuplicateFilePromptEnabled, false);
// Deprecated 12/2023.
registry->RegisterInt64Pref(kModelQualityLoggingClientId, true);
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
@@ -242,12 +242,7 @@ ChromeAutofillClient::GetURLLoaderFactory() {
}
AutofillCrowdsourcingManager* ChromeAutofillClient::GetCrowdsourcingManager() {
- if (!crowdsourcing_manager_) {
- // Lazy initialization to avoid virtual function calls in the constructor.
- crowdsourcing_manager_ = std::make_unique<AutofillCrowdsourcingManager>(
- this, GetChannel(), GetLogManager());
- }
- return crowdsourcing_manager_.get();
+ return nullptr;
}
AutofillOptimizationGuide* ChromeAutofillClient::GetAutofillOptimizationGuide()
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
@@ -577,9 +577,9 @@ class BrowserAutofillManager : public AutofillManager {
manual_fallback_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 shown Autofill suggestions at least once?
- bool did_show_suggestions_ = false;
+ bool did_show_suggestions_ = true;
// Has the user manually edited at least one form field among the autofillable
// ones?
bool user_did_type_ = false;
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
@@ -475,33 +475,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(RequestType::kRequestQuery, "1234", "GET") will return
-// "/v1/pages/1234".
-// * GetAPIMethodUrl(RequestType::kRequestQuery, "1234", "POST") will return
-// "/v1/pages:get".
-// * GetAPIMethodUrl(RequestType::kRequestUpload, "", "POST") will return
-// "/v1/forms:vote".
-std::string GetAPIMethodUrl(RequestType type,
- std::string_view resource_id,
- std::string_view method) {
- const char* api_method_url = [&] {
- switch (type) {
- case RequestType::kRequestQuery:
- return method == "POST" ? "/v1/pages:get" : "/v1/pages";
- case RequestType::kRequestUpload:
- return "/v1/forms:vote";
- }
- NOTREACHED_NORETURN();
- }();
- 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,
RequestType type) {
@@ -533,18 +506,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.
- if (channel == version_info::Channel::STABLE) {
- return google_apis::GetAPIKey();
- }
- return google_apis::GetNonStableAPIKey();
+ return std::string();
}
std::optional<std::vector<variations::VariationID>>& GetActiveExperiments() {
@@ -774,34 +736,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 == RequestType::kRequestQuery) {
- if (GetPayloadLength(request_data.payload) <= kMaxQueryGetSize) {
- resource_id = request_data.payload;
- method = "GET";
- base::UmaHistogramBoolean(kUmaApiUrlIsTooLong, false);
- } else {
- base::UmaHistogramBoolean(kUmaApiUrlIsTooLong, true);
- }
- 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
@@ -33,8 +33,6 @@ namespace autofill {
class AutofillClient;
class LogManager;
-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/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
@@ -775,6 +775,7 @@ BASE_FEATURE(kAutofillUploadThrottling,
"AutofillUploadThrottling",
base::FEATURE_ENABLED_BY_DEFAULT);
+SET_CROMITE_FEATURE_DISABLED(kAutofillServerCommunication);
} // namespace test
} // namespace autofill::features
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
@@ -39,7 +39,7 @@ int GetSyncTransportOptInBitFieldForAccount(const PrefService* prefs,
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
// Synced prefs. Used for cross-device choices, e.g., credit card Autofill.
registry->RegisterBooleanPref(
- prefs::kAutofillProfileEnabled, true,
+ prefs::kAutofillProfileEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterIntegerPref(
prefs::kAutofillLastVersionDeduped, 0,
@@ -48,10 +48,10 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
prefs::kAutofillHasSeenIban, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(
- prefs::kAutofillCreditCardEnabled, true,
+ prefs::kAutofillCreditCardEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(
- prefs::kAutofillPaymentCvcStorage, true,
+ prefs::kAutofillPaymentCvcStorage, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(
kAutofillPaymentCardBenefits, true,
@@ -94,9 +94,9 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
#endif
// Deprecated prefs registered for migration.
- registry->RegisterBooleanPref(prefs::kAutofillEnabledDeprecated, true);
+ registry->RegisterBooleanPref(prefs::kAutofillEnabledDeprecated, false);
registry->RegisterBooleanPref(prefs::kAutofillOrphanRowsRemoved, false);
- registry->RegisterBooleanPref(prefs::kAutofillIbanEnabled, true);
+ registry->RegisterBooleanPref(prefs::kAutofillIbanEnabled, false);
registry->RegisterIntegerPref(
prefs::kAutofillLastVersionDisusedAddressesDeleted, 0);
registry->RegisterIntegerPref(
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
@@ -95,7 +95,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;
@@ -105,9 +104,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(
--