OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "google_apis/google_api_keys.h" | 5 #include "google_apis/google_api_keys.h" |
6 | 6 |
7 // If you add more includes to this list, you also need to add them to | 7 // If you add more includes to this list, you also need to add them to |
8 // google_api_keys_unittest.cc. | 8 // google_api_keys_unittest.cc. |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 std::string GetClientID(OAuth2Client client) const { | 173 std::string GetClientID(OAuth2Client client) const { |
174 DCHECK_LT(client, CLIENT_NUM_ITEMS); | 174 DCHECK_LT(client, CLIENT_NUM_ITEMS); |
175 return client_ids_[client]; | 175 return client_ids_[client]; |
176 } | 176 } |
177 | 177 |
178 std::string GetClientSecret(OAuth2Client client) const { | 178 std::string GetClientSecret(OAuth2Client client) const { |
179 DCHECK_LT(client, CLIENT_NUM_ITEMS); | 179 DCHECK_LT(client, CLIENT_NUM_ITEMS); |
180 return client_secrets_[client]; | 180 return client_secrets_[client]; |
181 } | 181 } |
182 | 182 |
183 std::string GetSpdyProxyAuthValue() { | |
184 #if defined(SPDY_PROXY_AUTH_VALUE) | |
185 return SPDY_PROXY_AUTH_VALUE; | |
186 #endif | |
187 return ""; | |
bengr
2014/10/10 23:36:47
return std::string()
Not at Google. Contact bengr
2014/10/11 00:00:24
Done.
| |
188 } | |
189 | |
183 private: | 190 private: |
184 // Gets a value for a key. In priority order, this will be the value | 191 // Gets a value for a key. In priority order, this will be the value |
185 // provided via a command-line switch, the value provided via an | 192 // provided via a command-line switch, the value provided via an |
186 // environment variable, or finally a value baked into the build. | 193 // environment variable, or finally a value baked into the build. |
187 // |command_line_switch| may be NULL. | 194 // |command_line_switch| may be NULL. |
188 static std::string CalculateKeyValue(const char* baked_in_value, | 195 static std::string CalculateKeyValue(const char* baked_in_value, |
189 const char* environment_variable_name, | 196 const char* environment_variable_name, |
190 const char* command_line_switch, | 197 const char* command_line_switch, |
191 const std::string& default_if_unset, | 198 const std::string& default_if_unset, |
192 base::Environment* environment, | 199 base::Environment* environment, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 } | 260 } |
254 | 261 |
255 std::string GetOAuth2ClientID(OAuth2Client client) { | 262 std::string GetOAuth2ClientID(OAuth2Client client) { |
256 return g_api_key_cache.Get().GetClientID(client); | 263 return g_api_key_cache.Get().GetClientID(client); |
257 } | 264 } |
258 | 265 |
259 std::string GetOAuth2ClientSecret(OAuth2Client client) { | 266 std::string GetOAuth2ClientSecret(OAuth2Client client) { |
260 return g_api_key_cache.Get().GetClientSecret(client); | 267 return g_api_key_cache.Get().GetClientSecret(client); |
261 } | 268 } |
262 | 269 |
270 std::string GetSpdyProxyAuthValue() { | |
271 return g_api_key_cache.Get().GetSpdyProxyAuthValue(); | |
272 } | |
273 | |
263 bool IsGoogleChromeAPIKeyUsed() { | 274 bool IsGoogleChromeAPIKeyUsed() { |
264 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) | 275 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) |
265 return true; | 276 return true; |
266 #else | 277 #else |
267 return false; | 278 return false; |
268 #endif | 279 #endif |
269 } | 280 } |
270 | 281 |
271 } // namespace google_apis | 282 } // namespace google_apis |
OLD | NEW |