Movatterモバイル変換


[0]ホーム

URL:


Google Git
Sign in
chromium /chromium /src /refs/heads/main /. /google_apis /api_key_cache.h
blob: 16e071fa22f4c23c02e607f993b9bc01a447b589 [file] [log] [blame] [edit]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GOOGLE_APIS_API_KEY_CACHE_H_
#define GOOGLE_APIS_API_KEY_CACHE_H_
#include<array>
#include<string>
#include"base/feature_list.h"
#include"build/build_config.h"
#include"google_apis/buildflags.h"
#include"google_apis/google_api_keys.h"
namespace google_apis{
structDefaultApiKeys;
// This is used as a lazy instance to determine keys once and cache them.
class COMPONENT_EXPORT(GOOGLE_APIS)ApiKeyCache{
public:
explicitApiKeyCache(constDefaultApiKeys& default_api_keys);
ApiKeyCache(constApiKeyCache&)=delete;
ApiKeyCache&operator=(constApiKeyCache&)=delete;
~ApiKeyCache();
const std::string& api_key()const{return api_key_;}
const std::string& api_key_non_stable()const{return api_key_non_stable_;}
const std::string& api_key_remoting()const{return api_key_remoting_;}
const std::string& api_key_soda()const{return api_key_soda_;}
#if !BUILDFLAG(IS_ANDROID)
const std::string& api_key_hats()const{return api_key_hats_;}
#endif
#if BUILDFLAG(IS_CHROMEOS)
const std::string& api_key_sharing()const{return api_key_sharing_;}
const std::string& api_key_read_aloud()const{return api_key_read_aloud_;}
const std::string& api_key_fresnel()const{return api_key_fresnel_;}
const std::string& api_key_boca()const{return api_key_boca_;}
const std::string& api_key_cros_system_geo()const{
return api_key_cros_system_geo_;
}
const std::string& api_key_cros_chrome_geo()const{
return api_key_cros_chrome_geo_;
}
#endif
const std::string& metrics_key()const{return metrics_key_;}
const std::string&GetClientID(OAuth2Client client)const;
const std::string&GetClientSecret(OAuth2Client client)const;
boolHasAPIKeyConfigured()const;
boolHasOAuthClientConfigured()const;
#if BUILDFLAG(SUPPORT_EXTERNAL_GOOGLE_API_KEY)
void set_api_key(const std::string& api_key){ api_key_= api_key;}
voidSetClientID(OAuth2Client client,const std::string& client_id);
voidSetClientSecret(OAuth2Client client,const std::string& client_secret);
#endif
private:
std::string api_key_;
std::string api_key_non_stable_;
std::string api_key_remoting_;
std::string api_key_soda_;
#if !BUILDFLAG(IS_ANDROID)
std::string api_key_hats_;
#endif
#if BUILDFLAG(IS_CHROMEOS)
std::string api_key_sharing_;
std::string api_key_read_aloud_;
std::string api_key_fresnel_;
std::string api_key_boca_;
std::string api_key_cros_system_geo_;
std::string api_key_cros_chrome_geo_;
#endif
std::string metrics_key_;
std::array<std::string, CLIENT_NUM_ITEMS> client_ids_;
std::array<std::string, CLIENT_NUM_ITEMS> client_secrets_;
};
}// namespace google_apis
#endif// GOOGLE_APIS_API_KEY_CACHE_H_

[8]ページ先頭

©2009-2025 Movatter.jp