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

Side by Side Diff: chrome/browser/policy/config_dir_policy_loader.h

Issue 10443108: Implement the ConfigDirPolicyProvider based on the AsyncPolicyLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit_test win build Created 8 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_LOADER_H_
6 #define CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_LOADER_H_
7 #pragma once
8
9 #include "base/file_path.h"
10 #include "chrome/browser/policy/async_policy_loader.h"
11 #include "chrome/browser/policy/async_policy_provider.h"
Mattias Nissler (ping if slow) 2012/06/04 09:36:36 can be forward-declared AFAICS
Joao da Silva 2012/06/05 09:16:28 Done.
12 #include "chrome/browser/policy/policy_constants.h"
Mattias Nissler (ping if slow) 2012/06/04 09:36:36 forward-declare struct PolicyDefinitionList?
Joao da Silva 2012/06/05 09:16:28 This is for PolicyScope and PolicyLevel.
13
14 namespace base {
15 class Value;
16 }
17
18 namespace policy {
19
20 struct PolicyDefinitionList;
21
22 // A policy loader implementation backed by a set of files in a given
23 // directory. The files should contain JSON-formatted policy settings. They are
24 // merged together and the result is returned in a PolicyBundle.
25 // The files are consulted in lexicographic file name order, so the
26 // last value read takes precedence in case of preference key collisions.
27 class ConfigDirPolicyLoader : public AsyncPolicyLoader {
28 public:
29 ConfigDirPolicyLoader(const FilePath& config_dir, PolicyScope scope);
30 virtual ~ConfigDirPolicyLoader();
31
32 static AsyncPolicyProvider* CreateProvider(
33 const PolicyDefinitionList* policy_list,
34 PolicyScope scope,
35 const FilePath& config_dir);
36
37 // AsyncPolicyLoader implementation.
38 virtual void InitOnFile() OVERRIDE;
39 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE;
40 virtual base::Time LastModificationTime() OVERRIDE;
41
42 private:
43 // Loads the policy files at |path| into the |bundle|, with the given |level|.
44 void LoadFromPath(const FilePath& path,
45 PolicyLevel level,
46 PolicyBundle* bundle);
47
48 // Merges the 3rd party |policies| into the |bundle|, with the given |level|.
49 void Merge3rdPartyPolicy(const base::Value* policies,
50 PolicyLevel level,
51 PolicyBundle* bundle);
52
53 // The directory containing the policy files.
54 FilePath config_dir_;
55
56 // Policies loaded by this provider will have this scope.
57 PolicyScope scope_;
58
59 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyLoader);
60 };
61
62 } // namespace policy
63
64 #endif // CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698