Commit 2d7d300f authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

Updates PolicyConversionsClient to return a SchemaRegistry.

Previously the client interface returned a SchemaRegistryService, but
that class was originally a KeyedService and is intended to be
//chrome-specific.  I was planning to move it to //components and reuse
it on iOS, but now I think it would be better to leave it as a
//chrome-specific implementation and write a separate implementation for
iOS.  The calling code only used the SchemaRegistryService to access its
SchemaRegistry, so PolicyConversionsClient can simply return the
SchemaRegistry directly instead.

BUG=1027249

Change-Id: I8e8a86c96c15cf509993c180aac219f290a7fba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2042191Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738976}
parent ad4ccfc8
......@@ -97,9 +97,12 @@ PolicyService* ChromePolicyConversionsClient::GetPolicyService() const {
return profile_->GetProfilePolicyConnector()->policy_service();
}
SchemaRegistryService*
ChromePolicyConversionsClient::GetPolicySchemaRegistryService() const {
return profile_->GetPolicySchemaRegistryService();
SchemaRegistry* ChromePolicyConversionsClient::GetPolicySchemaRegistry() const {
auto* schema_registry_service = profile_->GetPolicySchemaRegistryService();
if (schema_registry_service) {
return schema_registry_service->registry();
}
return nullptr;
}
const ConfigurationPolicyHandlerList*
......
......@@ -31,7 +31,7 @@ class ChromePolicyConversionsClient : public PolicyConversionsClient {
// PolicyConversionsClient.
PolicyService* GetPolicyService() const override;
SchemaRegistryService* GetPolicySchemaRegistryService() const override;
SchemaRegistry* GetPolicySchemaRegistry() const override;
const ConfigurationPolicyHandlerList* GetHandlerList() const override;
bool HasUserPolicies() const override;
base::Value GetExtensionPolicies(PolicyDomain policy_domain) override;
......
......@@ -10,7 +10,6 @@
#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/policy/schema_registry_service.h"
#include "components/policy/core/browser/configuration_policy_handler_list.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_details.h"
......@@ -71,15 +70,13 @@ base::Value PolicyConversionsClient::GetChromePolicies() {
PolicyService* policy_service = GetPolicyService();
PolicyMap map;
auto* schema_registry_service = GetPolicySchemaRegistryService();
if (!schema_registry_service || !schema_registry_service->registry()) {
LOG(ERROR) << "Cannot dump Chrome policies, no schema registry service";
auto* schema_registry = GetPolicySchemaRegistry();
if (!schema_registry) {
LOG(ERROR) << "Cannot dump Chrome policies, no schema registry";
return Value(Value::Type::DICTIONARY);
}
const scoped_refptr<SchemaMap> schema_map =
schema_registry_service->registry()->schema_map();
const scoped_refptr<SchemaMap> schema_map = schema_registry->schema_map();
PolicyNamespace policy_namespace =
PolicyNamespace(POLICY_DOMAIN_CHROME, std::string());
......
......@@ -20,7 +20,7 @@ class PolicyErrorMap;
class PolicyService;
class Schema;
class SchemaMap;
class SchemaRegistryService;
class SchemaRegistry;
// PolicyConversionsClient supplies embedder-specific information that is needed
// by the PolicyConversions class. It also provides common utilities and
......@@ -82,8 +82,8 @@ class PolicyConversionsClient {
// Returns the embedder's PolicyService.
virtual PolicyService* GetPolicyService() const = 0;
// Returns the embedder's PolicySchemaRegistryService.
virtual SchemaRegistryService* GetPolicySchemaRegistryService() const = 0;
// Returns the embedder's SchemaRegistry.
virtual SchemaRegistry* GetPolicySchemaRegistry() const = 0;
// Returns the embedder's ConfigurationPolicyHandlerList.
virtual const ConfigurationPolicyHandlerList* GetHandlerList() const = 0;
......
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