Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: components/autofill/core/browser/autofill_download.cc

Issue 196603015: [Autofill] Cleanup: Remove the --autofill-service-url flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_download.cc
diff --git a/components/autofill/core/browser/autofill_download.cc b/components/autofill/core/browser/autofill_download.cc
index 682c98c9ad1f346bd080134156c68fbcf7cff7b0..f65886aa594a0e6f785055b16cd29b8ce73a517d 100644
--- a/components/autofill/core/browser/autofill_download.cc
+++ b/components/autofill/core/browser/autofill_download.cc
@@ -9,7 +9,6 @@
#include "base/rand_util.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
-#include "components/autofill/core/browser/autofill_download_url.h"
#include "components/autofill/core/browser/autofill_driver.h"
#include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/autofill_xml_parser.h"
@@ -28,8 +27,13 @@ namespace {
const char kAutofillQueryServerNameStartInHeader[] = "GFE/";
const size_t kMaxFormCacheSize = 16;
-std::string AutofillRequestTypeToString(
- AutofillDownloadManager::AutofillRequestType type) {
+#if defined(GOOGLE_CHROME_BUILD)
+const char kClientName[] = "Google Chrome";
+#else
+const char kClientName[] = "Chromium";
+#endif // defined(GOOGLE_CHROME_BUILD)
+
+std::string RequestTypeToString(AutofillDownloadManager::RequestType type) {
switch (type) {
case AutofillDownloadManager::REQUEST_QUERY:
return "query";
@@ -40,11 +44,18 @@ std::string AutofillRequestTypeToString(
return std::string();
}
+GURL GetRequestUrl(AutofillDownloadManager::RequestType request_type) {
+ return GURL("https://clients1.google.com/tbproxy/af/" +
+ RequestTypeToString(request_type) +
+ "?client=" + kClientName);
Evan Stade 2014/03/14 18:35:47 4 more indent i think
Ilya Sherman 2014/03/14 21:53:47 Done (by way of "git cl format" over the CL).
+}
+
+
} // namespace
struct AutofillDownloadManager::FormRequestData {
std::vector<std::string> form_signatures;
- AutofillRequestType request_type;
+ RequestType request_type;
};
AutofillDownloadManager::AutofillDownloadManager(AutofillDriver* driver,
@@ -165,11 +176,7 @@ bool AutofillDownloadManager::StartRequest(
net::URLRequestContextGetter* request_context =
driver_->GetURLRequestContext();
DCHECK(request_context);
- GURL request_url;
- if (request_data.request_type == AutofillDownloadManager::REQUEST_QUERY)
- request_url = autofill::GetAutofillQueryUrl();
- else
- request_url = autofill::GetAutofillUploadUrl();
+ GURL request_url = GetRequestUrl(request_data.request_type);
// Id is ignored for regular chrome, in unit test id's for fake fetcher
// factory will be 0, 1, 2, ...
@@ -185,7 +192,7 @@ bool AutofillDownloadManager::StartRequest(
fetcher->Start();
DVLOG(1) << "Sending AutofillDownloadManager "
- << AutofillRequestTypeToString(request_data.request_type)
+ << RequestTypeToString(request_data.request_type)
<< " request: " << form_xml;
return true;
@@ -254,8 +261,7 @@ void AutofillDownloadManager::OnURLFetchComplete(
// with unknown fetcher when network is refreshed.
return;
}
- std::string type_of_request(
- AutofillRequestTypeToString(it->second.request_type));
+ std::string request_type(RequestTypeToString(it->second.request_type));
const int kHttpResponseOk = 200;
const int kHttpInternalServerError = 500;
const int kHttpBadGateway = 502;
@@ -290,7 +296,7 @@ void AutofillDownloadManager::OnURLFetchComplete(
}
}
- DVLOG(1) << "AutofillDownloadManager: " << type_of_request
+ DVLOG(1) << "AutofillDownloadManager: " << request_type
<< " request has failed with response "
<< source->GetResponseCode();
observer_->OnServerRequestError(it->second.form_signatures[0],
@@ -299,7 +305,7 @@ void AutofillDownloadManager::OnURLFetchComplete(
} else {
std::string response_body;
source->GetResponseAsString(&response_body);
- DVLOG(1) << "AutofillDownloadManager: " << type_of_request
+ DVLOG(1) << "AutofillDownloadManager: " << request_type
<< " request has succeeded with response body: "
<< response_body;
if (it->second.request_type == AutofillDownloadManager::REQUEST_QUERY) {
« no previous file with comments | « components/autofill/core/browser/autofill_download.h ('k') | components/autofill/core/browser/autofill_download_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698