diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 23:36:04 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 23:36:04 +0000 |
commit | 99178111dddd6c8770cc021870f2bca48b218565 (patch) | |
tree | 7bf0089e70dedfb3afbf49b8a0a6762d0ab8cce3 /chrome/browser/policy/config_dir_policy_provider.h | |
parent | 537436d7d0ef6690f31de8854886597dddfa1117 (diff) | |
download | chromium_src-99178111dddd6c8770cc021870f2bca48b218565.zip chromium_src-99178111dddd6c8770cc021870f2bca48b218565.tar.gz chromium_src-99178111dddd6c8770cc021870f2bca48b218565.tar.bz2 |
Move a bunch of chrome/browser/ files into a policy/ subdir.
BUG=50548
TEST=compiles
Review URL: http://codereview.chromium.org/3110002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/policy/config_dir_policy_provider.h')
-rw-r--r-- | chrome/browser/policy/config_dir_policy_provider.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/browser/policy/config_dir_policy_provider.h b/chrome/browser/policy/config_dir_policy_provider.h new file mode 100644 index 0000000..9412ff2 --- /dev/null +++ b/chrome/browser/policy/config_dir_policy_provider.h @@ -0,0 +1,43 @@ +// Copyright (c) 2010 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_CONFIG_DIR_POLICY_PROVIDER_H_ +#define CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/file_path.h" +#include "chrome/browser/policy/configuration_policy_provider.h" + +class DictionaryValue; + +// A policy provider implementation backed by a set of files in a given +// directory. The files should contain JSON-formatted policy settings. They are +// merged together and the result is returned via the +// ConfigurationPolicyProvider interface. The files are consulted in +// lexicographic file name order, so the last value read takes precedence in +// case of preference key collisions. +class ConfigDirPolicyProvider : public ConfigurationPolicyProvider { + public: + explicit ConfigDirPolicyProvider(const FilePath& config_dir); + virtual ~ConfigDirPolicyProvider() { } + + // ConfigurationPolicyProvider implementation. + virtual bool Provide(ConfigurationPolicyStore* store); + + private: + // Read and merge the files from the configuration directory. + DictionaryValue* ReadPolicies(); + + // Decodes the value tree and writes the configuration to the given |store|. + void DecodePolicyValueTree(DictionaryValue* policies, + ConfigurationPolicyStore* store); + + // The directory in which we look for configuration files. + const FilePath config_dir_; + + DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProvider); +}; + +#endif // CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ |