Commit 701d2093 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

Update to use the new remoting API keys

Previously Chrome Remote Desktop uses GOOGLE_API_KEY_REMOTING_FTL and
GOOGLE_API_KEY_REMOTING_FTL_MOBILE. This internal CL defines a
GOOGLE_API_KEY_REMOTING macro for each of the platform:
https://chrome-internal-review.googlesource.com/c/chrome/google_apis/internal/+/1283134

This CL updates google_apis and existing code to use the new
GOOGLE_API_KEY_REMOTING. I'll remove
GOOGLE_API_KEY_REMOTING_FTL(_MOBILE)? once this CL is checked in.

Bug: 961541
Change-Id: I03073acb23950fe0d361081b1bbf2c2fdfe750f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1605159Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658779}
parent df165fe9
...@@ -78,12 +78,8 @@ ...@@ -78,12 +78,8 @@
#define GOOGLE_API_KEY_PHYSICAL_WEB_TEST DUMMY_API_TOKEN #define GOOGLE_API_KEY_PHYSICAL_WEB_TEST DUMMY_API_TOKEN
#endif #endif
#if !defined(GOOGLE_API_KEY_REMOTING_FTL) #if !defined(GOOGLE_API_KEY_REMOTING)
#define GOOGLE_API_KEY_REMOTING_FTL DUMMY_API_TOKEN #define GOOGLE_API_KEY_REMOTING DUMMY_API_TOKEN
#endif
#if !defined(GOOGLE_API_KEY_REMOTING_FTL_MOBILE)
#define GOOGLE_API_KEY_REMOTING_FTL_MOBILE DUMMY_API_TOKEN
#endif #endif
// These are used as shortcuts for developers and users providing // These are used as shortcuts for developers and users providing
...@@ -124,15 +120,10 @@ class APIKeyCache { ...@@ -124,15 +120,10 @@ class APIKeyCache {
api_key_non_stable_ = api_key_; api_key_non_stable_ = api_key_;
#endif #endif
api_key_remoting_ftl_ = CalculateKeyValue( api_key_remoting_ = CalculateKeyValue(
GOOGLE_API_KEY_REMOTING_FTL, GOOGLE_API_KEY_REMOTING,
STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_REMOTING_FTL), nullptr, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_REMOTING), nullptr, std::string(),
std::string(), environment.get(), command_line); environment.get(), command_line);
api_key_remoting_ftl_mobile_ = CalculateKeyValue(
GOOGLE_API_KEY_REMOTING_FTL_MOBILE,
STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_REMOTING_FTL_MOBILE), nullptr,
std::string(), environment.get(), command_line);
metrics_key_ = CalculateKeyValue( metrics_key_ = CalculateKeyValue(
GOOGLE_METRICS_SIGNING_KEY, GOOGLE_METRICS_SIGNING_KEY,
...@@ -202,10 +193,7 @@ class APIKeyCache { ...@@ -202,10 +193,7 @@ class APIKeyCache {
void set_api_key(const std::string& api_key) { api_key_ = api_key; } void set_api_key(const std::string& api_key) { api_key_ = api_key; }
#endif #endif
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_ftl() const { return api_key_remoting_ftl_; } std::string api_key_remoting() const { return api_key_remoting_; }
std::string api_key_remoting_ftl_mobile() const {
return api_key_remoting_ftl_mobile_;
}
std::string metrics_key() const { return metrics_key_; } std::string metrics_key() const { return metrics_key_; }
...@@ -303,8 +291,7 @@ class APIKeyCache { ...@@ -303,8 +291,7 @@ class APIKeyCache {
std::string api_key_; std::string api_key_;
std::string api_key_non_stable_; std::string api_key_non_stable_;
std::string api_key_remoting_ftl_; std::string api_key_remoting_;
std::string api_key_remoting_ftl_mobile_;
std::string metrics_key_; std::string metrics_key_;
std::string client_ids_[CLIENT_NUM_ITEMS]; std::string client_ids_[CLIENT_NUM_ITEMS];
std::string client_secrets_[CLIENT_NUM_ITEMS]; std::string client_secrets_[CLIENT_NUM_ITEMS];
...@@ -325,12 +312,8 @@ std::string GetNonStableAPIKey() { ...@@ -325,12 +312,8 @@ std::string GetNonStableAPIKey() {
return g_api_key_cache.Get().api_key_non_stable(); return g_api_key_cache.Get().api_key_non_stable();
} }
std::string GetRemotingFtlAPIKey() { std::string GetRemotingAPIKey() {
return g_api_key_cache.Get().api_key_remoting_ftl(); return g_api_key_cache.Get().api_key_remoting();
}
std::string GetRemotingFtlMobileAPIKey() {
return g_api_key_cache.Get().api_key_remoting_ftl_mobile();
} }
#if defined(OS_IOS) #if defined(OS_IOS)
......
...@@ -73,10 +73,8 @@ std::string GetAPIKey(); ...@@ -73,10 +73,8 @@ std::string GetAPIKey();
// Non-stable channels may have a different Google API key. // Non-stable channels may have a different Google API key.
std::string GetNonStableAPIKey(); std::string GetNonStableAPIKey();
// Retrieves the Chrome Remote Desktop FTL API key to be used during the // Retrieves the Chrome Remote Desktop API key.
// signaling process. std::string GetRemotingAPIKey();
std::string GetRemotingFtlAPIKey();
std::string GetRemotingFtlMobileAPIKey();
#if defined(OS_IOS) #if defined(OS_IOS)
// Sets the API key. This should be called as early as possible before this // Sets the API key. This should be called as early as possible before this
......
...@@ -83,12 +83,7 @@ GrpcChannelSharedPtr FtlGrpcContext::CreateChannel() { ...@@ -83,12 +83,7 @@ GrpcChannelSharedPtr FtlGrpcContext::CreateChannel() {
// static // static
void FtlGrpcContext::FillClientContext(grpc::ClientContext* context) { void FtlGrpcContext::FillClientContext(grpc::ClientContext* context) {
#if defined(OS_ANDROID) || defined(OS_IOS) context->AddMetadata("x-goog-api-key", google_apis::GetRemotingAPIKey());
std::string api_key = google_apis::GetRemotingFtlMobileAPIKey();
#else
std::string api_key = google_apis::GetRemotingFtlAPIKey();
#endif
context->AddMetadata("x-goog-api-key", api_key);
} }
// static // static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment