MCPcopy Create free account
hub / github.com/Alex313031/thorium / APIKeyCache

Method APIKeyCache

infra/google_api_keys-inc.cc:142–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140class APIKeyCache {
141 public:
142 APIKeyCache() {
143 std::unique_ptr<base::Environment> environment(base::Environment::Create());
144 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
145 GaiaConfig* gaia_config = GaiaConfig::GetInstance();
146
147 std::string api_key_from_feature =
148 ::google_apis::GetAPIKeyOverrideViaFeature();
149 api_key_ = CalculateKeyValue(GOOGLE_API_KEY,
150 STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY),
151 api_key_from_feature, nullptr, std::string(),
152 environment.get(), command_line, gaia_config);
153 ::google_apis::LogAPIKeysMatchHistogram(api_key_from_feature == api_key_);
154
155// A special non-stable key is at the moment defined only for Android Chrome.
156#if BUILDFLAG(IS_ANDROID)
157 api_key_non_stable_ = CalculateKeyValue(
158 GOOGLE_API_KEY_ANDROID_NON_STABLE,
159 STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_ANDROID_NON_STABLE),
160 std::string(), nullptr, std::string(), environment.get(), command_line,
161 gaia_config);
162#else
163 api_key_non_stable_ = api_key_;
164#endif
165
166 api_key_remoting_ = CalculateKeyValue(
167 GOOGLE_API_KEY_REMOTING,
168 STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_REMOTING), std::string(), nullptr,
169 std::string(), environment.get(), command_line, gaia_config);
170
171 api_key_soda_ = CalculateKeyValue(
172 GOOGLE_API_KEY_SODA, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SODA),
173 std::string(), nullptr, std::string(), environment.get(), command_line,
174 gaia_config);
175#if !BUILDFLAG(IS_ANDROID)
176 api_key_hats_ = CalculateKeyValue(
177 GOOGLE_API_KEY_HATS, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_HATS),
178 std::string(), nullptr, std::string(), environment.get(), command_line,
179 gaia_config);
180#endif
181
182#if BUILDFLAG(IS_CHROMEOS_ASH)
183 api_key_sharing_ = CalculateKeyValue(
184 GOOGLE_API_KEY_SHARING, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SHARING),
185 std::string(), nullptr, std::string(), environment.get(), command_line,
186 gaia_config);
187
188 api_key_read_aloud_ = CalculateKeyValue(
189 GOOGLE_API_KEY_READ_ALOUD,
190 STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_READ_ALOUD), std::string(),
191 nullptr, std::string(), environment.get(), command_line, gaia_config);
192
193 api_key_fresnel_ = CalculateKeyValue(
194 GOOGLE_API_KEY_FRESNEL, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_FRESNEL),
195 std::string(), nullptr, std::string(), environment.get(), command_line,
196 gaia_config);
197#endif
198
199 metrics_key_ = CalculateKeyValue(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected