[PermissionsAI] Add a feature flag

Bug: 382447738
Change-Id: Ia3d1ca4387d0da5429cfda290353566bc4056e5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6172456
Reviewed-by: Thomas Nguyen <tungnh@chromium.org>
Commit-Queue: Elias Klim <elklm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1406357}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 938ee07..0c50d984 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -11115,6 +11115,10 @@
      flag_descriptions::kPermissionPredictionsV3Description, kOsAll,
      FEATURE_VALUE_TYPE(permissions::features::kPermissionPredictionsV3)},
 
+    {"permissions-ai-v1", flag_descriptions::kPermissionsAIv1Name,
+     flag_descriptions::kPermissionsAIv1Description, kOsDesktop,
+     FEATURE_VALUE_TYPE(permissions::features::kPermissionsAIv1)},
+
 #if BUILDFLAG(IS_CHROMEOS)
     {"exclude-display-in-mirror-mode",
      flag_descriptions::kExcludeDisplayInMirrorModeName,
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index edac764..fa893c5 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -6832,6 +6832,14 @@
     "expiry_milestone": 140
   },
   {
+    "name": "permissions-ai-v1",
+    "owners": [
+      "elklm@chromium.org",
+      "//components/permissions/PERMISSIONS_OWNERS"
+    ],
+    "expiry_milestone": 144
+  },
+  {
     "name": "permissive-usb-passthrough",
     "owners": [
       "drmasquatch@chromium.org"
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 3244e1f..3569566 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -3010,8 +3010,15 @@
 const char kPermissionPredictionsV3Description[] =
     "Use the Permission Predictions Service V3 to surface permission requests "
     "using a quieter UI when the likelihood of the user granting the "
-    "permission is predicted to be low. Requires "
-    "and `Safe Browsing` to be enabled.";
+    "permission is predicted to be low. Requires and `Safe Browsing` to be "
+    "enabled.";
+
+const char kPermissionsAIv1Name[] = "PermissionsAI";
+const char kPermissionsAIv1Description[] =
+    "Use the Permission Predictions Service and Gemini Nano v2 to surface "
+    "permission requests using a quieter UI when the likelihood of the user "
+    "granting the permission is predicted to be low. Requires and `Safe "
+    "Browsing` to be enabled.";
 
 const char kPermissionQuietChipName[] = "Quiet Permission Chip Experiment";
 const char kPermissionQuietChipDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index b3e868ac..df0cb740 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -1737,6 +1737,9 @@
 extern const char kPermissionPredictionsV3Name[];
 extern const char kPermissionPredictionsV3Description[];
 
+extern const char kPermissionsAIv1Name[];
+extern const char kPermissionsAIv1Description[];
+
 extern const char kPermissionQuietChipName[];
 extern const char kPermissionQuietChipDescription[];
 
diff --git a/components/permissions/features.cc b/components/permissions/features.cc
index f4cfbcd..9ea175d 100644
--- a/components/permissions/features.cc
+++ b/components/permissions/features.cc
@@ -49,6 +49,10 @@
              "PermissionPredictionsV3",
              base::FEATURE_ENABLED_BY_DEFAULT);
 
+BASE_FEATURE(kPermissionsAIv1,
+             "PermissionsAIv1",
+             base::FEATURE_DISABLED_BY_DEFAULT);
+
 // Controls whether to trigger showing a HaTS survey, with the given
 // `probability` and `trigger_id`. The `probability` parameter is defined and
 // handled by the HatsService itself. If the parameter
diff --git a/components/permissions/features.h b/components/permissions/features.h
index 9d77982..f982994 100644
--- a/components/permissions/features.h
+++ b/components/permissions/features.h
@@ -40,6 +40,9 @@
 BASE_DECLARE_FEATURE(kPermissionPredictionsV3);
 
 COMPONENT_EXPORT(PERMISSIONS_COMMON)
+BASE_DECLARE_FEATURE(kPermissionsAIv1);
+
+COMPONENT_EXPORT(PERMISSIONS_COMMON)
 BASE_DECLARE_FEATURE(kPermissionsPromptSurvey);
 
 COMPONENT_EXPORT(PERMISSIONS_COMMON)
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 415b2404..25147b0a 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -17320,6 +17320,7 @@
   <int value="-1261972671" label="OmniboxDocumentProvider:disabled"/>
   <int value="-1261263046"
       label="RemoveUsageOfDeprecatedGaiaSigninEndpoint:disabled"/>
+  <int value="-1261165904" label="PermissionsAIv1:enabled"/>
   <int value="-1261110018" label="AllowDisableTouchpadHapticFeedback:disabled"/>
   <int value="-1260211490" label="FastPairLowPower:disabled"/>
   <int value="-1259901957" label="VrBrowserKeyboard:disabled"/>
@@ -22654,6 +22655,7 @@
   <int value="867061581" label="AllowWindowDragUsingSystemDragDrop:enabled"/>
   <int value="867512869" label="mark-non-secure-as"/>
   <int value="868009556" label="AutofillUpstream:enabled"/>
+  <int value="868791094" label="PermissionsAIv1:disabled"/>
   <int value="868879861" label="TpcdMetadataGrants:disabled"/>
   <int value="869531646" label="enable-session-crashed-bubble"/>
   <int value="869770301" label="MessagesForAndroidPasswords:enabled"/>