[go: up one dir, main page]

[M104][iOS][UserPolicy]🏢 Add enable User Policy flag in chrome://flags

(cherry picked from commit ad6cbe27bb01517ab3d1d7f9244a704c285e2aec)

Bug: 1341567
Change-Id: I70f52eb55238396e94a92c063f62b239261cc3e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3742720
Reviewed-by: Owen Min <zmin@chromium.org>
Commit-Queue: Vincent Boisselle <vincb@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#1020650}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3749073
Cr-Commit-Position: refs/branch-heads/5112@{#645}
Cr-Branched-From: b13d3fe7b3c47a56354ef54b221008afa754412e-refs/heads/main@{#1012729}
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index fda8fabb8..e7a340e 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -2901,6 +2901,11 @@
     "expiry_milestone": 105
   },
   {
+    "name": "enable-user-policy",
+    "owners": [ "vincb" ],
+    "expiry_milestone": 110
+  },
+  {
     "name": "enable-vaapi-av1-decode-acceleration",
     "owners": [ "andrescj", "chromeos-gfx-video@google.com" ],
     "expiry_milestone": 100
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm
index bb14557..a50bb4e 100644
--- a/ios/chrome/browser/flags/about_flags.mm
+++ b/ios/chrome/browser/flags/about_flags.mm
@@ -64,7 +64,7 @@
 #include "ios/chrome/browser/crash_report/features.h"
 #include "ios/chrome/browser/flags/ios_chrome_flag_descriptions.h"
 #import "ios/chrome/browser/ntp/features.h"
-#include "ios/chrome/browser/policy/cloud/user_policy_switch.h"
+#import "ios/chrome/browser/policy/cloud/user_policy_switch.h"
 #include "ios/chrome/browser/policy/policy_util.h"
 #include "ios/chrome/browser/screen_time/screen_time_buildflags.h"
 #import "ios/chrome/browser/sessions/session_features.h"
@@ -974,6 +974,9 @@
     {"dm-token-deletion", flag_descriptions::kDmTokenDeletionName,
      flag_descriptions::kDmTokenDeletionDescription, flags_ui::kOsIos,
      FEATURE_VALUE_TYPE(policy::features::kDmTokenDeletion)},
+    {"enable-user-policy", flag_descriptions::kEnableUserPolicyName,
+     flag_descriptions::kEnableUserPolicyDescription, flags_ui::kOsIos,
+     SINGLE_VALUE_TYPE(policy::kEnableUserPolicy)},
 };
 
 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 c6a41654..0c3ed52a 100644
--- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
+++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
@@ -302,6 +302,11 @@
     "Enable omnibox suggestions scrolling on iPad and disable suggestions "
     "hiding on keyboard dismissal.";
 
+const char kEnableUserPolicyName[] = "Enable user policies";
+const char kEnableUserPolicyDescription[] =
+    "Enable the fetch and application of user policies when synced with a "
+    "managed account";
+
 const char kEnableWebChannelsName[] = "Enable WebFeed";
 const char kEnableWebChannelsDescription[] =
     "Enable folowing content from web and display Following feed on NTP based "
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
index 94c9e3e..7d6ed581 100644
--- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
+++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
@@ -272,6 +272,10 @@
 extern const char kEnableSuggestionsScrollingOnIPadName[];
 extern const char kEnableSuggestionsScrollingOnIPadDescription[];
 
+// Title and description for the flag to enable user policies.
+extern const char kEnableUserPolicyName[];
+extern const char kEnableUserPolicyDescription[];
+
 // Title and description for the flag to introduce following web channels on
 // Chrome iOS.
 extern const char kEnableWebChannelsName[];
diff --git a/ios/chrome/browser/policy/cloud/user_policy_switch.h b/ios/chrome/browser/policy/cloud/user_policy_switch.h
index 5f5e17c1..252940c 100644
--- a/ios/chrome/browser/policy/cloud/user_policy_switch.h
+++ b/ios/chrome/browser/policy/cloud/user_policy_switch.h
@@ -7,6 +7,8 @@
 
 namespace policy {
 
+extern const char kEnableUserPolicy[];
+
 // Enables User Policy with the commandline switch.
 void EnableUserPolicy();
 
diff --git a/ios/chrome/browser/policy/cloud/user_policy_switch.mm b/ios/chrome/browser/policy/cloud/user_policy_switch.mm
index 98ba120..8009afab 100644
--- a/ios/chrome/browser/policy/cloud/user_policy_switch.mm
+++ b/ios/chrome/browser/policy/cloud/user_policy_switch.mm
@@ -10,15 +10,10 @@
 #error "This file requires ARC support."
 #endif
 
-namespace {
-
-// True to enable user policy.
-const char kEnableUserPolicy[] = "enable-user-policy-for-ios";
-
-}  // namespace
-
 namespace policy {
 
+const char kEnableUserPolicy[] = "enable-user-policy-for-ios";
+
 void EnableUserPolicy() {
   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
   command_line->AppendSwitch(kEnableUserPolicy);