Reland "Reland "HaTS: Add HaTS Api Key""
This is a reland of commit8475f68315
It turns out google_apis/internal is not rolled automatically, so although I had submitted https://chrome-internal-review.googlesource.com/c/chrome/google_apis/internal/+/6151544, it has to be rolled manually. This roll has been done in https://crrev.com/c/4859186. Original change's description: > Reland "HaTS: Add HaTS Api Key" > > This is a reland of commit53451bb279
> > Original change's description: > > HaTS: Add HaTS Api Key > > > > Bug: 1121586, b/291043820 > > Change-Id: I6fc2db36b61d1ec4fefedf69c380aec196707032 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4683948 > > Commit-Queue: Ehimare Okoyomon <eokoyomon@chromium.org> > > Reviewed-by: Boris Sazonov <bsazonov@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#1187261} > > Bug: 1121586, b/291043820, 1475428 > Change-Id: I66e5d709c342dff35068a69f4dc0cba369aee5e3 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4808127 > Reviewed-by: Boris Sazonov <bsazonov@chromium.org> > Commit-Queue: Ehimare Okoyomon <eokoyomon@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1188271} Bug: 1121586, b/291043820, 1475428 Change-Id: Ib160384da9ced5a3cd096dc61c9e30ead92f7fcd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4859292 Commit-Queue: Ehimare Okoyomon <eokoyomon@chromium.org> Reviewed-by: Boris Sazonov <bsazonov@chromium.org> Cr-Commit-Position: refs/heads/main@{#1196020}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
764d81fb61
commit
4ed896bb64
@@ -12,6 +12,7 @@
|
|||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/browser/web_ui.h"
|
#include "content/public/browser/web_ui.h"
|
||||||
#include "content/public/browser/web_ui_data_source.h"
|
#include "content/public/browser/web_ui_data_source.h"
|
||||||
|
#include "google_apis/google_api_keys.h"
|
||||||
|
|
||||||
HatsUIConfig::HatsUIConfig()
|
HatsUIConfig::HatsUIConfig()
|
||||||
: WebUIConfig(content::kChromeUIUntrustedScheme,
|
: WebUIConfig(content::kChromeUIUntrustedScheme,
|
||||||
@@ -36,6 +37,8 @@ HatsUI::HatsUI(content::WebUI* web_ui) : ui::UntrustedWebUIController(web_ui) {
|
|||||||
webui::SetupWebUIDataSource(
|
webui::SetupWebUIDataSource(
|
||||||
source, base::make_span(kHatsResources, kHatsResourcesSize),
|
source, base::make_span(kHatsResources, kHatsResourcesSize),
|
||||||
IDR_HATS_HATS_HTML);
|
IDR_HATS_HATS_HTML);
|
||||||
|
|
||||||
|
source->AddString("hatsApiKey", google_apis::GetHatsAPIKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
WEB_UI_CONTROLLER_TYPE_IMPL(HatsUI)
|
WEB_UI_CONTROLLER_TYPE_IMPL(HatsUI)
|
||||||
|
@@ -83,6 +83,13 @@
|
|||||||
#define GOOGLE_API_KEY_SODA DUMMY_API_TOKEN
|
#define GOOGLE_API_KEY_SODA DUMMY_API_TOKEN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !BUILDFLAG(IS_ANDROID)
|
||||||
|
// API key for the HaTS API.
|
||||||
|
#if !defined(GOOGLE_API_KEY_HATS)
|
||||||
|
#define GOOGLE_API_KEY_HATS DUMMY_API_TOKEN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
// API key for the Nearby Sharing Service.
|
// API key for the Nearby Sharing Service.
|
||||||
#if !defined(GOOGLE_API_KEY_SHARING)
|
#if !defined(GOOGLE_API_KEY_SHARING)
|
||||||
@@ -147,6 +154,11 @@ class APIKeyCache {
|
|||||||
api_key_soda_ = CalculateKeyValue(
|
api_key_soda_ = CalculateKeyValue(
|
||||||
GOOGLE_API_KEY_SODA, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SODA),
|
GOOGLE_API_KEY_SODA, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SODA),
|
||||||
nullptr, std::string(), environment.get(), command_line, gaia_config);
|
nullptr, std::string(), environment.get(), command_line, gaia_config);
|
||||||
|
#if !BUILDFLAG(IS_ANDROID)
|
||||||
|
api_key_hats_ = CalculateKeyValue(
|
||||||
|
GOOGLE_API_KEY_HATS, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_HATS),
|
||||||
|
nullptr, std::string(), environment.get(), command_line, gaia_config);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
api_key_sharing_ = CalculateKeyValue(
|
api_key_sharing_ = CalculateKeyValue(
|
||||||
@@ -219,6 +231,9 @@ class APIKeyCache {
|
|||||||
std::string api_key_non_stable() const { return api_key_non_stable_; }
|
std::string api_key_non_stable() const { return api_key_non_stable_; }
|
||||||
std::string api_key_remoting() const { return api_key_remoting_; }
|
std::string api_key_remoting() const { return api_key_remoting_; }
|
||||||
std::string api_key_soda() const { return api_key_soda_; }
|
std::string api_key_soda() const { return api_key_soda_; }
|
||||||
|
#if !BUILDFLAG(IS_ANDROID)
|
||||||
|
std::string api_key_hats() const { return api_key_hats_; }
|
||||||
|
#endif
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
std::string api_key_sharing() const { return api_key_sharing_; }
|
std::string api_key_sharing() const { return api_key_sharing_; }
|
||||||
std::string api_key_read_aloud() const { return api_key_read_aloud_; }
|
std::string api_key_read_aloud() const { return api_key_read_aloud_; }
|
||||||
@@ -328,6 +343,9 @@ class APIKeyCache {
|
|||||||
std::string api_key_non_stable_;
|
std::string api_key_non_stable_;
|
||||||
std::string api_key_remoting_;
|
std::string api_key_remoting_;
|
||||||
std::string api_key_soda_;
|
std::string api_key_soda_;
|
||||||
|
#if !BUILDFLAG(IS_ANDROID)
|
||||||
|
std::string api_key_hats_;
|
||||||
|
#endif
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
std::string api_key_sharing_;
|
std::string api_key_sharing_;
|
||||||
std::string api_key_read_aloud_;
|
std::string api_key_read_aloud_;
|
||||||
@@ -361,6 +379,12 @@ std::string GetSodaAPIKey() {
|
|||||||
return g_api_key_cache.Get().api_key_soda();
|
return g_api_key_cache.Get().api_key_soda();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !BUILDFLAG(IS_ANDROID)
|
||||||
|
std::string GetHatsAPIKey() {
|
||||||
|
return g_api_key_cache.Get().api_key_hats();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
std::string GetSharingAPIKey() {
|
std::string GetSharingAPIKey() {
|
||||||
return g_api_key_cache.Get().api_key_sharing();
|
return g_api_key_cache.Get().api_key_sharing();
|
||||||
|
@@ -83,6 +83,12 @@ COMPONENT_EXPORT(GOOGLE_APIS) std::string GetRemotingAPIKey();
|
|||||||
// Retrieves the Speech On-Device API (SODA) API Key.
|
// Retrieves the Speech On-Device API (SODA) API Key.
|
||||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetSodaAPIKey();
|
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetSodaAPIKey();
|
||||||
|
|
||||||
|
#if !BUILDFLAG(IS_ANDROID)
|
||||||
|
// Retrieves the HaTS API Key. This key is only used for desktop HaTS
|
||||||
|
// and the internal API Key is only defined in non-Android builds.
|
||||||
|
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetHatsAPIKey();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
// Retrieves the Sharing API Key.
|
// Retrieves the Sharing API Key.
|
||||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetSharingAPIKey();
|
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetSharingAPIKey();
|
||||||
|
Reference in New Issue
Block a user