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 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 client_secrets_[CLIENT_REMOTING_HOST] = CalculateKeyValue( | 199 client_secrets_[CLIENT_REMOTING_HOST] = CalculateKeyValue( |
200 GOOGLE_CLIENT_SECRET_REMOTING_HOST, | 200 GOOGLE_CLIENT_SECRET_REMOTING_HOST, |
201 STRINGIZE_NO_EXPANSION(GOOGLE_CLIENT_SECRET_REMOTING_HOST), | 201 STRINGIZE_NO_EXPANSION(GOOGLE_CLIENT_SECRET_REMOTING_HOST), |
202 NULL, | 202 NULL, |
203 default_client_secret, | 203 default_client_secret, |
204 environment.get(), | 204 environment.get(), |
205 command_line); | 205 command_line); |
206 } | 206 } |
207 | 207 |
208 std::string api_key() const { return api_key_; } | 208 std::string api_key() const { return api_key_; } |
209 #if defined(OS_IOS) | |
210 void set_api_key(std::string api_key) { api_key_ = api_key; } | |
211 #endif | |
209 std::string api_key_non_stable() const { return api_key_non_stable_; } | 212 std::string api_key_non_stable() const { return api_key_non_stable_; } |
210 std::string api_key_remoting() const { return api_key_remoting_; } | 213 std::string api_key_remoting() const { return api_key_remoting_; } |
211 | 214 |
212 std::string GetClientID(OAuth2Client client) const { | 215 std::string GetClientID(OAuth2Client client) const { |
213 DCHECK_LT(client, CLIENT_NUM_ITEMS); | 216 DCHECK_LT(client, CLIENT_NUM_ITEMS); |
214 return client_ids_[client]; | 217 return client_ids_[client]; |
215 } | 218 } |
219 #if defined(OS_IOS) | |
Hiroshi Ichikawa
2017/04/14 02:19:44
Put a blank line before this line.
jzw1
2017/04/14 02:28:52
Done.
| |
220 void SetClientID(OAuth2Client client, const std::string& client_id) { | |
221 client_ids_[client] = client_id; | |
222 } | |
223 #endif | |
216 | 224 |
217 std::string GetClientSecret(OAuth2Client client) const { | 225 std::string GetClientSecret(OAuth2Client client) const { |
218 DCHECK_LT(client, CLIENT_NUM_ITEMS); | 226 DCHECK_LT(client, CLIENT_NUM_ITEMS); |
219 return client_secrets_[client]; | 227 return client_secrets_[client]; |
220 } | 228 } |
229 #if defined(OS_IOS) | |
Hiroshi Ichikawa
2017/04/14 02:19:44
Put a blank line before this line.
jzw1
2017/04/14 02:28:52
Done.
| |
230 void SetClientSecret(OAuth2Client client, const std::string& client_secret) { | |
231 client_secrets_[client] = client_secret; | |
232 } | |
233 #endif | |
221 | 234 |
222 std::string GetSpdyProxyAuthValue() { | 235 std::string GetSpdyProxyAuthValue() { |
223 #if defined(SPDY_PROXY_AUTH_VALUE) | 236 #if defined(SPDY_PROXY_AUTH_VALUE) |
224 return SPDY_PROXY_AUTH_VALUE; | 237 return SPDY_PROXY_AUTH_VALUE; |
225 #else | 238 #else |
226 return std::string(); | 239 return std::string(); |
227 #endif | 240 #endif |
228 } | 241 } |
229 | 242 |
230 private: | 243 private: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 } | 325 } |
313 | 326 |
314 std::string GetNonStableAPIKey() { | 327 std::string GetNonStableAPIKey() { |
315 return g_api_key_cache.Get().api_key_non_stable(); | 328 return g_api_key_cache.Get().api_key_non_stable(); |
316 } | 329 } |
317 | 330 |
318 std::string GetRemotingAPIKey() { | 331 std::string GetRemotingAPIKey() { |
319 return g_api_key_cache.Get().api_key_remoting(); | 332 return g_api_key_cache.Get().api_key_remoting(); |
320 } | 333 } |
321 | 334 |
335 #if defined(OS_IOS) | |
336 void SetAPIKey(const std::string& api_key) { | |
337 g_api_key_cache.Get().set_api_key(api_key); | |
338 } | |
339 #endif | |
340 | |
322 std::string GetOAuth2ClientID(OAuth2Client client) { | 341 std::string GetOAuth2ClientID(OAuth2Client client) { |
323 return g_api_key_cache.Get().GetClientID(client); | 342 return g_api_key_cache.Get().GetClientID(client); |
324 } | 343 } |
325 | 344 |
326 std::string GetOAuth2ClientSecret(OAuth2Client client) { | 345 std::string GetOAuth2ClientSecret(OAuth2Client client) { |
327 return g_api_key_cache.Get().GetClientSecret(client); | 346 return g_api_key_cache.Get().GetClientSecret(client); |
328 } | 347 } |
329 | 348 |
349 #if defined(OS_IOS) | |
350 void SetOAuth2ClientID(OAuth2Client client, const std::string& client_id) { | |
351 g_api_key_cache.Get().SetClientID(client, client_id); | |
352 } | |
353 #endif | |
354 | |
355 #if defined(OS_IOS) | |
356 void SetOAuth2ClientSecret(OAuth2Client client, | |
357 const std::string& client_secret) { | |
358 g_api_key_cache.Get().SetClientSecret(client, client_secret); | |
359 } | |
360 #endif | |
361 | |
330 std::string GetSpdyProxyAuthValue() { | 362 std::string GetSpdyProxyAuthValue() { |
331 return g_api_key_cache.Get().GetSpdyProxyAuthValue(); | 363 return g_api_key_cache.Get().GetSpdyProxyAuthValue(); |
332 } | 364 } |
333 | 365 |
334 bool IsGoogleChromeAPIKeyUsed() { | 366 bool IsGoogleChromeAPIKeyUsed() { |
335 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) | 367 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) |
336 return true; | 368 return true; |
337 #else | 369 #else |
338 return false; | 370 return false; |
339 #endif | 371 #endif |
340 } | 372 } |
341 | 373 |
342 } // namespace google_apis | 374 } // namespace google_apis |
OLD | NEW |