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" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/strings/stringize_macros.h" | 14 #include "base/strings/stringize_macros.h" |
15 | 15 |
16 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) | 16 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) |
17 #include "google_apis/internal/google_chrome_api_keys.h" | 17 #include "google_apis/internal/google_chrome_api_keys.h" |
18 #endif | 18 #endif |
19 | 19 |
20 // TODO(joi): Can we enable this warning without having it treated as | |
21 // an error? We don't want to fail builds, just warn, but all warnings | |
22 // from the preprocessor are currently treated as errors, at least in | |
23 // Linux builds. | |
24 #if 0 | |
25 #if !defined(GOOGLE_API_KEY) && ( \ | |
26 (!defined(GOOGLE_DEFAULT_CLIENT_ID) && \ | |
27 !defined(GOOGLE_DEFAULT_CLIENT_SECRET)) \ | |
28 || \ | |
29 (!defined(GOOGLE_CLIENT_ID_MAIN) && \ | |
30 !defined(GOOGLE_CLIENT_SECRET_MAIN))) | |
31 #warning You have not specified API keys; some features may not work. | |
32 #warning See www.chromium.org/developers/how-tos/api-keys for details. | |
33 #endif // (API keys unset) | |
34 #endif // 0 | |
35 | |
36 // Used to indicate an unset key/id/secret. This works better with | 20 // Used to indicate an unset key/id/secret. This works better with |
37 // various unit tests than leaving the token empty. | 21 // various unit tests than leaving the token empty. |
38 #define DUMMY_API_TOKEN "dummytoken" | 22 #define DUMMY_API_TOKEN "dummytoken" |
39 | 23 |
40 #if !defined(GOOGLE_API_KEY) | 24 #if !defined(GOOGLE_API_KEY) |
41 #define GOOGLE_API_KEY DUMMY_API_TOKEN | 25 #define GOOGLE_API_KEY DUMMY_API_TOKEN |
42 #endif | 26 #endif |
43 | 27 |
44 #if !defined(GOOGLE_CLIENT_ID_MAIN) | 28 #if !defined(GOOGLE_CLIENT_ID_MAIN) |
45 #define GOOGLE_CLIENT_ID_MAIN DUMMY_API_TOKEN | 29 #define GOOGLE_CLIENT_ID_MAIN DUMMY_API_TOKEN |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 240 |
257 std::string GetOAuth2ClientID(OAuth2Client client) { | 241 std::string GetOAuth2ClientID(OAuth2Client client) { |
258 return g_api_key_cache.Get().GetClientID(client); | 242 return g_api_key_cache.Get().GetClientID(client); |
259 } | 243 } |
260 | 244 |
261 std::string GetOAuth2ClientSecret(OAuth2Client client) { | 245 std::string GetOAuth2ClientSecret(OAuth2Client client) { |
262 return g_api_key_cache.Get().GetClientSecret(client); | 246 return g_api_key_cache.Get().GetClientSecret(client); |
263 } | 247 } |
264 | 248 |
265 } // namespace google_apis | 249 } // namespace google_apis |
OLD | NEW |