0

Add Boca API key.

The Boca API key will be used for Live Translate on ChromeOS.

Bug: b/359931233
Change-Id: Ie9b18ec6d0eb781c245301125b177ed4161386c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5908987
Reviewed-by: Avynn Donaghe <avynn@google.com>
Commit-Queue: Dorian Brandon <dorianbrandon@google.com>
Reviewed-by: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1364855}
This commit is contained in:
Dorian Brandon
2024-10-07 10:24:54 +00:00
committed by Chromium LUCI CQ
parent adceac984e
commit 43bf3dc6db
6 changed files with 22 additions and 0 deletions

@ -203,6 +203,13 @@ ApiKeyCache::ApiKeyCache(const DefaultApiKeys& default_api_keys) {
std::string(), environment.get(), command_line, gaia_config,
default_api_keys.allow_override_via_environment,
default_api_keys.allow_unset_values);
api_key_boca_ = CalculateKeyValue(
default_api_keys.google_api_key_boca,
STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_BOCA), std::string(), nullptr,
std::string(), environment.get(), command_line, gaia_config,
default_api_keys.allow_override_via_environment,
default_api_keys.allow_unset_values);
#endif
metrics_key_ = CalculateKeyValue(

@ -43,6 +43,7 @@ class COMPONENT_EXPORT(GOOGLE_APIS) ApiKeyCache {
const std::string& api_key_sharing() const { return api_key_sharing_; }
const std::string& api_key_read_aloud() const { return api_key_read_aloud_; }
const std::string& api_key_fresnel() const { return api_key_fresnel_; }
const std::string& api_key_boca() const { return api_key_boca_; }
#endif
const std::string& metrics_key() const { return metrics_key_; }
@ -72,6 +73,7 @@ class COMPONENT_EXPORT(GOOGLE_APIS) ApiKeyCache {
std::string api_key_sharing_;
std::string api_key_read_aloud_;
std::string api_key_fresnel_;
std::string api_key_boca_;
#endif
std::string metrics_key_;

@ -88,6 +88,10 @@
#if !defined(GOOGLE_API_KEY_FRESNEL)
#define GOOGLE_API_KEY_FRESNEL google_apis::DefaultApiKeys::kUnsetApiToken
#endif
#if !defined(GOOGLE_API_KEY_BOCA)
#define GOOGLE_API_KEY_BOCA google_apis::DefaultApiKeys::kUnsetApiToken
#endif
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
// These are used as shortcuts for developers and users providing
@ -122,6 +126,7 @@ constexpr ::google_apis::DefaultApiKeys GetDefaultApiKeysFromDefinedValues() {
.google_api_key_sharing = GOOGLE_API_KEY_SHARING,
.google_api_key_read_aloud = GOOGLE_API_KEY_READ_ALOUD,
.google_api_key_fresnel = GOOGLE_API_KEY_FRESNEL,
.google_api_key_boca = GOOGLE_API_KEY_BOCA,
#endif
.google_client_id_main = GOOGLE_CLIENT_ID_MAIN,
.google_client_secret_main = GOOGLE_CLIENT_SECRET_MAIN,

@ -35,6 +35,7 @@ struct DefaultApiKeys {
const char* google_api_key_sharing;
const char* google_api_key_read_aloud;
const char* google_api_key_fresnel;
const char* google_api_key_boca;
#endif
const char* google_client_id_main;

@ -99,6 +99,10 @@ const std::string& GetReadAloudAPIKey() {
const std::string& GetFresnelAPIKey() {
return GetApiKeyCacheInstance().api_key_fresnel();
}
const std::string& GetBocaAPIKey() {
return GetApiKeyCacheInstance().api_key_boca();
}
#endif
#if BUILDFLAG(SUPPORT_EXTERNAL_GOOGLE_API_KEY)

@ -111,6 +111,9 @@ COMPONENT_EXPORT(GOOGLE_APIS) const std::string& GetReadAloudAPIKey();
// Retrieves the Fresnel API Key.
COMPONENT_EXPORT(GOOGLE_APIS) const std::string& GetFresnelAPIKey();
// Retrieves the Boca API Key.
COMPONENT_EXPORT(GOOGLE_APIS) const std::string& GetBocaAPIKey();
#endif
#if BUILDFLAG(SUPPORT_EXTERNAL_GOOGLE_API_KEY)