From: Jan Engelhardt <jengelh@inai.de>
Date: Thu, 11 Sep 2014 16:37:32 +0200
Subject: autofill: disable autofill download manager

Disables the autofill download manager (trk:158).
---
 .../autofill/core/browser/autofill_download_manager.cc | 13 ++++++++++++-
 components/autofill/core/browser/autofill_manager.cc   | 18 ------------------
 2 files changed, 12 insertions(+), 19 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
@@ -60,7 +60,6 @@ constexpr std::pair<int, int> kAutofillExperimentRanges[] = {
     {3314445, 3314448}, {3314854, 3314883},
 };
 
-const size_t kMaxQueryGetSize = 1400;  // 1.25KB
 const size_t kAutofillDownloadManagerMaxFormCacheSize = 16;
 const size_t kMaxFieldsPerQueryRequest = 100;
 
@@ -448,6 +447,7 @@ bool GetUploadPayloadForApi(const AutofillUploadContents& upload,
   return upload_request.SerializeToString(payload);
 }
 
+/*
 // Gets an API method URL given its type (query or upload) and an optional
 // resource ID.
 // Example usage:
@@ -470,6 +470,7 @@ std::string GetAPIMethodUrl(AutofillDownloadManager::RequestType type,
   }
   return base::StrCat({api_method_url, "/", resource_id});
 }
+*/
 
 }  // namespace
 
@@ -643,6 +644,7 @@ void AutofillDownloadManager::ClearUploadHistory(PrefService* pref_service) {
 
 std::tuple<GURL, std::string> AutofillDownloadManager::GetRequestURLAndMethod(
     const FormRequestData& request_data) const {
+#if 0
   std::string method("POST");
   std::string query_str;
 
@@ -665,12 +667,17 @@ std::tuple<GURL, std::string> AutofillDownloadManager::GetRequestURLAndMethod(
   GURL url = autofill_server_url_
                  .Resolve(RequestTypeToString(request_data.request_type))
                  .ReplaceComponents(replacements);
+#else
+  std::string method("GET");
+  GURL url = GURL("about:blank");
+#endif
   return std::make_tuple(std::move(url), std::move(method));
 }
 
 std::tuple<GURL, std::string>
 AutofillDownloadManager::GetRequestURLAndMethodForApi(
     const FormRequestData& request_data) const {
+#if 0
   // ID of the resource to add to the API request URL. Nothing will be added if
   // |resource_id| is empty.
   std::string resource_id;
@@ -699,6 +706,10 @@ AutofillDownloadManager::GetRequestURLAndMethodForApi(
       (request_data.request_type == AutofillDownloadManager::REQUEST_QUERY)
           ? "GET"
           : "POST";
+#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_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
@@ -175,19 +175,6 @@ void LogDeveloperEngagementUkm(ukm::UkmRecorder* ukm_recorder,
   }
 }
 
-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
 
 AutofillManager::FillingContext::FillingContext() = default;
@@ -1277,11 +1264,6 @@ AutofillManager::AutofillManager(
       weak_ptr_factory_(this) {
   DCHECK(driver);
   DCHECK(client_);
-  if (enable_download_manager == ENABLE_AUTOFILL_DOWNLOAD_MANAGER) {
-    version_info::Channel channel = client_->GetChannel();
-    download_manager_.reset(
-        new AutofillDownloadManager(driver, this, GetAPIKeyForUrl(channel)));
-  }
   CountryNames::SetLocaleString(app_locale_);
   // Since we want Downstream to still work in incognito, only overwrite the
   // PDM's sync service if this is not an incognito AutofillManager. However, if
-- 
2.11.0

