#ifndef CHROME_BROWSER_ACTOR_TOOLS_TOOL_DELEGATE_H_
#define CHROME_BROWSER_ACTOR_TOOLS_TOOL_DELEGATE_H_
#include <optional>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/functional/callback_forward.h"
#include "chrome/browser/actor/site_policy.h"
#include "chrome/common/actor_webui.mojom.h"
#include "components/autofill/core/browser/integrators/glic/actor_form_filling_types.h"
#include "components/password_manager/core/browser/actor_login/actor_login_types.h"
#include "url/gurl.h"
class Profile;
namespace actor_login {
class ActorLoginService;
}
namespace autofill {
class ActorFormFillingService;
}
namespace favicon {
class FaviconService;
}
namespace gfx {
class Image;
}
namespace actor {
class AggregatedJournal;
class ToolDelegate {
public:
virtual ~ToolDelegate() = default;
virtual Profile& GetProfile() = 0;
virtual AggregatedJournal& GetJournal() = 0;
virtual actor_login::ActorLoginService& GetActorLoginService() = 0;
virtual autofill::ActorFormFillingService& GetActorFormFillingService() = 0;
virtual favicon::FaviconService* GetFaviconService() = 0;
virtual void IsAcceptableNavigationDestination(
const GURL& url,
DecisionCallbackWithReason callback) = 0;
using CredentialSelectedCallback = base::OnceCallback<void(
webui::mojom::SelectCredentialDialogResponsePtr response)>;
virtual void PromptToSelectCredential(
const std::vector<actor_login::Credential>& credentials,
const base::flat_map<std::string, gfx::Image>& icons,
CredentialSelectedCallback callback) = 0;
struct CredentialWithPermission {
CredentialWithPermission();
CredentialWithPermission(
const actor_login::Credential& credential,
webui::mojom::UserGrantedPermissionDuration permission_duration);
CredentialWithPermission(const CredentialWithPermission&);
CredentialWithPermission(CredentialWithPermission&&);
CredentialWithPermission& operator=(const CredentialWithPermission&);
CredentialWithPermission& operator=(CredentialWithPermission&&);
~CredentialWithPermission();
actor_login::Credential credential;
webui::mojom::UserGrantedPermissionDuration permission_duration;
};
virtual void SetUserSelectedCredential(
const CredentialWithPermission& credential,
base::OnceClosure affiliations_fetched) = 0;
virtual const std::optional<CredentialWithPermission>
GetUserSelectedCredential(const url::Origin& request_origin) const = 0;
using AutofillSuggestionSelectedCallback = base::OnceCallback<void(
webui::mojom::SelectAutofillSuggestionsDialogResponsePtr)>;
virtual void RequestToShowAutofillSuggestions(
std::vector<autofill::ActorFormFillingRequest> requests,
AutofillSuggestionSelectedCallback callback) = 0;
virtual void InterruptFromTool() = 0;
virtual void UninterruptFromTool() = 0;
};
}
#endif