Plumb through API key for ReadAloud service.
API key will be used by integration with remote ReadAloud service to provide enhanced text-to-speech synthesis to Select-to-speak. go/wavenet-chromeos-dd Bug: 1215291 Change-Id: Ib6263369a15329d9f129273698e009fc0d6c1b69 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2930784 Reviewed-by: David Roger <droger@chromium.org> Commit-Queue: Joel Riley <joelriley@google.com> Cr-Commit-Position: refs/heads/master@{#889428}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
701b1a3728
commit
43ccd76635
google_apis
@ -95,6 +95,11 @@
|
||||
#define GOOGLE_API_KEY_SODA DUMMY_API_TOKEN
|
||||
#endif
|
||||
|
||||
// API key for the ReadAloud API.
|
||||
#if !defined(GOOGLE_API_KEY_READ_ALOUD)
|
||||
#define GOOGLE_API_KEY_READ_ALOUD DUMMY_API_TOKEN
|
||||
#endif
|
||||
|
||||
// These are used as shortcuts for developers and users providing
|
||||
// OAuth credentials via preprocessor defines or environment
|
||||
// variables. If set, they will be used to replace any of the client
|
||||
@ -147,6 +152,10 @@ class APIKeyCache {
|
||||
GOOGLE_API_KEY_SODA, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SODA),
|
||||
nullptr, std::string(), environment.get(), command_line, gaia_config);
|
||||
|
||||
api_key_read_aloud_ = CalculateKeyValue(
|
||||
GOOGLE_API_KEY_SODA, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_READ_ALOUD),
|
||||
nullptr, std::string(), environment.get(), command_line, gaia_config);
|
||||
|
||||
metrics_key_ = CalculateKeyValue(
|
||||
GOOGLE_METRICS_SIGNING_KEY,
|
||||
STRINGIZE_NO_EXPANSION(GOOGLE_METRICS_SIGNING_KEY), nullptr,
|
||||
@ -213,6 +222,7 @@ class APIKeyCache {
|
||||
std::string api_key_remoting() const { return api_key_remoting_; }
|
||||
std::string api_key_sharing() const { return api_key_sharing_; }
|
||||
std::string api_key_soda() const { return api_key_soda_; }
|
||||
std::string api_key_read_aloud() const { return api_key_read_aloud_; }
|
||||
|
||||
std::string metrics_key() const { return metrics_key_; }
|
||||
|
||||
@ -326,6 +336,7 @@ class APIKeyCache {
|
||||
std::string api_key_remoting_;
|
||||
std::string api_key_sharing_;
|
||||
std::string api_key_soda_;
|
||||
std::string api_key_read_aloud_;
|
||||
std::string metrics_key_;
|
||||
std::string client_ids_[CLIENT_NUM_ITEMS];
|
||||
std::string client_secrets_[CLIENT_NUM_ITEMS];
|
||||
@ -358,6 +369,10 @@ std::string GetSodaAPIKey() {
|
||||
return g_api_key_cache.Get().api_key_soda();
|
||||
}
|
||||
|
||||
std::string GetReadAloudAPIKey() {
|
||||
return g_api_key_cache.Get().api_key_read_aloud();
|
||||
}
|
||||
|
||||
#if defined(OS_IOS) || defined(OS_FUCHSIA)
|
||||
void SetAPIKey(const std::string& api_key) {
|
||||
g_api_key_cache.Get().set_api_key(api_key);
|
||||
|
@ -85,6 +85,9 @@ std::string GetSharingAPIKey();
|
||||
// Retrieves the Speech On-Device API (SODA) API Key.
|
||||
std::string GetSodaAPIKey();
|
||||
|
||||
// Retrieves the ReadAloud API Key.
|
||||
std::string GetReadAloudAPIKey();
|
||||
|
||||
#if defined(OS_IOS) || defined(OS_FUCHSIA)
|
||||
// Sets the API key. This should be called as early as possible before this
|
||||
// API key is even accessed. It must be called before GetAPIKey.
|
||||
|
Reference in New Issue
Block a user