1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/policy/schema_registry_service.h" 6 7 #include "base/logging.h" 8 #include "components/policy/core/common/policy_namespace.h" 9 #include "components/policy/core/common/schema.h" 10 11 namespace policy { 12 13 SchemaRegistryService::SchemaRegistryService( 14 const Schema& chrome_schema, 15 CombinedSchemaRegistry* global_registry) 16 : global_registry_(global_registry) { 17 if (chrome_schema.valid()) 18 RegisterComponent(PolicyNamespace(POLICY_DOMAIN_CHROME, ""), chrome_schema); 19 SetReady(POLICY_DOMAIN_CHROME); 20 if (global_registry_) 21 global_registry->Track(this); 22 } 23 24 SchemaRegistryService::~SchemaRegistryService() {} 25 26 void SchemaRegistryService::Shutdown() { 27 if (global_registry_) { 28 global_registry_->Untrack(this); 29 global_registry_ = NULL; 30 } 31 DCHECK(!HasObservers()); 32 } 33 34 } // namespace policy 35