0

Add remoting FTL API key

Add API key for remoting to use during the signaling process. Note that
this key is only used by Chrome Remote Desktop and will not be used in
the Chrome browser.

Internal CL: https://chrome-internal-review.googlesource.com/c/chrome/google_apis/internal/+/831973

Bug: 927962
Change-Id: Iecfa48aebe1078a4a0c747f42711000d9155fc3f
Reviewed-on: https://chromium-review.googlesource.com/c/1450409
Reviewed-by: Joe Downing <joedow@chromium.org>
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Auto-Submit: Yuwei Huang <yuweih@chromium.org>
Commit-Queue: Roger Tawa <rogerta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630352}
This commit is contained in:
Yuwei Huang
2019-02-08 16:49:56 +00:00
committed by Commit Bot
parent f98aeb561a
commit c0cf050da7
2 changed files with 19 additions and 0 deletions

@ -73,6 +73,10 @@
#define GOOGLE_API_KEY_PHYSICAL_WEB_TEST DUMMY_API_TOKEN
#endif
#if !defined(GOOGLE_API_KEY_REMOTING_FTL)
#define GOOGLE_API_KEY_REMOTING_FTL 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
@ -111,6 +115,11 @@ class APIKeyCache {
api_key_non_stable_ = api_key_;
#endif
api_key_remoting_ftl_ =
CalculateKeyValue(GOOGLE_API_KEY_REMOTING_FTL,
STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_REMOTING_FTL),
NULL, std::string(), environment.get(), command_line);
std::string default_client_id =
CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_ID,
STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID),
@ -198,6 +207,7 @@ class APIKeyCache {
void set_api_key(const std::string& api_key) { api_key_ = api_key; }
#endif
std::string api_key_non_stable() const { return api_key_non_stable_; }
std::string api_key_remoting_ftl() const { return api_key_remoting_ftl_; }
std::string GetClientID(OAuth2Client client) const {
DCHECK_LT(client, CLIENT_NUM_ITEMS);
@ -293,6 +303,7 @@ class APIKeyCache {
std::string api_key_;
std::string api_key_non_stable_;
std::string api_key_remoting_ftl_;
std::string client_ids_[CLIENT_NUM_ITEMS];
std::string client_secrets_[CLIENT_NUM_ITEMS];
};
@ -312,6 +323,10 @@ std::string GetNonStableAPIKey() {
return g_api_key_cache.Get().api_key_non_stable();
}
std::string GetFtlAPIKey() {
return g_api_key_cache.Get().api_key_remoting_ftl();
}
#if defined(OS_IOS)
void SetAPIKey(const std::string& api_key) {
g_api_key_cache.Get().set_api_key(api_key);

@ -73,6 +73,10 @@ std::string GetAPIKey();
// Non-stable channels may have a different Google API key.
std::string GetNonStableAPIKey();
// Retrieves the Chrome Remote Desktop FTL API key to be used during the
// signaling process.
std::string GetRemotingFtlAPIKey();
#if defined(OS_IOS)
// Sets the API key. This should be called as early as possible before this
// API key is even accessed.