#ifndef CONTENT_BROWSER_WEBID_WEBID_UTILS_H_
#define CONTENT_BROWSER_WEBID_WEBID_UTILS_H_
#include <optional>
#include "content/browser/webid/idp_network_request_manager.h"
#include "content/common/content_export.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace blink::mojom {
enum class FederatedAuthRequestResult;
enum class IdpSigninStatus;
}
namespace content {
class BrowserContext;
enum class FedCmDisconnectStatus;
enum class FedCmIdpSigninStatusMode;
class FederatedIdentityApiPermissionContextDelegate;
class FederatedIdentityPermissionContextDelegate;
enum class IdpSigninStatus;
class FederatedAuthRequestPageData;
namespace webid {
bool IsSameSiteWithAncestors(const url::Origin& origin,
RenderFrameHost* render_frame_host);
void SetIdpSigninStatus(BrowserContext* context,
int frame_tree_node_id,
const url::Origin& origin,
blink::mojom::IdpSigninStatus status);
std::optional<std::string> ComputeConsoleMessageForHttpResponseCode(
const char* endpoint_name,
int http_response_code);
bool IsEndpointSameOrigin(const GURL& identity_provider_config_url,
const GURL& endpoint_url);
bool IsSameSite(const url::Origin& origin1, const url::Origin& origin2);
bool ShouldFailAccountsEndpointRequestBecauseNotSignedInWithIdp(
RenderFrameHost& host,
const GURL& identity_provider_config_url,
FederatedIdentityPermissionContextDelegate* permission_delegate);
void UpdateIdpSigninStatusForAccountsEndpointResponse(
RenderFrameHost& host,
const GURL& identity_provider_config_url,
IdpNetworkRequestManager::FetchStatus account_endpoint_fetch_status,
bool does_idp_have_failing_idp_signin_status,
FederatedIdentityPermissionContextDelegate* permission_delegate);
CONTENT_EXPORT std::string GetConsoleErrorMessageFromResult(
blink::mojom::FederatedAuthRequestResult result);
CONTENT_EXPORT std::string GetDisconnectConsoleErrorMessage(
FedCmDisconnectStatus disconnect_status_for_metrics);
FedCmIdpSigninStatusMode GetIdpSigninStatusMode(RenderFrameHost& host,
const url::Origin& idp_origin);
std::string FormatUrlForDisplay(const GURL& url);
bool HasSharingPermissionOrIdpHasThirdPartyCookiesAccess(
RenderFrameHost& host,
const GURL& provider_url,
const url::Origin& embedder_origin,
const url::Origin& requester_origin,
const std::optional<std::string>& account_id,
FederatedIdentityPermissionContextDelegate* sharing_permission_delegate,
FederatedIdentityApiPermissionContextDelegate* api_permission_delegate);
bool IsFedCmAuthzEnabled(RenderFrameHost& host, const url::Origin& idp_origin);
FederatedAuthRequestPageData* GetPageData(Page& page);
int GetNewSessionID();
}
}
#endif