Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: chrome/browser/policy/policy_loader_mac.cc

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: fixed win tests Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/policy_loader_mac.cc
diff --git a/chrome/browser/policy/policy_loader_mac.cc b/chrome/browser/policy/policy_loader_mac.cc
index 2d8e220831095362b3ee73635b829dda9e8fe039..b1d1748094dcbeb5ac48cc039d56cc50eb3d7a45 100644
--- a/chrome/browser/policy/policy_loader_mac.cc
+++ b/chrome/browser/policy/policy_loader_mac.cc
@@ -17,10 +17,10 @@
#include "base/values.h"
#include "chrome/browser/policy/external_data_fetcher.h"
#include "chrome/browser/policy/policy_bundle.h"
-#include "chrome/browser/policy/policy_domain_descriptor.h"
#include "chrome/browser/policy/policy_load_status.h"
#include "chrome/browser/policy/policy_map.h"
#include "chrome/browser/policy/preferences_mac.h"
+#include "chrome/browser/policy/schema_map.h"
#include "components/policy/core/common/schema.h"
#include "policy/policy_constants.h"
@@ -84,8 +84,8 @@ scoped_ptr<PolicyBundle> PolicyLoaderMac::Load() {
scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
// Load Chrome's policy.
- // TODO(joaodasilva): use a schema for Chrome once it's generated and
- // available from a PolicyDomainDescriptor.
+ // TODO(joaodasilva): use the Chrome schema instead of the
bartfab (slow) 2013/11/08 13:50:17 Nit: Capitalize start of sentence.
Joao da Silva 2013/11/08 14:18:46 Done.
+ // PolicyDefinitionList.
PolicyMap& chrome_policy =
bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
@@ -116,20 +116,7 @@ scoped_ptr<PolicyBundle> PolicyLoaderMac::Load() {
status.Add(POLICY_LOAD_STATUS_NO_POLICY);
// Load policy for the registered components.
- static const struct {
- PolicyDomain domain;
- const char* domain_name;
- } kSupportedDomains[] = {
- { POLICY_DOMAIN_EXTENSIONS, "extensions" },
- };
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kSupportedDomains); ++i) {
- DescriptorMap::const_iterator it =
- descriptor_map().find(kSupportedDomains[i].domain);
- if (it != descriptor_map().end()) {
- LoadPolicyForDomain(
- it->second, kSupportedDomains[i].domain_name, bundle.get());
- }
- }
+ LoadPolicyForDomain(POLICY_DOMAIN_EXTENSIONS, "extensions", bundle.get());
return bundle.Pass();
}
@@ -189,30 +176,30 @@ base::Value* PolicyLoaderMac::CreateValueFromProperty(
}
void PolicyLoaderMac::LoadPolicyForDomain(
- scoped_refptr<const PolicyDomainDescriptor> descriptor,
+ PolicyDomain domain,
const std::string& domain_name,
PolicyBundle* bundle) {
std::string id_prefix(base::mac::BaseBundleID());
id_prefix.append(".").append(domain_name).append(".");
- for (PolicyDomainDescriptor::SchemaMap::const_iterator it_schema =
- descriptor->components().begin();
- it_schema != descriptor->components().end(); ++it_schema) {
+ const ComponentMap* components = schema_map()->GetComponents(domain);
+ if (!components)
+ return;
+
+ for (ComponentMap::const_iterator it = components->begin();
+ it != components->end(); ++it) {
PolicyMap policy;
- LoadPolicyForComponent(
- id_prefix + it_schema->first, it_schema->second, &policy);
- if (!policy.empty()) {
- bundle->Get(PolicyNamespace(descriptor->domain(), it_schema->first))
- .Swap(&policy);
- }
+ LoadPolicyForComponent(id_prefix + it->first, it->second, &policy);
+ if (!policy.empty())
+ bundle->Get(PolicyNamespace(domain, it->first)).Swap(&policy);
}
}
void PolicyLoaderMac::LoadPolicyForComponent(
const std::string& bundle_id_string,
- Schema schema,
+ const Schema& schema,
PolicyMap* policy) {
- // TODO(joaodasilva): extensions may be registered in a PolicyDomainDescriptor
+ // TODO(joaodasilva): Extensions may be registered in a ComponentMap
// without a schema, to allow a graceful update of the Legacy Browser Support
// extension on Windows. Remove this check once that support is removed.
if (!schema.valid())

Powered by Google App Engine
This is Rietveld 408576698