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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // other components. | 85 // other components. |
86 static std::unique_ptr<PolicyWatcher> CreateFromPolicyLoaderForTesting( | 86 static std::unique_ptr<PolicyWatcher> CreateFromPolicyLoaderForTesting( |
87 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader); | 87 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader); |
88 | 88 |
89 private: | 89 private: |
90 friend class PolicyWatcherTest; | 90 friend class PolicyWatcherTest; |
91 | 91 |
92 // Gets Chromoting schema stored inside |owned_schema_registry_|. | 92 // Gets Chromoting schema stored inside |owned_schema_registry_|. |
93 const policy::Schema* GetPolicySchema() const; | 93 const policy::Schema* GetPolicySchema() const; |
94 | 94 |
95 // Simplifying wrapper around Schema::Normalize. | 95 // Normalizes policies using Schema::Normalize and converts deprecated |
96 // policies. | |
97 // | |
96 // - Returns false if |dict| is invalid (i.e. contains mistyped policy | 98 // - Returns false if |dict| is invalid (i.e. contains mistyped policy |
97 // values). | 99 // values). |
98 // - Returns true if |dict| was valid or got normalized. | 100 // - Returns true if |dict| was valid or got normalized. |
99 bool NormalizePolicies(base::DictionaryValue* dict); | 101 bool NormalizePolicies(base::DictionaryValue* dict); |
100 | 102 |
103 // Converts each deprecated policy to its replacement if and only if the | |
104 // replacement policy is not set, and removes deprecated policied from dict. | |
105 void HandleDeprecatedPolicies(base::DictionaryValue* dict); | |
pastarmovj
2017/04/24 13:06:34
In order to not reinvent the wheel can you try to
rkjnsn
2017/04/24 17:20:47
Unfortunately, I don't believe we can use LegacyPo
| |
106 | |
101 // Stores |new_policies| into |old_policies_|. Returns dictionary with items | 107 // Stores |new_policies| into |old_policies_|. Returns dictionary with items |
102 // from |new_policies| that are different from the old |old_policies_|. | 108 // from |new_policies| that are different from the old |old_policies_|. |
103 std::unique_ptr<base::DictionaryValue> StoreNewAndReturnChangedPolicies( | 109 std::unique_ptr<base::DictionaryValue> StoreNewAndReturnChangedPolicies( |
104 std::unique_ptr<base::DictionaryValue> new_policies); | 110 std::unique_ptr<base::DictionaryValue> new_policies); |
105 | 111 |
106 // Signals policy error to the registered |PolicyErrorCallback|. | 112 // Signals policy error to the registered |PolicyErrorCallback|. |
107 void SignalPolicyError(); | 113 void SignalPolicyError(); |
108 | 114 |
109 // |policy_service_task_runner| is the task runner where it is safe | 115 // |policy_service_task_runner| is the task runner where it is safe |
110 // to call |policy_service_| methods and where we expect to get callbacks | 116 // to call |policy_service_| methods and where we expect to get callbacks |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry_; | 150 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry_; |
145 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_; | 151 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_; |
146 std::unique_ptr<policy::PolicyService> owned_policy_service_; | 152 std::unique_ptr<policy::PolicyService> owned_policy_service_; |
147 | 153 |
148 DISALLOW_COPY_AND_ASSIGN(PolicyWatcher); | 154 DISALLOW_COPY_AND_ASSIGN(PolicyWatcher); |
149 }; | 155 }; |
150 | 156 |
151 } // namespace remoting | 157 } // namespace remoting |
152 | 158 |
153 #endif // REMOTING_HOST_POLICY_WATCHER_H_ | 159 #endif // REMOTING_HOST_POLICY_WATCHER_H_ |
OLD | NEW |