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

Unified Diff: google_apis/google_api_keys.cc

Issue 690423003: Supervised user SafeSites: Expose & use API key from src-internal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month 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/google_api_keys.h ('k') | no next file » | 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 640b2ad3e52de4be503c7890bd0dc1d633b85c0f..60f0b3072fe78623d3e3a32fca49c8f3ad454a55 100644
--- a/google_apis/google_api_keys.cc
+++ b/google_apis/google_api_keys.cc
@@ -26,6 +26,10 @@
#define GOOGLE_API_KEY DUMMY_API_TOKEN
#endif
+#if !defined(GOOGLE_API_KEY_SAFESITES)
+#define GOOGLE_API_KEY_SAFESITES DUMMY_API_TOKEN
+#endif
+
#if !defined(GOOGLE_CLIENT_ID_MAIN)
#define GOOGLE_CLIENT_ID_MAIN DUMMY_API_TOKEN
#endif
@@ -86,6 +90,14 @@ class APIKeyCache {
environment.get(),
command_line);
+ api_key_safesites_ =
+ CalculateKeyValue(GOOGLE_API_KEY_SAFESITES,
+ STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SAFESITES),
+ NULL,
+ std::string(),
+ environment.get(),
+ command_line);
+
std::string default_client_id =
CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_ID,
STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID),
@@ -169,6 +181,7 @@ class APIKeyCache {
}
std::string api_key() const { return api_key_; }
+ std::string api_key_safesites() const { return api_key_safesites_; }
std::string GetClientID(OAuth2Client client) const {
DCHECK_LT(client, CLIENT_NUM_ITEMS);
@@ -234,6 +247,7 @@ class APIKeyCache {
}
std::string api_key_;
+ std::string api_key_safesites_;
std::string client_ids_[CLIENT_NUM_ITEMS];
std::string client_secrets_[CLIENT_NUM_ITEMS];
};
@@ -260,6 +274,10 @@ std::string GetAPIKey() {
return g_api_key_cache.Get().api_key();
}
+std::string GetSafeSitesAPIKey() {
+ return g_api_key_cache.Get().api_key_safesites();
+}
+
std::string GetOAuth2ClientID(OAuth2Client client) {
return g_api_key_cache.Get().GetClientID(client);
}
« no previous file with comments | « google_apis/google_api_keys.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698