#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/webui/identity_internals_ui.h"
#include <memory>
#include <set>
#include <string>
#include "base/functional/bind.h"
#include "base/i18n/time_formatting.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/identity/identity_api.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/identity_internals_resources.h"
#include "chrome/grit/identity_internals_resources_map.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_id.h"
#include "google_apis/gaia/gaia_auth_fetcher.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace {
const int kRevokeTokenExtensionOffset = …;
const int kRevokeTokenTokenOffset = …;
class IdentityInternalsTokenRevoker;
class IdentityInternalsUIMessageHandler : public content::WebUIMessageHandler { … };
class IdentityInternalsTokenRevoker : public GaiaAuthConsumer { … };
IdentityInternalsUIMessageHandler::IdentityInternalsUIMessageHandler() { … }
IdentityInternalsUIMessageHandler::~IdentityInternalsUIMessageHandler() { … }
void IdentityInternalsUIMessageHandler::OnTokenRevokerDone(
IdentityInternalsTokenRevoker* token_revoker,
const std::string& callback_id) { … }
const std::string IdentityInternalsUIMessageHandler::GetExtensionName(
const extensions::IdentityTokenCache::AccessTokensKey& access_tokens_key) { … }
base::Value::List IdentityInternalsUIMessageHandler::GetScopes(
const extensions::IdentityTokenCacheValue& token_cache_value) { … }
std::string IdentityInternalsUIMessageHandler::GetStatus(
const extensions::IdentityTokenCacheValue& token_cache_value) { … }
std::u16string IdentityInternalsUIMessageHandler::GetExpirationTime(
const extensions::IdentityTokenCacheValue& token_cache_value) { … }
base::Value::Dict IdentityInternalsUIMessageHandler::GetInfoForToken(
const extensions::IdentityTokenCache::AccessTokensKey& access_tokens_key,
const extensions::IdentityTokenCacheValue& token_cache_value) { … }
void IdentityInternalsUIMessageHandler::GetInfoForAllTokens(
const base::Value::List& args) { … }
void IdentityInternalsUIMessageHandler::RegisterMessages() { … }
void IdentityInternalsUIMessageHandler::RevokeToken(
const base::Value::List& list) { … }
IdentityInternalsTokenRevoker::IdentityInternalsTokenRevoker(
const std::string& extension_id,
const std::string& access_token,
const std::string& callback_id,
Profile* profile,
IdentityInternalsUIMessageHandler* consumer)
: … { … }
IdentityInternalsTokenRevoker::~IdentityInternalsTokenRevoker() { … }
void IdentityInternalsTokenRevoker::OnOAuth2RevokeTokenCompleted(
GaiaAuthConsumer::TokenRevocationStatus status) { … }
}
IdentityInternalsUI::IdentityInternalsUI(content::WebUI* web_ui)
: … { … }
IdentityInternalsUI::~IdentityInternalsUI() { … }