C++程序  |  40行  |  1.24 KB

// Copyright 2013 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.

#ifndef CHROME_BROWSER_POLICY_SCHEMA_REGISTRY_SERVICE_H_
#define CHROME_BROWSER_POLICY_SCHEMA_REGISTRY_SERVICE_H_

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "components/keyed_service/core/keyed_service.h"

namespace policy {

class CombinedSchemaRegistry;
class Schema;
class SchemaRegistry;

// A KeyedService associated with a Profile that contains a SchemaRegistry.
class SchemaRegistryService : public KeyedService {
 public:
  // This |registry| will initially contain only the |chrome_schema|, if
  // it's valid. The optional |global_registry| must outlive this, and will
  // track |registry|.
  SchemaRegistryService(scoped_ptr<SchemaRegistry> registry,
                        const Schema& chrome_schema,
                        CombinedSchemaRegistry* global_registry);
  virtual ~SchemaRegistryService();

  SchemaRegistry* registry() const { return registry_.get(); }

 private:
  scoped_ptr<SchemaRegistry> registry_;

  DISALLOW_COPY_AND_ASSIGN(SchemaRegistryService);
};

}  // namespace policy

#endif  // CHROME_BROWSER_POLICY_SCHEMA_REGISTRY_SERVICE_H_