Commit d319f402 authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Commit Bot

[iOS Enterprise] Add policy map + handler loop for simple policies

Creates the policy map for simple policies (those that simply set a
Chrome flag). Also adds an entry as an example (I arbitrarily picked
kSearchSuggestEnabled), though unit tests will still need to be added
for that policy.

Also creates the simple loop that creates SimplePolicyHandlers for each
policy described in the map.

Change-Id: If35def703d79df367aa69a55cdd13fa27d240337
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2117468Reviewed-by: default avatarsebsg <sebsg@chromium.org>
Reviewed-by: default avatarTina Wang <tinazwang@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Cr-Commit-Position: refs/heads/master@{#753201}
parent ece95756
......@@ -11,13 +11,21 @@
#include "components/policy/core/browser/configuration_policy_handler_parameters.h"
#include "components/policy/policy_constants.h"
#include "ios/chrome/browser/policy/policy_features.h"
#include "ios/chrome/browser/pref_names.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
using policy::PolicyToPreferenceMapEntry;
using policy::SimplePolicyHandler;
namespace {
const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
{policy::key::kSearchSuggestEnabled, prefs::kSearchSuggestEnabled,
base::Value::Type::BOOLEAN}};
void PopulatePolicyHandlerParameters(
policy::PolicyHandlerParameters* parameters) {}
......@@ -30,5 +38,12 @@ std::unique_ptr<policy::ConfigurationPolicyHandlerList> BuildPolicyHandlerList(
std::make_unique<policy::ConfigurationPolicyHandlerList>(
base::Bind(&PopulatePolicyHandlerParameters),
base::Bind(&policy::GetChromePolicyDetails));
for (size_t i = 0; i < base::size(kSimplePolicyMap); ++i) {
handlers->AddHandler(std::make_unique<SimplePolicyHandler>(
kSimplePolicyMap[i].policy_name, kSimplePolicyMap[i].preference_path,
kSimplePolicyMap[i].value_type));
}
return handlers;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment