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 void set_api_key(std::string api_key) { api_key_ = api_key; } | |
Hiroshi Ichikawa
2017/04/13 06:42:55
const std::string&
Same for below.
jzw1
2017/04/14 02:10:32
Done.
Hiroshi Ichikawa
2017/04/14 02:19:44
Looks like this particular one is not fixed yet.
jzw1
2017/04/14 02:28:52
Done.
| |
209 std::string api_key_non_stable() const { return api_key_non_stable_; } | 210 std::string api_key_non_stable() const { return api_key_non_stable_; } |
210 std::string api_key_remoting() const { return api_key_remoting_; } | 211 std::string api_key_remoting() const { return api_key_remoting_; } |
211 | 212 |
212 std::string GetClientID(OAuth2Client client) const { | 213 std::string GetClientID(OAuth2Client client) const { |
213 DCHECK_LT(client, CLIENT_NUM_ITEMS); | 214 DCHECK_LT(client, CLIENT_NUM_ITEMS); |
214 return client_ids_[client]; | 215 return client_ids_[client]; |
215 } | 216 } |
217 void SetClientID(std::string client_id, OAuth2Client client) { | |
218 client_ids_[client] = client_id; | |
219 } | |
216 | 220 |
217 std::string GetClientSecret(OAuth2Client client) const { | 221 std::string GetClientSecret(OAuth2Client client) const { |
218 DCHECK_LT(client, CLIENT_NUM_ITEMS); | 222 DCHECK_LT(client, CLIENT_NUM_ITEMS); |
219 return client_secrets_[client]; | 223 return client_secrets_[client]; |
220 } | 224 } |
225 void SetClientSecret(std::string client_secret, OAuth2Client client) { | |
226 client_secrets_[client] = client_secret; | |
227 } | |
221 | 228 |
222 std::string GetSpdyProxyAuthValue() { | 229 std::string GetSpdyProxyAuthValue() { |
223 #if defined(SPDY_PROXY_AUTH_VALUE) | 230 #if defined(SPDY_PROXY_AUTH_VALUE) |
224 return SPDY_PROXY_AUTH_VALUE; | 231 return SPDY_PROXY_AUTH_VALUE; |
225 #else | 232 #else |
226 return std::string(); | 233 return std::string(); |
227 #endif | 234 #endif |
228 } | 235 } |
229 | 236 |
230 private: | 237 private: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 } | 319 } |
313 | 320 |
314 std::string GetNonStableAPIKey() { | 321 std::string GetNonStableAPIKey() { |
315 return g_api_key_cache.Get().api_key_non_stable(); | 322 return g_api_key_cache.Get().api_key_non_stable(); |
316 } | 323 } |
317 | 324 |
318 std::string GetRemotingAPIKey() { | 325 std::string GetRemotingAPIKey() { |
319 return g_api_key_cache.Get().api_key_remoting(); | 326 return g_api_key_cache.Get().api_key_remoting(); |
320 } | 327 } |
321 | 328 |
329 void SetAPIKey(std::string api_key) { | |
330 #if defined(OS_MACOSX) | |
Hiroshi Ichikawa
2017/04/13 06:42:55
Is this logic MacOS specific? If so, can you make
Eugene But (OOO till 7-30)
2017/04/13 15:06:25
Should this be OS_IOS ?
michaeldo
2017/04/13 19:28:09
Per the comment in the header, the method definiti
jzw1
2017/04/14 02:10:32
I changed to OS_IOS to be more specific
jzw1
2017/04/14 02:10:32
Yep.
jzw1
2017/04/14 02:10:32
Done.
| |
331 g_api_key_cache.Get().set_api_key(api_key); | |
332 #endif | |
333 } | |
334 | |
322 std::string GetOAuth2ClientID(OAuth2Client client) { | 335 std::string GetOAuth2ClientID(OAuth2Client client) { |
323 return g_api_key_cache.Get().GetClientID(client); | 336 return g_api_key_cache.Get().GetClientID(client); |
324 } | 337 } |
325 | 338 |
326 std::string GetOAuth2ClientSecret(OAuth2Client client) { | 339 std::string GetOAuth2ClientSecret(OAuth2Client client) { |
327 return g_api_key_cache.Get().GetClientSecret(client); | 340 return g_api_key_cache.Get().GetClientSecret(client); |
328 } | 341 } |
329 | 342 |
343 void SetClientID(std::string client_id, OAuth2Client client) { | |
344 #if defined(OS_MACOSX) | |
michaeldo
2017/04/13 19:28:09
Same comment as SetAPIKey, entire method for SetCl
jzw1
2017/04/14 02:10:32
Done.
| |
345 g_api_key_cache.Get().SetClientID(client_id, client); | |
346 #endif | |
347 } | |
348 | |
349 void SetClientSecret(std::string client_secret, OAuth2Client client) { | |
350 #if defined(OS_MACOSX) | |
351 g_api_key_cache.Get().SetClientSecret(client_secret, client); | |
352 #endif | |
353 } | |
354 | |
330 std::string GetSpdyProxyAuthValue() { | 355 std::string GetSpdyProxyAuthValue() { |
331 return g_api_key_cache.Get().GetSpdyProxyAuthValue(); | 356 return g_api_key_cache.Get().GetSpdyProxyAuthValue(); |
332 } | 357 } |
333 | 358 |
334 bool IsGoogleChromeAPIKeyUsed() { | 359 bool IsGoogleChromeAPIKeyUsed() { |
335 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) | 360 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) |
336 return true; | 361 return true; |
337 #else | 362 #else |
338 return false; | 363 return false; |
339 #endif | 364 #endif |
340 } | 365 } |
341 | 366 |
342 } // namespace google_apis | 367 } // namespace google_apis |
OLD | NEW |