summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authortreib <treib@chromium.org>2014-11-24 04:35:48 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-24 12:36:07 +0000
commite81fd0f30e02e007ba86c63c9a1ce5299150fc54 (patch)
treea7f03719487992a74bc2c9beca2e156392f2ce7f /google_apis
parent6c33f25875f8fe6c4fc6c6509309417653580845 (diff)
downloadchromium_src-e81fd0f30e02e007ba86c63c9a1ce5299150fc54.zip
chromium_src-e81fd0f30e02e007ba86c63c9a1ce5299150fc54.tar.gz
chromium_src-e81fd0f30e02e007ba86c63c9a1ce5299150fc54.tar.bz2
Revert of Revert of Supervised user SafeSites: Expose & use API key from src-internal (patchset #1 id:1 of https://codereview.chromium.org/753683004/)
Reason for revert: Relanding because the original reason for reverting looks like a flake rather than an issue with the CL. Original issue's description: > Revert of Supervised user SafeSites: Expose & use API key from src-internal (patchset #5 id:80001 of https://codereview.chromium.org/690423003/) > > Reason for revert: > Build breakage on Mac: > > https://build.chromium.org/p/chromium.mac/builders/Mac%20Builder/builds/14318/steps/steps/logs/stdio > > Original issue's description: > > Supervised user SafeSites: Expose & use API key from src-internal > > > > Key was added to src-internal in https://chromereviews.googleplex.com/113767014/ > > > > BUG=417722 > > > > Committed: https://crrev.com/2ee5f146d57d07bbad3804715e06590b850711f9 > > Cr-Commit-Position: refs/heads/master@{#305412} > > TBR=rogerta@chromium.org,bauerb@chromium.org,treib@chromium.org > NOTREECHECKS=true > NOTRY=true > BUG=417722 > > Committed: https://crrev.com/13c88c66f60e6364478a411e8ccf0bfd689f0a96 > Cr-Commit-Position: refs/heads/master@{#305413} TBR=rogerta@chromium.org,bauerb@chromium.org,tnagel@chromium.org NOTRY=true BUG=417722 Review URL: https://codereview.chromium.org/756593002 Cr-Commit-Position: refs/heads/master@{#305416}
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/google_api_keys.cc18
-rw-r--r--google_apis/google_api_keys.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc
index 640b2ad..60f0b30 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);
}
diff --git a/google_apis/google_api_keys.h b/google_apis/google_api_keys.h
index b2399bf..9650593 100644
--- a/google_apis/google_api_keys.h
+++ b/google_apis/google_api_keys.h
@@ -66,6 +66,8 @@ bool HasKeysConfigured();
// e.g. URL-escaped if you use it in a URL.
std::string GetAPIKey();
+std::string GetSafeSitesAPIKey();
+
// Represents the different sets of client IDs and secrets in use.
enum OAuth2Client {
CLIENT_MAIN, // Several different features use this.