[google_apis] Only define platform-specific keys on those platforms
GOOGLE_API_KEY_ANDROID_NON_STABLE is specific to Android. GOOGLE_API_KEY_SHARING is used by Nearby. Per https://crrev.com/c/2441025, the feature but is now "a Chrome OS-only feature." https://crrev.com/c/2564980 later updated the condition for files that use this feature to use `is_chromeos_ash` instead of `is_chromeos`. Bug: 1031156, 1377536 Change-Id: I77ad476d373cd6dfb98a5ed5f71f8ff79270199a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3984260 Auto-Submit: David Dorwin <ddorwin@chromium.org> Commit-Queue: Mihai Sardarescu <msarda@chromium.org> Reviewed-by: Mihai Sardarescu <msarda@chromium.org> Cr-Commit-Position: refs/heads/main@{#1064783}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
b4aa65faee
commit
581738bbaf
google_apis
@ -163,7 +163,10 @@ template("google_apis_tmpl") {
|
||||
|
||||
configs += [ ":key_defines" ]
|
||||
|
||||
public_deps = [ ":buildflags" ]
|
||||
public_deps = [
|
||||
":buildflags",
|
||||
"//build:chromeos_buildflags",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":oauth2_mint_token_consent_result_proto",
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/stringize_macros.h"
|
||||
#include "build/branding_buildflags.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "google_apis/buildflags.h"
|
||||
#include "google_apis/gaia/gaia_config.h"
|
||||
#include "google_apis/gaia/gaia_switches.h"
|
||||
@ -67,18 +68,22 @@
|
||||
#define GOOGLE_CLIENT_SECRET_REMOTING_HOST DUMMY_API_TOKEN
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#if !defined(GOOGLE_API_KEY_ANDROID_NON_STABLE)
|
||||
#define GOOGLE_API_KEY_ANDROID_NON_STABLE DUMMY_API_TOKEN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(GOOGLE_API_KEY_REMOTING)
|
||||
#define GOOGLE_API_KEY_REMOTING DUMMY_API_TOKEN
|
||||
#endif
|
||||
|
||||
// API key for SharingService.
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
// API key for the Nearby Sharing Service.
|
||||
#if !defined(GOOGLE_API_KEY_SHARING)
|
||||
#define GOOGLE_API_KEY_SHARING DUMMY_API_TOKEN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// API key for the Speech On-Device API (SODA).
|
||||
#if !defined(GOOGLE_API_KEY_SODA)
|
||||
@ -139,9 +144,11 @@ class APIKeyCache {
|
||||
STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_REMOTING), nullptr, std::string(),
|
||||
environment.get(), command_line, gaia_config);
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
api_key_sharing_ = CalculateKeyValue(
|
||||
GOOGLE_API_KEY_SHARING, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SHARING),
|
||||
nullptr, std::string(), environment.get(), command_line, gaia_config);
|
||||
#endif
|
||||
|
||||
api_key_soda_ = CalculateKeyValue(
|
||||
GOOGLE_API_KEY_SODA, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SODA),
|
||||
@ -211,7 +218,9 @@ class APIKeyCache {
|
||||
#endif
|
||||
std::string api_key_non_stable() const { return api_key_non_stable_; }
|
||||
std::string api_key_remoting() const { return api_key_remoting_; }
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
std::string api_key_sharing() const { return api_key_sharing_; }
|
||||
#endif
|
||||
std::string api_key_soda() const { return api_key_soda_; }
|
||||
std::string api_key_read_aloud() const { return api_key_read_aloud_; }
|
||||
std::string api_key_fresnel() const { return api_key_fresnel_; }
|
||||
@ -318,7 +327,9 @@ class APIKeyCache {
|
||||
std::string api_key_;
|
||||
std::string api_key_non_stable_;
|
||||
std::string api_key_remoting_;
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
std::string api_key_sharing_;
|
||||
#endif
|
||||
std::string api_key_soda_;
|
||||
std::string api_key_read_aloud_;
|
||||
std::string api_key_fresnel_;
|
||||
@ -346,9 +357,11 @@ std::string GetRemotingAPIKey() {
|
||||
return g_api_key_cache.Get().api_key_remoting();
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
std::string GetSharingAPIKey() {
|
||||
return g_api_key_cache.Get().api_key_sharing();
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string GetSodaAPIKey() {
|
||||
return g_api_key_cache.Get().api_key_soda();
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "google_apis/buildflags.h"
|
||||
|
||||
// These functions enable you to retrieve keys to use for Google APIs
|
||||
@ -78,8 +79,10 @@ std::string GetNonStableAPIKey();
|
||||
// Retrieves the Chrome Remote Desktop API key.
|
||||
std::string GetRemotingAPIKey();
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
// Retrieves the Sharing API Key.
|
||||
std::string GetSharingAPIKey();
|
||||
#endif
|
||||
|
||||
// Retrieves the Speech On-Device API (SODA) API Key.
|
||||
std::string GetSodaAPIKey();
|
||||
|
Reference in New Issue
Block a user