OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ | 5 #ifndef CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ |
6 #define CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ | 6 #define CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ |
7 | 7 |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | |
8 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "base/values.h" | |
9 #include "base/win/object_watcher.h" | 12 #include "base/win/object_watcher.h" |
10 #include "chrome/browser/policy/async_policy_loader.h" | 13 #include "chrome/browser/policy/async_policy_loader.h" |
14 #include "chrome/browser/policy/policy_types.h" | |
11 | 15 |
12 namespace policy { | 16 namespace policy { |
13 | 17 |
14 struct PolicyDefinitionList; | 18 struct PolicyDefinitionList; |
15 class PolicyMap; | 19 class PolicyMap; |
16 | 20 |
17 // Loads policies from the Windows registry, and watches for Group Policy | 21 // Loads policies from the Windows registry, and watches for Group Policy |
18 // notifications to trigger reloads. | 22 // notifications to trigger reloads. |
19 class PolicyLoaderWin : public AsyncPolicyLoader, | 23 class PolicyLoaderWin : public AsyncPolicyLoader, |
20 public base::win::ObjectWatcher::Delegate { | 24 public base::win::ObjectWatcher::Delegate { |
21 public: | 25 public: |
22 explicit PolicyLoaderWin(const PolicyDefinitionList* policy_list); | 26 explicit PolicyLoaderWin(const PolicyDefinitionList* policy_list); |
23 virtual ~PolicyLoaderWin(); | 27 virtual ~PolicyLoaderWin(); |
24 | 28 |
25 // AsyncPolicyLoader implementation. | 29 // AsyncPolicyLoader implementation. |
26 virtual void InitOnFile() OVERRIDE; | 30 virtual void InitOnFile() OVERRIDE; |
27 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; | 31 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; |
28 | 32 |
29 private: | 33 private: |
30 void LoadChromePolicy(PolicyMap* chrome_policies); | 34 // Parses Chrome policy from |gpo_dict| for the given |scope| and |level| and |
31 void Load3rdPartyPolicies(PolicyBundle* bundle); | 35 // merges it into |chrome_policy_map|. |
36 void LoadChromePolicy(const base::DictionaryValue* gpo_dict, | |
37 PolicyLevel level, | |
38 PolicyScope scope, | |
39 PolicyMap* chrome_policy_map); | |
40 | |
41 // Loads 3rd-party policy from gpo_dict and merges it into |bundle|. | |
Joao da Silva
2013/04/05 13:55:01
nit: |gpo_dict|
Mattias Nissler (ping if slow)
2013/04/09 22:43:38
Done.
| |
42 void Load3rdPartyPolicy(const base::DictionaryValue* gpo_dict, | |
43 PolicyScope scope, | |
44 PolicyBundle* bundle); | |
32 | 45 |
33 // Installs the watchers for the Group Policy update events. | 46 // Installs the watchers for the Group Policy update events. |
34 void SetupWatches(); | 47 void SetupWatches(); |
35 | 48 |
36 // ObjectWatcher::Delegate overrides: | 49 // ObjectWatcher::Delegate overrides: |
37 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; | 50 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; |
38 | 51 |
39 bool is_initialized_; | 52 bool is_initialized_; |
40 const PolicyDefinitionList* policy_list_; | 53 const PolicyDefinitionList* policy_list_; |
54 base::DictionaryValue chrome_policy_schema_; | |
41 | 55 |
42 base::WaitableEvent user_policy_changed_event_; | 56 base::WaitableEvent user_policy_changed_event_; |
43 base::WaitableEvent machine_policy_changed_event_; | 57 base::WaitableEvent machine_policy_changed_event_; |
44 base::win::ObjectWatcher user_policy_watcher_; | 58 base::win::ObjectWatcher user_policy_watcher_; |
45 base::win::ObjectWatcher machine_policy_watcher_; | 59 base::win::ObjectWatcher machine_policy_watcher_; |
46 bool user_policy_watcher_failed_; | 60 bool user_policy_watcher_failed_; |
47 bool machine_policy_watcher_failed_; | 61 bool machine_policy_watcher_failed_; |
48 | 62 |
49 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderWin); | 63 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderWin); |
50 }; | 64 }; |
(...skipping 11 matching lines...) Expand all Loading... | |
62 // policy. | 76 // policy. |
63 extern const wchar_t kRecommended[]; | 77 extern const wchar_t kRecommended[]; |
64 // Registry key within an extension's namespace that contains the policy | 78 // Registry key within an extension's namespace that contains the policy |
65 // schema. | 79 // schema. |
66 extern const wchar_t kSchema[]; | 80 extern const wchar_t kSchema[]; |
67 } // namespace registry_constants | 81 } // namespace registry_constants |
68 | 82 |
69 } // namespace policy | 83 } // namespace policy |
70 | 84 |
71 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ | 85 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ |
OLD | NEW |