Make //google_apis a component
Multiple components depend on build target //google_apis which is against recommended practices in [1] and specifically runs into issues when new singleton-like state, include base::Feature instances, are added to //google_apis. Following recommended practices, this patch makes //google_apis a component itself, as all targets it depends on are already components. [1] https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md#dependencies-between-targets Change-Id: I9c14050314b208791d7d5773ab76a7913c422bd9 Fixed: 1417961 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4272614 Reviewed-by: Jamie Walch <jamiewalch@chromium.org> Reviewed-by: Alex Ilin <alexilin@chromium.org> Commit-Queue: Mikel Astiz <mastiz@chromium.org> Cr-Commit-Position: refs/heads/main@{#1107876}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e2f91c6353
commit
a08ea663bb
google_apis
BUILD.gn
gaia
core_account_id.hgaia_access_token_fetcher.hgaia_auth_consumer.hgaia_auth_fetcher.hgaia_auth_util.hgaia_config.hgaia_constants.hgaia_oauth_client.hgaia_switches.hgaia_urls.hgoogle_service_auth_error.hoauth2_access_token_consumer.hoauth2_access_token_fetcher.hoauth2_access_token_fetcher_immediate_error.hoauth2_access_token_fetcher_impl.hoauth2_access_token_manager.hoauth2_api_call_flow.hoauth2_id_token_decoder.hoauth2_mint_token_flow.hoauth_multilogin_result.hoauth_request_signer.h
google_api_keys.hgoogle_api_keys_mac.hremoting/base
@ -9,6 +9,7 @@
|
||||
// google_api_keys_unittest.cc.
|
||||
#include <string>
|
||||
|
||||
#include "base/component_export.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "google_apis/buildflags.h"
|
||||
@ -61,47 +62,47 @@
|
||||
|
||||
namespace google_apis {
|
||||
|
||||
extern const char kAPIKeysDevelopersHowToURL[];
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) extern const char kAPIKeysDevelopersHowToURL[];
|
||||
|
||||
// Returns true if no dummy API key is set.
|
||||
bool HasAPIKeyConfigured();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) bool HasAPIKeyConfigured();
|
||||
|
||||
// Retrieves the API key, a.k.a. developer key, or a dummy string
|
||||
// if not set.
|
||||
//
|
||||
// Note that the key should be escaped for the context you use it in,
|
||||
// e.g. URL-escaped if you use it in a URL.
|
||||
std::string GetAPIKey();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetAPIKey();
|
||||
|
||||
// Non-stable channels may have a different Google API key.
|
||||
std::string GetNonStableAPIKey();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetNonStableAPIKey();
|
||||
|
||||
// Retrieves the Chrome Remote Desktop API key.
|
||||
std::string GetRemotingAPIKey();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetRemotingAPIKey();
|
||||
|
||||
// Retrieves the Speech On-Device API (SODA) API Key.
|
||||
std::string GetSodaAPIKey();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetSodaAPIKey();
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
// Retrieves the Sharing API Key.
|
||||
std::string GetSharingAPIKey();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetSharingAPIKey();
|
||||
|
||||
// Retrieves the ReadAloud API Key.
|
||||
std::string GetReadAloudAPIKey();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetReadAloudAPIKey();
|
||||
|
||||
// Retrieves the Fresnel API Key.
|
||||
std::string GetFresnelAPIKey();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetFresnelAPIKey();
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(SUPPORT_EXTERNAL_GOOGLE_API_KEY)
|
||||
// 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.
|
||||
// TODO(https://crbug.com/1166007): Enforce this is called before GetAPIKey.
|
||||
void SetAPIKey(const std::string& api_key);
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) void SetAPIKey(const std::string& api_key);
|
||||
#endif
|
||||
|
||||
// Retrieves the key used to sign metrics (UMA/UKM) uploads.
|
||||
std::string GetMetricsKey();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) std::string GetMetricsKey();
|
||||
|
||||
// Represents the different sets of client IDs and secrets in use.
|
||||
enum OAuth2Client {
|
||||
@ -113,13 +114,14 @@ enum OAuth2Client {
|
||||
};
|
||||
|
||||
// Returns true if no dummy OAuth2 client ID and secret are set.
|
||||
bool HasOAuthClientConfigured();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) bool HasOAuthClientConfigured();
|
||||
|
||||
// Retrieves the OAuth2 client ID for the specified client, or the
|
||||
// empty string if not set.
|
||||
//
|
||||
// Note that the ID should be escaped for the context you use it in,
|
||||
// e.g. URL-escaped if you use it in a URL.
|
||||
COMPONENT_EXPORT(GOOGLE_APIS)
|
||||
std::string GetOAuth2ClientID(OAuth2Client client);
|
||||
|
||||
// Retrieves the OAuth2 client secret for the specified client, or the
|
||||
@ -127,22 +129,25 @@ std::string GetOAuth2ClientID(OAuth2Client client);
|
||||
//
|
||||
// Note that the secret should be escaped for the context you use it
|
||||
// in, e.g. URL-escaped if you use it in a URL.
|
||||
COMPONENT_EXPORT(GOOGLE_APIS)
|
||||
std::string GetOAuth2ClientSecret(OAuth2Client client);
|
||||
|
||||
#if BUILDFLAG(IS_IOS)
|
||||
// Sets the client id for the specified client. Should be called as early as
|
||||
// possible before these ids are accessed.
|
||||
COMPONENT_EXPORT(GOOGLE_APIS)
|
||||
void SetOAuth2ClientID(OAuth2Client client, const std::string& client_id);
|
||||
|
||||
// Sets the client secret for the specified client. Should be called as early as
|
||||
// possible before these secrets are accessed.
|
||||
COMPONENT_EXPORT(GOOGLE_APIS)
|
||||
void SetOAuth2ClientSecret(OAuth2Client client,
|
||||
const std::string& client_secret);
|
||||
#endif
|
||||
|
||||
// Returns if the API key using in the current build is the one for official
|
||||
// Google Chrome.
|
||||
bool IsGoogleChromeAPIKeyUsed();
|
||||
COMPONENT_EXPORT(GOOGLE_APIS) bool IsGoogleChromeAPIKeyUsed();
|
||||
|
||||
} // namespace google_apis
|
||||
|
||||
|
Reference in New Issue
Block a user