From e4b54e3e6f3086905b27cdcfe86667d0ad157f94 Mon Sep 17 00:00:00 2001 From: "kinaba@chromium.org" Date: Fri, 17 Jan 2014 13:55:20 +0000 Subject: 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 --- google_apis/google_api_keys.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'google_apis/google_api_keys.cc') diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc index 94f6812..2cf92fd 100644 --- a/google_apis/google_api_keys.cc +++ b/google_apis/google_api_keys.cc @@ -269,4 +269,12 @@ std::string GetOAuth2ClientSecret(OAuth2Client 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 -- cgit v1.1