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 // Sets the API key. | |
77 void SetAPIKey(std::string api_key); | |
Hiroshi Ichikawa
2017/04/13 06:42:55
Can you document that this must be called only bef
Hiroshi Ichikawa
2017/04/13 06:42:55
const std::string& would be better. Same for below
jzw1
2017/04/14 02:10:32
Done.
jzw1
2017/04/14 02:10:32
Done.
| |
78 | |
76 // Represents the different sets of client IDs and secrets in use. | 79 // Represents the different sets of client IDs and secrets in use. |
77 enum OAuth2Client { | 80 enum OAuth2Client { |
78 CLIENT_MAIN, // Several different features use this. | 81 CLIENT_MAIN, // Several different features use this. |
79 CLIENT_CLOUD_PRINT, | 82 CLIENT_CLOUD_PRINT, |
80 CLIENT_REMOTING, | 83 CLIENT_REMOTING, |
81 CLIENT_REMOTING_HOST, | 84 CLIENT_REMOTING_HOST, |
82 | 85 |
83 CLIENT_NUM_ITEMS // Must be last item. | 86 CLIENT_NUM_ITEMS // Must be last item. |
84 }; | 87 }; |
85 | 88 |
86 // Retrieves the OAuth2 client ID for the specified client, or the | 89 // Retrieves the OAuth2 client ID for the specified client, or the |
87 // empty string if not set. | 90 // empty string if not set. |
88 // | 91 // |
89 // Note that the ID should be escaped for the context you use it in, | 92 // 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. | 93 // e.g. URL-escaped if you use it in a URL. |
91 std::string GetOAuth2ClientID(OAuth2Client client); | 94 std::string GetOAuth2ClientID(OAuth2Client client); |
92 | 95 |
93 // Retrieves the OAuth2 client secret for the specified client, or the | 96 // Retrieves the OAuth2 client secret for the specified client, or the |
94 // empty string if not set. | 97 // empty string if not set. |
95 // | 98 // |
96 // Note that the secret should be escaped for the context you use it | 99 // 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. | 100 // in, e.g. URL-escaped if you use it in a URL. |
98 std::string GetOAuth2ClientSecret(OAuth2Client client); | 101 std::string GetOAuth2ClientSecret(OAuth2Client client); |
99 | 102 |
103 // Sets the client id for the specified client. | |
104 void SetClientID(std::string client_id, OAuth2Client client); | |
Hiroshi Ichikawa
2017/04/13 06:42:55
SetOAuth2ClientID would be better to be consistent
jzw1
2017/04/14 02:10:32
Done.
| |
105 | |
106 // Sets the client secret for the specified client. | |
107 void SetClientSecret(std::string client_secret, OAuth2Client client); | |
Roger Tawa OOO till Jul 10th
2017/04/13 17:42:43
As discussed over email, let's put all these SetXX
jzw1
2017/04/14 02:10:32
Done.
| |
108 | |
100 // Returns the auth token for the data reduction proxy. | 109 // Returns the auth token for the data reduction proxy. |
101 std::string GetSpdyProxyAuthValue(); | 110 std::string GetSpdyProxyAuthValue(); |
102 | 111 |
103 // Returns if the API key using in the current build is the one for official | 112 // Returns if the API key using in the current build is the one for official |
104 // Google Chrome. | 113 // Google Chrome. |
105 bool IsGoogleChromeAPIKeyUsed(); | 114 bool IsGoogleChromeAPIKeyUsed(); |
106 | 115 |
107 } // namespace google_apis | 116 } // namespace google_apis |
108 | 117 |
109 #endif // GOOGLE_APIS_GOOGLE_API_KEYS_H_ | 118 #endif // GOOGLE_APIS_GOOGLE_API_KEYS_H_ |
OLD | NEW |