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 <userenv.h> | 8 #include <userenv.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "base/win/object_watcher.h" | 15 #include "base/win/object_watcher.h" |
16 #include "chrome/browser/policy/async_policy_loader.h" | 16 #include "chrome/browser/policy/async_policy_loader.h" |
17 #include "chrome/browser/policy/policy_types.h" | 17 #include "chrome/browser/policy/policy_types.h" |
18 | 18 #include "base/files/file_path.h" |
Joao da Silva
2013/04/16 10:46:25
nit: order
Mattias Nissler (ping if slow)
2013/04/16 13:00:05
Done.
| |
19 namespace base { | |
20 class FilePath; | |
21 } | |
22 | 19 |
23 namespace policy { | 20 namespace policy { |
24 | 21 |
25 class AppliedGPOListProvider; | 22 class AppliedGPOListProvider; |
26 class PolicyMap; | 23 class PolicyMap; |
27 struct PolicyDefinitionList; | 24 struct PolicyDefinitionList; |
28 | 25 |
29 // Interface for mocking out GPO enumeration in tests. | 26 // Interface for mocking out GPO enumeration in tests. |
30 class AppliedGPOListProvider { | 27 class AppliedGPOListProvider { |
31 public: | 28 public: |
32 virtual ~AppliedGPOListProvider() {} | 29 virtual ~AppliedGPOListProvider() {} |
33 virtual DWORD GetAppliedGPOList(DWORD flags, | 30 virtual DWORD GetAppliedGPOList(DWORD flags, |
34 LPCTSTR machine_name, | 31 LPCTSTR machine_name, |
35 PSID sid_user, | 32 PSID sid_user, |
36 GUID* extension_guid, | 33 GUID* extension_guid, |
37 PGROUP_POLICY_OBJECT* gpo_list) = 0; | 34 PGROUP_POLICY_OBJECT* gpo_list) = 0; |
38 virtual BOOL FreeGPOList(PGROUP_POLICY_OBJECT gpo_list) = 0; | 35 virtual BOOL FreeGPOList(PGROUP_POLICY_OBJECT gpo_list) = 0; |
39 }; | 36 }; |
40 | 37 |
41 // Loads policies from the Windows registry, and watches for Group Policy | 38 // Loads policies from the Windows registry, and watches for Group Policy |
42 // notifications to trigger reloads. | 39 // notifications to trigger reloads. |
43 class PolicyLoaderWin : public AsyncPolicyLoader, | 40 class PolicyLoaderWin : public AsyncPolicyLoader, |
44 public base::win::ObjectWatcher::Delegate { | 41 public base::win::ObjectWatcher::Delegate { |
45 public: | 42 public: |
43 // The PReg file name used by GPO. | |
44 static const base::FilePath::CharType kPRegFileName[]; | |
45 | |
46 explicit PolicyLoaderWin(const PolicyDefinitionList* policy_list, | 46 explicit PolicyLoaderWin(const PolicyDefinitionList* policy_list, |
47 const string16& chrome_policy_key, | 47 const string16& chrome_policy_key, |
48 AppliedGPOListProvider* gpo_provider); | 48 AppliedGPOListProvider* gpo_provider); |
49 virtual ~PolicyLoaderWin(); | 49 virtual ~PolicyLoaderWin(); |
50 | 50 |
51 // Creates a policy loader that uses the Win API to access GPO. | 51 // Creates a policy loader that uses the Win API to access GPO. |
52 static scoped_ptr<PolicyLoaderWin> Create( | 52 static scoped_ptr<PolicyLoaderWin> Create( |
53 const PolicyDefinitionList* policy_list); | 53 const PolicyDefinitionList* policy_list); |
54 | 54 |
55 // AsyncPolicyLoader implementation. | 55 // AsyncPolicyLoader implementation. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 base::win::ObjectWatcher machine_policy_watcher_; | 108 base::win::ObjectWatcher machine_policy_watcher_; |
109 bool user_policy_watcher_failed_; | 109 bool user_policy_watcher_failed_; |
110 bool machine_policy_watcher_failed_; | 110 bool machine_policy_watcher_failed_; |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderWin); | 112 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderWin); |
113 }; | 113 }; |
114 | 114 |
115 } // namespace policy | 115 } // namespace policy |
116 | 116 |
117 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ | 117 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ |
OLD | NEW |