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

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

Issue 102493002: Use schemas bundled in extensions to convert policies loaded on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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 COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_WIN_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_WIN_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_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"
18 #include "base/win/object_watcher.h" 17 #include "base/win/object_watcher.h"
19 #include "components/policy/core/common/async_policy_loader.h" 18 #include "components/policy/core/common/async_policy_loader.h"
20 #include "components/policy/core/common/policy_types.h" 19 #include "components/policy/core/common/policy_types.h"
21 #include "components/policy/policy_export.h" 20 #include "components/policy/policy_export.h"
22 21
23 namespace base { 22 namespace base {
24 class SequencedTaskRunner; 23 class SequencedTaskRunner;
25 } 24 }
26 25
27 namespace policy { 26 namespace policy {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Creates a policy loader that uses the Win API to access GPO. 59 // Creates a policy loader that uses the Win API to access GPO.
61 static scoped_ptr<PolicyLoaderWin> Create( 60 static scoped_ptr<PolicyLoaderWin> Create(
62 scoped_refptr<base::SequencedTaskRunner> task_runner, 61 scoped_refptr<base::SequencedTaskRunner> task_runner,
63 const string16& chrome_policy_key); 62 const string16& chrome_policy_key);
64 63
65 // AsyncPolicyLoader implementation. 64 // AsyncPolicyLoader implementation.
66 virtual void InitOnBackgroundThread() OVERRIDE; 65 virtual void InitOnBackgroundThread() OVERRIDE;
67 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; 66 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE;
68 67
69 private: 68 private:
70 // Builds the Chrome policy schema in |chrome_policy_schema_|.
71 void BuildChromePolicySchema();
72
73 // Reads Chrome Policy from a PReg file at the given path and stores the 69 // Reads Chrome Policy from a PReg file at the given path and stores the
74 // result in |policy|. 70 // result in |policy|.
75 bool ReadPRegFile(const base::FilePath& preg_file, 71 bool ReadPRegFile(const base::FilePath& preg_file,
76 RegistryDict* policy, 72 RegistryDict* policy,
77 PolicyLoadStatusSample *status); 73 PolicyLoadStatusSample *status);
78 74
79 // Loads and parses GPO policy in |policy_object_list| for scope |scope|. If 75 // Loads and parses GPO policy in |policy_object_list| for scope |scope|. If
80 // successful, stores the result in |policy| and returns true. Returns false 76 // successful, stores the result in |policy| and returns true. Returns false
81 // on failure reading the policy, indicating that policy loading should fall 77 // on failure reading the policy, indicating that policy loading should fall
82 // back to reading the registry. 78 // back to reading the registry.
(...skipping 23 matching lines...) Expand all
106 102
107 // Installs the watchers for the Group Policy update events. 103 // Installs the watchers for the Group Policy update events.
108 void SetupWatches(); 104 void SetupWatches();
109 105
110 // ObjectWatcher::Delegate overrides: 106 // ObjectWatcher::Delegate overrides:
111 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; 107 virtual void OnObjectSignaled(HANDLE object) OVERRIDE;
112 108
113 bool is_initialized_; 109 bool is_initialized_;
114 const string16 chrome_policy_key_; 110 const string16 chrome_policy_key_;
115 class AppliedGPOListProvider* gpo_provider_; 111 class AppliedGPOListProvider* gpo_provider_;
116 base::DictionaryValue chrome_policy_schema_;
117 112
118 base::WaitableEvent user_policy_changed_event_; 113 base::WaitableEvent user_policy_changed_event_;
119 base::WaitableEvent machine_policy_changed_event_; 114 base::WaitableEvent machine_policy_changed_event_;
120 base::win::ObjectWatcher user_policy_watcher_; 115 base::win::ObjectWatcher user_policy_watcher_;
121 base::win::ObjectWatcher machine_policy_watcher_; 116 base::win::ObjectWatcher machine_policy_watcher_;
122 bool user_policy_watcher_failed_; 117 bool user_policy_watcher_failed_;
123 bool machine_policy_watcher_failed_; 118 bool machine_policy_watcher_failed_;
124 119
125 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderWin); 120 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderWin);
126 }; 121 };
127 122
128 } // namespace policy 123 } // namespace policy
129 124
130 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_WIN_H_ 125 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698