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

Side by Side Diff: components/policy/core/common/policy_loader_win.h

Issue 109743002: Move policy code into components/policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar fixes Created 7 years 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
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 COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_WIN_H_
6 #define CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_WIN_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <userenv.h> 9 #include <userenv.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "base/win/object_watcher.h" 18 #include "base/win/object_watcher.h"
19 #include "components/policy/core/common/async_policy_loader.h" 19 #include "components/policy/core/common/async_policy_loader.h"
20 #include "components/policy/core/common/policy_types.h" 20 #include "components/policy/core/common/policy_types.h"
21 #include "components/policy/policy_export.h"
21 22
22 namespace base { 23 namespace base {
23 class SequencedTaskRunner; 24 class SequencedTaskRunner;
24 } 25 }
25 26
26 namespace policy { 27 namespace policy {
27 28
28 class AppliedGPOListProvider; 29 class AppliedGPOListProvider;
29 class PolicyLoadStatusSample; 30 class PolicyLoadStatusSample;
30 class PolicyMap; 31 class PolicyMap;
31 class RegistryDict; 32 class RegistryDict;
32 33
33 // Interface for mocking out GPO enumeration in tests. 34 // Interface for mocking out GPO enumeration in tests.
34 class AppliedGPOListProvider { 35 class POLICY_EXPORT AppliedGPOListProvider {
35 public: 36 public:
36 virtual ~AppliedGPOListProvider() {} 37 virtual ~AppliedGPOListProvider() {}
37 virtual DWORD GetAppliedGPOList(DWORD flags, 38 virtual DWORD GetAppliedGPOList(DWORD flags,
38 LPCTSTR machine_name, 39 LPCTSTR machine_name,
39 PSID sid_user, 40 PSID sid_user,
40 GUID* extension_guid, 41 GUID* extension_guid,
41 PGROUP_POLICY_OBJECT* gpo_list) = 0; 42 PGROUP_POLICY_OBJECT* gpo_list) = 0;
42 virtual BOOL FreeGPOList(PGROUP_POLICY_OBJECT gpo_list) = 0; 43 virtual BOOL FreeGPOList(PGROUP_POLICY_OBJECT gpo_list) = 0;
43 }; 44 };
44 45
45 // Loads policies from the Windows registry, and watches for Group Policy 46 // Loads policies from the Windows registry, and watches for Group Policy
46 // notifications to trigger reloads. 47 // notifications to trigger reloads.
47 class PolicyLoaderWin : public AsyncPolicyLoader, 48 class POLICY_EXPORT PolicyLoaderWin
48 public base::win::ObjectWatcher::Delegate { 49 : public AsyncPolicyLoader,
50 public base::win::ObjectWatcher::Delegate {
49 public: 51 public:
50 // The PReg file name used by GPO. 52 // The PReg file name used by GPO.
51 static const base::FilePath::CharType kPRegFileName[]; 53 static const base::FilePath::CharType kPRegFileName[];
52 54
53 PolicyLoaderWin(scoped_refptr<base::SequencedTaskRunner> task_runner, 55 PolicyLoaderWin(scoped_refptr<base::SequencedTaskRunner> task_runner,
54 const string16& chrome_policy_key, 56 const string16& chrome_policy_key,
55 AppliedGPOListProvider* gpo_provider); 57 AppliedGPOListProvider* gpo_provider);
56 virtual ~PolicyLoaderWin(); 58 virtual ~PolicyLoaderWin();
57 59
58 // Creates a policy loader that uses the Win API to access GPO. 60 // Creates a policy loader that uses the Win API to access GPO.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 base::win::ObjectWatcher user_policy_watcher_; 120 base::win::ObjectWatcher user_policy_watcher_;
119 base::win::ObjectWatcher machine_policy_watcher_; 121 base::win::ObjectWatcher machine_policy_watcher_;
120 bool user_policy_watcher_failed_; 122 bool user_policy_watcher_failed_;
121 bool machine_policy_watcher_failed_; 123 bool machine_policy_watcher_failed_;
122 124
123 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderWin); 125 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderWin);
124 }; 126 };
125 127
126 } // namespace policy 128 } // namespace policy
127 129
128 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_WIN_H_ 130 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_WIN_H_
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_loader_mac_unittest.cc ('k') | components/policy/core/common/policy_loader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698