OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 REMOTING_HOST_POLICY_WATCHER_H_ | 5 #ifndef REMOTING_HOST_POLICY_WATCHER_H_ |
6 #define REMOTING_HOST_POLICY_WATCHER_H_ | 6 #define REMOTING_HOST_POLICY_WATCHER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // When |policy_service| is specified then |file_task_runner| argument is | 71 // When |policy_service| is specified then |file_task_runner| argument is |
72 // ignored and 1) BrowserThread::UI is used for PolicyUpdatedCallback and | 72 // ignored and 1) BrowserThread::UI is used for PolicyUpdatedCallback and |
73 // PolicyErrorCallback and 2) BrowserThread::FILE is used for reading the | 73 // PolicyErrorCallback and 2) BrowserThread::FILE is used for reading the |
74 // policy from files / registry / preferences (although (2) is just an | 74 // policy from files / registry / preferences (although (2) is just an |
75 // implementation detail and should likely be ignored outside of | 75 // implementation detail and should likely be ignored outside of |
76 // PolicyWatcher). | 76 // PolicyWatcher). |
77 static std::unique_ptr<PolicyWatcher> Create( | 77 static std::unique_ptr<PolicyWatcher> Create( |
78 policy::PolicyService* policy_service, | 78 policy::PolicyService* policy_service, |
79 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner); | 79 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner); |
80 | 80 |
| 81 // Creates a PolicyWatcher from the given loader instead of loading the policy |
| 82 // from the default location. |
| 83 // |
| 84 // This can be used with FakeAsyncPolicyLoader to test policy handling of |
| 85 // other components. |
| 86 static std::unique_ptr<PolicyWatcher> CreateFromPolicyLoaderForTesting( |
| 87 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader); |
| 88 |
81 private: | 89 private: |
82 friend class PolicyWatcherTest; | 90 friend class PolicyWatcherTest; |
83 | 91 |
84 // Gets Chromoting schema stored inside |owned_schema_registry_|. | 92 // Gets Chromoting schema stored inside |owned_schema_registry_|. |
85 const policy::Schema* GetPolicySchema() const; | 93 const policy::Schema* GetPolicySchema() const; |
86 | 94 |
87 // Simplifying wrapper around Schema::Normalize. | 95 // Simplifying wrapper around Schema::Normalize. |
88 // - Returns false if |dict| is invalid (i.e. contains mistyped policy | 96 // - Returns false if |dict| is invalid (i.e. contains mistyped policy |
89 // values). | 97 // values). |
90 // - Returns true if |dict| was valid or got normalized. | 98 // - Returns true if |dict| was valid or got normalized. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry_; | 144 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry_; |
137 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_; | 145 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_; |
138 std::unique_ptr<policy::PolicyService> owned_policy_service_; | 146 std::unique_ptr<policy::PolicyService> owned_policy_service_; |
139 | 147 |
140 DISALLOW_COPY_AND_ASSIGN(PolicyWatcher); | 148 DISALLOW_COPY_AND_ASSIGN(PolicyWatcher); |
141 }; | 149 }; |
142 | 150 |
143 } // namespace remoting | 151 } // namespace remoting |
144 | 152 |
145 #endif // REMOTING_HOST_POLICY_WATCHER_H_ | 153 #endif // REMOTING_HOST_POLICY_WATCHER_H_ |
OLD | NEW |