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 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/stringize_macros.h" | 12 #include "base/stringize_macros.h" |
13 | 13 |
14 #if defined(GOOGLE_CHROME_BUILD) | 14 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS) |
15 #include "google_apis/internal/google_chrome_api_keys.h" | 15 #include "google_apis/internal/google_chrome_api_keys.h" |
16 #endif | 16 #endif |
17 | 17 |
| 18 // Used to indicate an unset key/id/secret. This works better with |
| 19 // various unit tests than leaving the token empty. |
| 20 #define DUMMY_API_TOKEN "dummytoken" |
| 21 |
18 #if !defined(GOOGLE_API_KEY) | 22 #if !defined(GOOGLE_API_KEY) |
19 // TODO(joi): Make this blank once it is set via include.gypi. | 23 #define GOOGLE_API_KEY DUMMY_API_TOKEN |
20 #define GOOGLE_API_KEY "abcNOTREALKEYxyz" | |
21 #endif | 24 #endif |
22 | 25 |
23 #if !defined(GOOGLE_CLIENT_ID_MAIN) | 26 #if !defined(GOOGLE_CLIENT_ID_MAIN) |
24 // TODO(joi): Make this blank once it is set via include.gypi. | 27 // TODO(joi): Use DUMMY_API_TOKEN here once folks on chromium-dev have |
| 28 // had a couple of days to update their include.gypi. |
25 #define GOOGLE_CLIENT_ID_MAIN "77185425430.apps.googleusercontent.com" | 29 #define GOOGLE_CLIENT_ID_MAIN "77185425430.apps.googleusercontent.com" |
26 #endif | 30 #endif |
27 | 31 |
28 #if !defined(GOOGLE_CLIENT_SECRET_MAIN) | 32 #if !defined(GOOGLE_CLIENT_SECRET_MAIN) |
29 // TODO(joi): Make this blank once it is set via include.gypi. | 33 // TODO(joi): As above. |
30 #define GOOGLE_CLIENT_SECRET_MAIN "OTJgUOQcT7lO7GsGZq2G4IlT" | 34 #define GOOGLE_CLIENT_SECRET_MAIN "OTJgUOQcT7lO7GsGZq2G4IlT" |
31 #endif | 35 #endif |
32 | 36 |
33 #if !defined(GOOGLE_CLIENT_ID_CLOUD_PRINT) | 37 #if !defined(GOOGLE_CLIENT_ID_CLOUD_PRINT) |
34 // TODO(joi): Make this blank once it is set via include.gypi. | 38 // TODO(joi): As above. |
35 #define GOOGLE_CLIENT_ID_CLOUD_PRINT "551556820943.apps.googleusercontent.com" | 39 #define GOOGLE_CLIENT_ID_CLOUD_PRINT "551556820943.apps.googleusercontent.com" |
36 #endif | 40 #endif |
37 | 41 |
38 #if !defined(GOOGLE_CLIENT_SECRET_CLOUD_PRINT) | 42 #if !defined(GOOGLE_CLIENT_SECRET_CLOUD_PRINT) |
39 // TODO(joi): Make this blank once it is set via include.gypi. | 43 // TODO(joi): As above. |
40 #define GOOGLE_CLIENT_SECRET_CLOUD_PRINT "u3/mp8CgLFxh4uiX1855/MHe" | 44 #define GOOGLE_CLIENT_SECRET_CLOUD_PRINT "u3/mp8CgLFxh4uiX1855/MHe" |
41 #endif | 45 #endif |
42 | 46 |
43 #if !defined(GOOGLE_CLIENT_ID_REMOTING) | 47 #if !defined(GOOGLE_CLIENT_ID_REMOTING) |
44 // TODO(joi): Make this blank once it is set via include.gypi. | 48 // TODO(joi): As above. |
45 #define GOOGLE_CLIENT_ID_REMOTING \ | 49 #define GOOGLE_CLIENT_ID_REMOTING \ |
46 "440925447803-avn2sj1kc099s0r7v62je5s339mu0am1.apps.googleusercontent.com" | 50 "440925447803-avn2sj1kc099s0r7v62je5s339mu0am1.apps.googleusercontent.com" |
47 #endif | 51 #endif |
48 | 52 |
49 #if !defined(GOOGLE_CLIENT_SECRET_REMOTING) | 53 #if !defined(GOOGLE_CLIENT_SECRET_REMOTING) |
50 // TODO(joi): Make this blank once it is set via include.gypi. | 54 // TODO(joi): As above. |
51 #define GOOGLE_CLIENT_SECRET_REMOTING "Bgur6DFiOMM1h8x-AQpuTQlK" | 55 #define GOOGLE_CLIENT_SECRET_REMOTING "Bgur6DFiOMM1h8x-AQpuTQlK" |
52 #endif | 56 #endif |
53 | 57 |
54 // These are used as shortcuts for developers and users providing | 58 // These are used as shortcuts for developers and users providing |
55 // OAuth credentials via preprocessor defines or environment | 59 // OAuth credentials via preprocessor defines or environment |
56 // variables. If set, they will be used to replace any of the client | 60 // variables. If set, they will be used to replace any of the client |
57 // IDs and secrets above that have not been set (and only those; they | 61 // IDs and secrets above that have not been set (and only those; they |
58 // will not override already-set values). | 62 // will not override already-set values). |
59 #if !defined(GOOGLE_DEFAULT_CLIENT_ID) | 63 #if !defined(GOOGLE_DEFAULT_CLIENT_ID) |
60 #define GOOGLE_DEFAULT_CLIENT_ID "" | 64 #define GOOGLE_DEFAULT_CLIENT_ID "" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 229 |
226 std::string GetOAuth2ClientID(OAuth2Client client) { | 230 std::string GetOAuth2ClientID(OAuth2Client client) { |
227 return g_api_key_cache.Get().GetClientID(client); | 231 return g_api_key_cache.Get().GetClientID(client); |
228 } | 232 } |
229 | 233 |
230 std::string GetOAuth2ClientSecret(OAuth2Client client) { | 234 std::string GetOAuth2ClientSecret(OAuth2Client client) { |
231 return g_api_key_cache.Get().GetClientSecret(client); | 235 return g_api_key_cache.Get().GetClientSecret(client); |
232 } | 236 } |
233 | 237 |
234 } // namespace google_apis | 238 } // namespace google_apis |
OLD | NEW |