[M143] Create stub for ActorFormFillingService

Original change's description:
> Create stub for ActorFormFillingService
> 
> This CL introduces the interface that chrome/browser/actor will use
> to communicate with Autofill functionality.
> 
> Skipping CQ due to unrelated failures in a glic-specific bot.
> 
> Bug: 455788947
> Change-Id: I16fe72b7de5c798c56c6d256f250df8bd4966c06
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7095740
> Commit-Queue: Jan Keitel <jkeitel@google.com>
> Reviewed-by: Dominic Battre <battre@chromium.org>
> Reviewed-by: Justin DeWitt <dewittj@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1537889}

(cherry picked from commit 9fbdcf3d8371197286422098502100f1c559999d)

Bug: 458817826,455788947
Change-Id: I16fe72b7de5c798c56c6d256f250df8bd4966c06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7133383
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Chrome Cherry Picker <chrome-cherry-picker@chops-service-accounts.iam.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/7499@{#1078}
Cr-Branched-From: b30439823e5177773584139e72e0593e36863899-refs/heads/main@{#1536371}
diff --git a/chrome/browser/autofill/glic/BUILD.gn b/chrome/browser/autofill/glic/BUILD.gn
new file mode 100644
index 0000000..7d3cf9f
--- /dev/null
+++ b/chrome/browser/autofill/glic/BUILD.gn
@@ -0,0 +1,17 @@
+# Copyright 2025 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+static_library("glic") {
+  sources = [
+    "actor_form_filling_service.h",
+    "actor_form_filling_service_impl.cc",
+    "actor_form_filling_service_impl.h",
+  ]
+  deps = [ "//components/tabs:public" ]
+  public_deps = [
+    "//base",
+    "//components/autofill/core/browser/integrators/glic:actor_form_filling_types",
+    "//components/autofill/core/common",
+  ]
+}
diff --git a/chrome/browser/autofill/glic/actor_form_filling_service.h b/chrome/browser/autofill/glic/actor_form_filling_service.h
new file mode 100644
index 0000000..c407612b
--- /dev/null
+++ b/chrome/browser/autofill/glic/actor_form_filling_service.h
@@ -0,0 +1,53 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_AUTOFILL_GLIC_ACTOR_FORM_FILLING_SERVICE_H_
+#define CHROME_BROWSER_AUTOFILL_GLIC_ACTOR_FORM_FILLING_SERVICE_H_
+
+#include <vector>
+
+#include "base/containers/span.h"
+#include "base/functional/callback_forward.h"
+#include "base/types/expected.h"
+#include "components/autofill/core/browser/integrators/glic/actor_form_filling_types.h"
+#include "components/autofill/core/common/unique_ids.h"
+
+namespace tabs {
+class TabInterface;
+}
+
+namespace autofill {
+
+// Interface for `actor::ExecutionEngine` to communicate with Autofill
+// functionality.
+class ActorFormFillingService {
+ public:
+  virtual ~ActorFormFillingService() = default;
+
+  // Creates a filling proposal for each of the "actor form"s defined in
+  // `fill_requests` and calls callback with it.
+  // Here an "actor form" is the union of one or more sections of a `FormData`
+  // and the section is identified by the `FieldGlobalId` of an arbitrary
+  // field inside that section.
+  using FillRequest = std::pair<ActorFormFillingRequest::RequestedData,
+                                std::vector<FieldGlobalId>>;
+  virtual void GetSuggestions(
+      const tabs::TabInterface& tab,
+      base::span<const FillRequest> fill_requests,
+      base::OnceCallback<
+          void(base::expected<std::vector<ActorFormFillingRequest>,
+                              ActorFormFillingError>)> callback) = 0;
+
+  // Attempts to fill `chosen_suggestions` and notifies `callback` with the
+  // result.
+  virtual void FillSuggestions(
+      const tabs::TabInterface& tab,
+      base::span<const ActorFormFillingSelection> chosen_suggestions,
+      base::OnceCallback<void(base::expected<void, ActorFormFillingError>)>
+          callback) = 0;
+};
+
+}  // namespace autofill
+
+#endif  // CHROME_BROWSER_AUTOFILL_GLIC_ACTOR_FORM_FILLING_SERVICE_H_
diff --git a/chrome/browser/autofill/glic/actor_form_filling_service_impl.cc b/chrome/browser/autofill/glic/actor_form_filling_service_impl.cc
new file mode 100644
index 0000000..20cc4577
--- /dev/null
+++ b/chrome/browser/autofill/glic/actor_form_filling_service_impl.cc
@@ -0,0 +1,28 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/autofill/glic/actor_form_filling_service_impl.h"
+
+#include "base/functional/callback.h"
+#include "base/types/expected.h"
+#include "components/autofill/core/browser/integrators/glic/actor_form_filling_types.h"
+#include "components/tabs/public/tab_interface.h"
+
+namespace autofill {
+
+ActorFormFillingServiceImpl::~ActorFormFillingServiceImpl() = default;
+
+void ActorFormFillingServiceImpl::GetSuggestions(
+    const tabs::TabInterface& tab,
+    base::span<const FillRequest> fill_requests,
+    base::OnceCallback<void(base::expected<std::vector<ActorFormFillingRequest>,
+                                           ActorFormFillingError>)> callback) {}
+
+void ActorFormFillingServiceImpl::FillSuggestions(
+    const tabs::TabInterface& tab,
+    base::span<const ActorFormFillingSelection> chosen_suggestions,
+    base::OnceCallback<void(base::expected<void, ActorFormFillingError>)>
+        callback) {}
+
+}  // namespace autofill
diff --git a/chrome/browser/autofill/glic/actor_form_filling_service_impl.h b/chrome/browser/autofill/glic/actor_form_filling_service_impl.h
new file mode 100644
index 0000000..8e26421
--- /dev/null
+++ b/chrome/browser/autofill/glic/actor_form_filling_service_impl.h
@@ -0,0 +1,41 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_AUTOFILL_GLIC_ACTOR_FORM_FILLING_SERVICE_IMPL_H_
+#define CHROME_BROWSER_AUTOFILL_GLIC_ACTOR_FORM_FILLING_SERVICE_IMPL_H_
+
+#include <vector>
+
+#include "chrome/browser/autofill/glic/actor_form_filling_service.h"
+
+namespace tabs {
+class TabInterface;
+}
+
+namespace autofill {
+
+// Implementation of the Actor -> Autofill interface, which is owned by
+// `actor::ExecutionEngine`. Keeps the state generated by `GetSuggestions()`
+// so that subsequent filling can refer to it by ID.
+class ActorFormFillingServiceImpl : public ActorFormFillingService {
+ public:
+  ~ActorFormFillingServiceImpl() override;
+
+  // ActorFormFillingService:
+  void GetSuggestions(
+      const tabs::TabInterface& tab,
+      base::span<const FillRequest> fill_requests,
+      base::OnceCallback<
+          void(base::expected<std::vector<ActorFormFillingRequest>,
+                              ActorFormFillingError>)> callback) override;
+  void FillSuggestions(
+      const tabs::TabInterface& tab,
+      base::span<const ActorFormFillingSelection> chosen_suggestions,
+      base::OnceCallback<void(base::expected<void, ActorFormFillingError>)>
+          callback) override;
+};
+
+}  // namespace autofill
+
+#endif  // CHROME_BROWSER_AUTOFILL_GLIC_ACTOR_FORM_FILLING_SERVICE_IMPL_H_
diff --git a/chrome/browser/glic/host/glic_page_handler.cc b/chrome/browser/glic/host/glic_page_handler.cc
index fa21435..eb1a23e 100644
--- a/chrome/browser/glic/host/glic_page_handler.cc
+++ b/chrome/browser/glic/host/glic_page_handler.cc
@@ -17,6 +17,7 @@
 #include "base/observer_list_types.h"
 #include "base/scoped_multi_source_observation.h"
 #include "base/scoped_observation.h"
+#include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
@@ -1763,7 +1764,7 @@
           static_cast<int64_t>(request.requested_data);
       for (const auto& suggestion : request.suggestions) {
         auto mojo_suggestion = actor::webui::mojom::AutofillSuggestion::New();
-        mojo_suggestion->id = suggestion.id;
+        mojo_suggestion->id = base::NumberToString(suggestion.id.value());
         mojo_suggestion->title = suggestion.title;
         mojo_suggestion->details = suggestion.details;
         if (suggestion.icon) {
diff --git a/components/autofill/core/browser/integrators/glic/actor_form_filling_types.cc b/components/autofill/core/browser/integrators/glic/actor_form_filling_types.cc
index c2cbb50..41a7edc 100644
--- a/components/autofill/core/browser/integrators/glic/actor_form_filling_types.cc
+++ b/components/autofill/core/browser/integrators/glic/actor_form_filling_types.cc
@@ -9,6 +9,8 @@
 ActorSuggestion::ActorSuggestion() = default;
 ActorSuggestion::ActorSuggestion(const ActorSuggestion&) = default;
 ActorSuggestion& ActorSuggestion::operator=(const ActorSuggestion&) = default;
+ActorSuggestion::ActorSuggestion(ActorSuggestion&&) = default;
+ActorSuggestion& ActorSuggestion::operator=(ActorSuggestion&&) = default;
 ActorSuggestion::~ActorSuggestion() = default;
 
 ActorFormFillingRequest::ActorFormFillingRequest() = default;
@@ -16,6 +18,21 @@
     const ActorFormFillingRequest&) = default;
 ActorFormFillingRequest& ActorFormFillingRequest::operator=(
     const ActorFormFillingRequest&) = default;
+ActorFormFillingRequest::ActorFormFillingRequest(ActorFormFillingRequest&&) =
+    default;
+ActorFormFillingRequest& ActorFormFillingRequest::operator=(
+    ActorFormFillingRequest&&) = default;
 ActorFormFillingRequest::~ActorFormFillingRequest() = default;
 
+ActorFormFillingSelection::ActorFormFillingSelection() = default;
+ActorFormFillingSelection::ActorFormFillingSelection(
+    const ActorFormFillingSelection&) = default;
+ActorFormFillingSelection& ActorFormFillingSelection::operator=(
+    const ActorFormFillingSelection&) = default;
+ActorFormFillingSelection::ActorFormFillingSelection(
+    ActorFormFillingSelection&&) = default;
+ActorFormFillingSelection& ActorFormFillingSelection::operator=(
+    ActorFormFillingSelection&&) = default;
+ActorFormFillingSelection::~ActorFormFillingSelection() = default;
+
 }  // namespace autofill
diff --git a/components/autofill/core/browser/integrators/glic/actor_form_filling_types.h b/components/autofill/core/browser/integrators/glic/actor_form_filling_types.h
index 2556ac71..561b77e2 100644
--- a/components/autofill/core/browser/integrators/glic/actor_form_filling_types.h
+++ b/components/autofill/core/browser/integrators/glic/actor_form_filling_types.h
@@ -9,20 +9,38 @@
 #include <string>
 #include <vector>
 
+#include "base/types/id_type.h"
 #include "components/optimization_guide/proto/features/actions_data.pb.h"
 #include "ui/gfx/image/image.h"
 
 namespace autofill {
 
+// Describes errors that can error either during suggestion generation or
+// during form filling by an actor.
+enum class ActorFormFillingError {
+  // Any other reason that the form could not be filled.
+  kOther,
+  // Autofill is not available on this page.
+  kAutofillNotAvailable,
+  // The form to be filled was not found.
+  kNoForm,
+  // There are no suggestions.
+  kNoSuggestions,
+};
+
+using ActorSuggestionId = base::IdTypeU32<class ActorSuggestionIdMarker>;
+
 // An autofill suggestion for actor form filling.
 struct ActorSuggestion {
   ActorSuggestion();
   ActorSuggestion(const ActorSuggestion&);
   ActorSuggestion& operator=(const ActorSuggestion&);
+  ActorSuggestion(ActorSuggestion&&);
+  ActorSuggestion& operator=(ActorSuggestion&&);
   ~ActorSuggestion();
 
   // A unique identifier for this suggestion.
-  std::string id;
+  ActorSuggestionId id;
   // The title of the suggestion.
   std::string title;
   // The details of the suggestion.
@@ -35,17 +53,35 @@
 // suggestions.
 struct ActorFormFillingRequest {
   ActorFormFillingRequest();
-  ~ActorFormFillingRequest();
   ActorFormFillingRequest(const ActorFormFillingRequest&);
   ActorFormFillingRequest& operator=(const ActorFormFillingRequest&);
   ActorFormFillingRequest(ActorFormFillingRequest&&);
   ActorFormFillingRequest& operator=(ActorFormFillingRequest&&);
+  ~ActorFormFillingRequest();
 
   // See the FormFillingRequest.RequestedData enum in actions_data.proto.
-  optimization_guide::proto::FormFillingRequest_RequestedData requested_data;
+  using RequestedData =
+      optimization_guide::proto::FormFillingRequest_RequestedData;
+  RequestedData requested_data;
   std::vector<ActorSuggestion> suggestions;
 };
 
+// Represents the suggestion that the user selected to be filled.
+struct ActorFormFillingSelection {
+  ActorFormFillingSelection();
+  ActorFormFillingSelection(const ActorFormFillingSelection&);
+  ActorFormFillingSelection& operator=(const ActorFormFillingSelection&);
+  ActorFormFillingSelection(ActorFormFillingSelection&&);
+  ActorFormFillingSelection& operator=(ActorFormFillingSelection&&);
+  ~ActorFormFillingSelection();
+
+  ActorSuggestionId selected_suggestion_id;
+
+  // TODO(crbug.com/455587407): Some credit cards do not have their CVC stored,
+  // in these cases the CVC should be provided when selecting the credit card:
+  // Consider adding an optional string field here for the CVC.
+};
+
 }  // namespace autofill
 
 #endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_INTEGRATORS_GLIC_ACTOR_FORM_FILLING_TYPES_H_