[iOS][LastVisited] Introduce flag for iOS Last Visited in Page Info

The flag will be used in the later CLs.

Bug: 357838447
Change-Id: Idbeacdfbd355539a5ee5602f846ab244d99a2323
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5756473
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Commit-Queue: Cristian Ciacu <cristianciacu@google.com>
Reviewed-by: Filipa Senra <fsenra@google.com>
Cr-Commit-Position: refs/heads/main@{#1338350}
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 5c7dce2..fe2b79ac 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -5408,6 +5408,16 @@
     "expiry_milestone": 130
   },
   {
+    "name": "ios-page-info-last-visited",
+    "owners": [
+      "fsenra@google.com",
+      "cristianciacu@google.com",
+      "chrome-browser-privacy-team@google.com",
+      "bling-flags@google.com"
+    ],
+    "expiry_milestone": 132
+  },
+  {
     "name": "ios-password-bottom-sheet-autofocus",
     "owners": ["sugoi@chromium.org", "tmartino@chromium.org", "bling-integrations-team@google.com"],
     "expiry_milestone": 140
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm
index dcc0bba..682c2f9 100644
--- a/ios/chrome/browser/flags/about_flags.mm
+++ b/ios/chrome/browser/flags/about_flags.mm
@@ -2000,6 +2000,10 @@
     {"autofill-across-iframes", flag_descriptions::kAutofillAcrossIframesName,
      flag_descriptions::kAutofillAcrossIframesDescription, flags_ui::kOsIos,
      FEATURE_VALUE_TYPE(autofill::features::kAutofillAcrossIframesIos)},
+    {"ios-page-info-last-visited",
+     flag_descriptions::kPageInfoLastVisitedIOSName,
+     flag_descriptions::kPageInfoLastVisitedIOSDescription, flags_ui::kOsIos,
+     FEATURE_VALUE_TYPE(kPageInfoLastVisitedIOS)},
 };
 
 bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) {
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
index 96a7340..8dbdc0a 100644
--- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
+++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
@@ -909,6 +909,10 @@
     "Enables the PageImageService fetching images from the Optimization Guide "
     "Salient Images source.";
 
+const char kPageInfoLastVisitedIOSName[] = "Last Visited in Page Info for iOS";
+const char kPageInfoLastVisitedIOSDescription[] =
+    "Shows the Last Visited row in Page Info for iOS.";
+
 const char kPageContentAnnotationsPersistSalientImageMetadataName[] =
     "Page content annotations - Persist salient image metadata";
 const char kPageContentAnnotationsPersistSalientImageMetadataDescription[] =
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
index d16ad3de..014921c 100644
--- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
+++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
@@ -816,6 +816,11 @@
 extern const char kPageImageServiceSalientImageName[];
 extern const char kPageImageServiceSalientImageDescription[];
 
+// Title and description for the flag to enable the Last Visited feature in Page
+// Info for iOS.
+extern const char kPageInfoLastVisitedIOSName[];
+extern const char kPageInfoLastVisitedIOSDescription[];
+
 // Title and description for the flag to enable page visibility.
 extern const char kPageVisibilityPageContentAnnotationsName[];
 extern const char kPageVisibilityPageContentAnnotationsDescription[];
diff --git a/ios/chrome/browser/ui/page_info/features.h b/ios/chrome/browser/ui/page_info/features.h
index 245811d..139ad26a 100644
--- a/ios/chrome/browser/ui/page_info/features.h
+++ b/ios/chrome/browser/ui/page_info/features.h
@@ -10,6 +10,9 @@
 // Feature for the revamp of Page Info in iOS.
 BASE_DECLARE_FEATURE(kRevampPageInfoIos);
 
+// Feature for the implementation of Last Visited in Page Info for iOS.
+BASE_DECLARE_FEATURE(kPageInfoLastVisitedIOS);
+
 // Whether the Revamp Page Info feature is enabled.
 bool IsRevampPageInfoIosEnabled();
 
@@ -17,4 +20,7 @@
 // are supported should fetch the AboutThisSite information and see the UI.
 bool IsAboutThisSiteFeatureEnabled();
 
+// Whether the Last Visited feature in Page Info is enabled.
+bool IsPageInfoLastVisitedIOSEnabled();
+
 #endif  // IOS_CHROME_BROWSER_UI_PAGE_INFO_FEATURES_H_
diff --git a/ios/chrome/browser/ui/page_info/features.mm b/ios/chrome/browser/ui/page_info/features.mm
index 201aa33..03b262b 100644
--- a/ios/chrome/browser/ui/page_info/features.mm
+++ b/ios/chrome/browser/ui/page_info/features.mm
@@ -10,6 +10,10 @@
              "RevampPageInfoIos",
              base::FEATURE_ENABLED_BY_DEFAULT);
 
+BASE_FEATURE(kPageInfoLastVisitedIOS,
+             "kPageInfoLastVisitedIOS",
+             base::FEATURE_DISABLED_BY_DEFAULT);
+
 bool IsRevampPageInfoIosEnabled() {
   return base::FeatureList::IsEnabled(kRevampPageInfoIos);
 }
@@ -19,3 +23,7 @@
          page_info::IsAboutThisSiteFeatureEnabled(
              GetApplicationContext()->GetApplicationLocale());
 }
+
+bool IsPageInfoLastVisitedIOSEnabled() {
+  return base::FeatureList::IsEnabled(kPageInfoLastVisitedIOS);
+}