Commit e4b54e3e authored by kinaba@chromium.org's avatar kinaba@chromium.org

Add a function for determining if official Google Chrome API key is used.

I'd like to add this for handling several features of Google Drive API
that is only available for whitelisted first-party client.
By checking the key by the newly added function, we can provide
better fallbacks for clients with third-party keys, instead of just failing.

BUG=332332, 324166

Review URL: https://codereview.chromium.org/131743018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245504 0039d316-1c4b-4281-b951-d872f2087c98
parent 4ed078d3
...@@ -269,4 +269,12 @@ std::string GetOAuth2ClientSecret(OAuth2Client client) { ...@@ -269,4 +269,12 @@ std::string GetOAuth2ClientSecret(OAuth2Client client) {
return g_api_key_cache.Get().GetClientSecret(client); return g_api_key_cache.Get().GetClientSecret(client);
} }
bool IsGoogleChromeAPIKeyUsed() {
#if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
return true;
#else
return false;
#endif
}
} // namespace google_apis } // namespace google_apis
...@@ -90,6 +90,10 @@ std::string GetOAuth2ClientID(OAuth2Client client); ...@@ -90,6 +90,10 @@ std::string GetOAuth2ClientID(OAuth2Client client);
// in, e.g. URL-escaped if you use it in a URL. // in, e.g. URL-escaped if you use it in a URL.
std::string GetOAuth2ClientSecret(OAuth2Client client); std::string GetOAuth2ClientSecret(OAuth2Client client);
// Returns if the API key using in the current build is the one for official
// Google Chrome.
bool IsGoogleChromeAPIKeyUsed();
} // namespace google_apis } // namespace google_apis
#endif // GOOGLE_APIS_GOOGLE_API_KEYS_H_ #endif // GOOGLE_APIS_GOOGLE_API_KEYS_H_
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