summaryrefslogtreecommitdiffstats
path: root/google_apis/google_api_keys.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-16 19:10:40 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-16 19:10:40 +0000
commite7dd789201dfe869fbba7acb06f63da58ec77f05 (patch)
tree60531f4a90c7687dfe92eae04e870654a874d522 /google_apis/google_api_keys.cc
parenta1c8bae3608e6c40f0258fbb780223cdae0b61d5 (diff)
downloadchromium_src-e7dd789201dfe869fbba7acb06f63da58ec77f05.zip
chromium_src-e7dd789201dfe869fbba7acb06f63da58ec77f05.tar.gz
chromium_src-e7dd789201dfe869fbba7acb06f63da58ec77f05.tar.bz2
Display an infobar on startup when Google API keys are missing.
BUG=158766 R=joi@chromium.org, pkasting@chromium.org Review URL: https://codereview.chromium.org/14766011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/google_api_keys.cc')
-rw-r--r--google_apis/google_api_keys.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc
index c05435e..034b69a 100644
--- a/google_apis/google_api_keys.cc
+++ b/google_apis/google_api_keys.cc
@@ -235,6 +235,21 @@ class APIKeyCache {
static base::LazyInstance<APIKeyCache> g_api_key_cache =
LAZY_INSTANCE_INITIALIZER;
+bool HasKeysConfigured() {
+ if (GetAPIKey() == DUMMY_API_TOKEN)
+ return false;
+
+ for (size_t client_id = 0; client_id < CLIENT_NUM_ITEMS; ++client_id) {
+ OAuth2Client client = static_cast<OAuth2Client>(client_id);
+ if (GetOAuth2ClientID(client) == DUMMY_API_TOKEN ||
+ GetOAuth2ClientSecret(client) == DUMMY_API_TOKEN) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
std::string GetAPIKey() {
return g_api_key_cache.Get().api_key();
}