Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: google_apis/google_api_keys.cc

Issue 2224473002: Add support for loading API keys from Info.plist on iOS and macOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/DEPS ('k') | google_apis/google_api_keys_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/google_api_keys.cc
diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc
index 66de07a4ae67b4c35571e65a4c0020729433a18d..f107fd8f0e571377062154444971f8eed22cbf4b 100644
--- a/google_apis/google_api_keys.cc
+++ b/google_apis/google_api_keys.cc
@@ -18,6 +18,10 @@
#include "base/strings/stringize_macros.h"
#include "google_apis/gaia/gaia_switches.h"
+#if defined(OS_MACOSX)
+#include "google_apis/google_api_keys_mac.h"
+#endif
+
#if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
#include "google_apis/internal/google_chrome_api_keys.h"
#endif
@@ -236,6 +240,16 @@ class APIKeyCache {
base::CommandLine* command_line) {
std::string key_value = baked_in_value;
std::string temp;
+#if defined(OS_MACOSX)
+ // macOS and iOS can also override the API key with a value from the
+ // Info.plist.
+ temp = ::google_apis::GetAPIKeyFromInfoPlist(environment_variable_name);
+ if (!temp.empty()) {
+ key_value = temp;
+ VLOG(1) << "Overriding API key " << environment_variable_name
+ << " with value " << key_value << " from Info.plist.";
+ }
+#endif
if (environment->GetVar(environment_variable_name, &temp)) {
key_value = temp;
VLOG(1) << "Overriding API key " << environment_variable_name
« no previous file with comments | « google_apis/DEPS ('k') | google_apis/google_api_keys_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698