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 // Most of this code is copied from: | 5 // Most of this code is copied from: |
6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc} | 6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc} |
7 | 7 |
8 #include "remoting/host/policy_watcher.h" | 8 #include "remoting/host/policy_watcher.h" |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 // Listen for future policy changes. | 152 // Listen for future policy changes. |
153 policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this); | 153 policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this); |
154 | 154 |
155 // Process current policy state. | 155 // Process current policy state. |
156 if (policy_service_->IsInitializationComplete(policy::POLICY_DOMAIN_CHROME)) { | 156 if (policy_service_->IsInitializationComplete(policy::POLICY_DOMAIN_CHROME)) { |
157 OnPolicyServiceInitialized(policy::POLICY_DOMAIN_CHROME); | 157 OnPolicyServiceInitialized(policy::POLICY_DOMAIN_CHROME); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
| 161 std::unique_ptr<base::DictionaryValue> PolicyWatcher::GetCurrentPolicies() { |
| 162 return old_policies_->CreateDeepCopy(); |
| 163 } |
| 164 |
161 void PolicyWatcher::SignalPolicyError() { | 165 void PolicyWatcher::SignalPolicyError() { |
162 old_policies_->Clear(); | 166 old_policies_->Clear(); |
163 policy_error_callback_.Run(); | 167 policy_error_callback_.Run(); |
164 } | 168 } |
165 | 169 |
166 PolicyWatcher::PolicyWatcher( | 170 PolicyWatcher::PolicyWatcher( |
167 policy::PolicyService* policy_service, | 171 policy::PolicyService* policy_service, |
168 std::unique_ptr<policy::PolicyService> owned_policy_service, | 172 std::unique_ptr<policy::PolicyService> owned_policy_service, |
169 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider, | 173 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider, |
170 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry) | 174 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader)); | 393 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader)); |
390 #endif // !(OS_CHROMEOS) | 394 #endif // !(OS_CHROMEOS) |
391 } | 395 } |
392 | 396 |
393 std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoaderForTesting( | 397 std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoaderForTesting( |
394 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader) { | 398 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader) { |
395 return CreateFromPolicyLoader(std::move(async_policy_loader)); | 399 return CreateFromPolicyLoader(std::move(async_policy_loader)); |
396 } | 400 } |
397 | 401 |
398 } // namespace remoting | 402 } // namespace remoting |
OLD | NEW |