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 #ifndef GOOGLE_APIS_GOOGLE_API_KEYS_H_ | 5 #ifndef GOOGLE_APIS_GOOGLE_API_KEYS_H_ |
6 #define GOOGLE_APIS_GOOGLE_API_KEYS_H_ | 6 #define GOOGLE_APIS_GOOGLE_API_KEYS_H_ |
7 | 7 |
8 // If you add more includes to this file, you also need to add them to | 8 // If you add more includes to this file, you also need to add them to |
9 // google_api_keys_unittest.cc. | 9 // google_api_keys_unittest.cc. |
10 #include <string> | 10 #include <string> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 // | 66 // |
67 // Note that the key should be escaped for the context you use it in, | 67 // Note that the key should be escaped for the context you use it in, |
68 // e.g. URL-escaped if you use it in a URL. | 68 // e.g. URL-escaped if you use it in a URL. |
69 std::string GetAPIKey(); | 69 std::string GetAPIKey(); |
70 | 70 |
71 // Non-stable channels may have a different Google API key. | 71 // Non-stable channels may have a different Google API key. |
72 std::string GetNonStableAPIKey(); | 72 std::string GetNonStableAPIKey(); |
73 | 73 |
74 std::string GetRemotingAPIKey(); | 74 std::string GetRemotingAPIKey(); |
75 | 75 |
76 #if defined(OS_IOS) | |
77 // Sets the API key. This should be called as early as possible before this | |
78 // API key is even accessed. Currently only allowed on iOS. | |
michaeldo
2017/04/14 15:25:55
nit: I don't think we need the "Currently only all
jzw1
2017/04/17 01:41:20
Done.
| |
79 void SetAPIKey(const std::string& api_key); | |
80 #endif | |
81 | |
76 // Represents the different sets of client IDs and secrets in use. | 82 // Represents the different sets of client IDs and secrets in use. |
77 enum OAuth2Client { | 83 enum OAuth2Client { |
78 CLIENT_MAIN, // Several different features use this. | 84 CLIENT_MAIN, // Several different features use this. |
79 CLIENT_CLOUD_PRINT, | 85 CLIENT_CLOUD_PRINT, |
80 CLIENT_REMOTING, | 86 CLIENT_REMOTING, |
81 CLIENT_REMOTING_HOST, | 87 CLIENT_REMOTING_HOST, |
82 | 88 |
83 CLIENT_NUM_ITEMS // Must be last item. | 89 CLIENT_NUM_ITEMS // Must be last item. |
84 }; | 90 }; |
85 | 91 |
86 // Retrieves the OAuth2 client ID for the specified client, or the | 92 // Retrieves the OAuth2 client ID for the specified client, or the |
87 // empty string if not set. | 93 // empty string if not set. |
88 // | 94 // |
89 // Note that the ID should be escaped for the context you use it in, | 95 // Note that the ID should be escaped for the context you use it in, |
90 // e.g. URL-escaped if you use it in a URL. | 96 // e.g. URL-escaped if you use it in a URL. |
91 std::string GetOAuth2ClientID(OAuth2Client client); | 97 std::string GetOAuth2ClientID(OAuth2Client client); |
92 | 98 |
93 // Retrieves the OAuth2 client secret for the specified client, or the | 99 // Retrieves the OAuth2 client secret for the specified client, or the |
94 // empty string if not set. | 100 // empty string if not set. |
95 // | 101 // |
96 // Note that the secret should be escaped for the context you use it | 102 // Note that the secret should be escaped for the context you use it |
97 // in, e.g. URL-escaped if you use it in a URL. | 103 // in, e.g. URL-escaped if you use it in a URL. |
98 std::string GetOAuth2ClientSecret(OAuth2Client client); | 104 std::string GetOAuth2ClientSecret(OAuth2Client client); |
99 | 105 |
106 #if defined(OS_IOS) | |
107 // Sets the client id for the specified client. Should be called as early as | |
108 // possible before these ids are accessed. Currently only allowed on iOS. | |
109 void SetOAuth2ClientID(OAuth2Client client, const std::string& client_id); | |
110 #endif | |
111 | |
michaeldo
2017/04/14 15:25:55
nit: Put both of these methods inside a single #if
jzw1
2017/04/17 01:41:20
Done.
| |
112 #if defined(OS_IOS) | |
113 // Sets the client secret for the specified client. Should be called as early as | |
114 // possible before these secrets are accessed. Currently only allowed on iOS. | |
115 void SetOAuth2ClientSecret(OAuth2Client client, | |
116 const std::string& client_secret); | |
117 #endif | |
100 // Returns the auth token for the data reduction proxy. | 118 // Returns the auth token for the data reduction proxy. |
101 std::string GetSpdyProxyAuthValue(); | 119 std::string GetSpdyProxyAuthValue(); |
102 | 120 |
103 // Returns if the API key using in the current build is the one for official | 121 // Returns if the API key using in the current build is the one for official |
104 // Google Chrome. | 122 // Google Chrome. |
105 bool IsGoogleChromeAPIKeyUsed(); | 123 bool IsGoogleChromeAPIKeyUsed(); |
106 | 124 |
107 } // namespace google_apis | 125 } // namespace google_apis |
108 | 126 |
109 #endif // GOOGLE_APIS_GOOGLE_API_KEYS_H_ | 127 #endif // GOOGLE_APIS_GOOGLE_API_KEYS_H_ |
OLD | NEW |