| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/policy/schema_registry_service.h" | 5 #include "chrome/browser/policy/schema_registry_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | |
| 8 #include "components/policy/core/common/policy_namespace.h" | 7 #include "components/policy/core/common/policy_namespace.h" |
| 9 #include "components/policy/core/common/schema.h" | 8 #include "components/policy/core/common/schema.h" |
| 9 #include "components/policy/core/common/schema_registry.h" |
| 10 | 10 |
| 11 namespace policy { | 11 namespace policy { |
| 12 | 12 |
| 13 SchemaRegistryService::SchemaRegistryService( | 13 SchemaRegistryService::SchemaRegistryService( |
| 14 scoped_ptr<SchemaRegistry> registry, |
| 14 const Schema& chrome_schema, | 15 const Schema& chrome_schema, |
| 15 CombinedSchemaRegistry* global_registry) | 16 CombinedSchemaRegistry* global_registry) |
| 16 : global_registry_(global_registry) { | 17 : registry_(registry.Pass()) { |
| 17 if (chrome_schema.valid()) | 18 if (chrome_schema.valid()) { |
| 18 RegisterComponent(PolicyNamespace(POLICY_DOMAIN_CHROME, ""), chrome_schema); | 19 registry_->RegisterComponent(PolicyNamespace(POLICY_DOMAIN_CHROME, ""), |
| 19 SetReady(POLICY_DOMAIN_CHROME); | 20 chrome_schema); |
| 20 if (global_registry_) | 21 } |
| 21 global_registry->Track(this); | 22 registry_->SetReady(POLICY_DOMAIN_CHROME); |
| 23 if (global_registry) |
| 24 global_registry->Track(registry_.get()); |
| 22 } | 25 } |
| 23 | 26 |
| 24 SchemaRegistryService::~SchemaRegistryService() {} | 27 SchemaRegistryService::~SchemaRegistryService() {} |
| 25 | 28 |
| 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 | 29 } // namespace policy |
| OLD | NEW |