Chromium Code Reviews| Index: chrome/browser/autofill/autofill_download_url.cc |
| diff --git a/chrome/browser/autofill/autofill_download_url.cc b/chrome/browser/autofill/autofill_download_url.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5b4ac9b33efc27ef2614ebb12b0422dcbbb8d8c3 |
| --- /dev/null |
| +++ b/chrome/browser/autofill/autofill_download_url.cc |
| @@ -0,0 +1,44 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/autofill/autofill_download_url.h" |
| + |
| +#include <string> |
| + |
| +#include "base/command_line.h" |
| +#include "chrome/common/chrome_switches.h" |
| +#include "googleurl/src/gurl.h" |
| + |
| +namespace { |
|
Ilya Sherman
2012/10/29 16:47:54
nit: Leave a blank line after this one.
ahutter
2012/10/29 17:03:53
Done.
|
| +const char kDefaultAutofillServiceUrl[] = |
| + "https://clients1.google.com/tbproxy/af/"; |
| + |
| +#if defined(GOOGLE_CHROME_BUILD) |
| +const char kClientName[] = "Google Chrome"; |
| +#else |
| +const char kClientName[] = "Chromium"; |
| +#endif // defined(GOOGLE_CHROME_BUILD) |
| + |
| +std::string GetBaseAutofillUrl() { |
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + std::string baseAutofillServiceUrl = command_line.GetSwitchValueASCII( |
| + switches::kAutofillServiceUrl); |
| + if (baseAutofillServiceUrl.empty()) |
| + return kDefaultAutofillServiceUrl; |
| + |
| + return baseAutofillServiceUrl; |
| +} |
| + |
| +} |
|
Ilya Sherman
2012/10/29 16:47:54
nit: Please change this line to "} // anonymous n
ahutter
2012/10/29 17:03:53
Done.
|
| + |
| +GURL autofill::GetAutofillQueryUrl() { |
| + std::string baseAutofillServiceUrl = GetBaseAutofillUrl(); |
| + return GURL(baseAutofillServiceUrl + "query?client=" + kClientName); |
| +} |
| + |
| +GURL autofill::GetAutofillUploadUrl() { |
| + std::string baseAutofillServiceUrl = GetBaseAutofillUrl(); |
| + return GURL(baseAutofillServiceUrl + "upload?client=" + kClientName); |
| +} |
| + |