blob: 418df7d3c4a750c1e03131803b2841dc5df97c48 [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/policy/browser_state_policy_connector_factory.h"
#include "base/check.h"
#include "ios/chrome/browser/policy/browser_state_policy_connector.h"
#include "ios/chrome/browser/policy/policy_features.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
std::unique_ptr<BrowserStatePolicyConnector> BuildBrowserStatePolicyConnector(
policy::SchemaRegistry* schema_registry,
BrowserPolicyConnectorIOS* browser_policy_connector) {
DCHECK(IsEnterprisePolicyEnabled());
auto connector = std::make_unique<BrowserStatePolicyConnector>();
// Since extensions are not supported on iOS, the |schema_registry| here has
// the same registered components as the registry owned by
// |browser_policy_connector|, despite being a separate instance. The two
// levels of registry (owned by ApplicationContext vs owned by BrowserState)
// are maintained to keep a parallel structure with Desktop.
connector->Init(schema_registry, browser_policy_connector);
return connector;
}