Commit ffed3636 authored by Vincent Boisselle's avatar Vincent Boisselle Committed by Commit Bot

Added a command line flag to pass a custom Autofill API key.

Change-Id: Ic84e3b2fc4126937a4227d20f0acf03a2f8bcfba
Reviewed-on: https://chromium-review.googlesource.com/c/1355425Reviewed-by: default avatarRoger McFarlane <rogerm@chromium.org>
Commit-Queue: Vincent Boisselle <vincb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612407}
parent 81b9c8b4
......@@ -172,6 +172,13 @@ 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();
......
......@@ -8,6 +8,11 @@
namespace autofill {
namespace switches {
// Sets the API key that will be used when calling Autofill API instead of
// using Chrome's baked key by default. You can use this to test new versions
// of the API that are not linked to the Chrome baked key yet.
const char kAutofillAPIKey[] = "autofill-api-key";
// Override the default autofill server URL with "scheme://host[:port]/prefix/".
const char kAutofillServerURL[] = "autofill-server-url";
......
......@@ -12,6 +12,7 @@ namespace switches {
// All switches in alphabetical order. The switches should be documented
// alongside the definition of their values in the .cc file.
extern const char kAutofillAPIKey[];
extern const char kAutofillServerURL[];
extern const char kAutofillMetadataUploadEncoding[];
extern const char kDisableOfferStoreUnmaskedWalletCards[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment