| 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 "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // Save the new policies. | 138 // Save the new policies. |
| 139 old_policies_.swap(new_policies); | 139 old_policies_.swap(new_policies); |
| 140 | 140 |
| 141 // Notify our client of the changed policies. | 141 // Notify our client of the changed policies. |
| 142 if (!changed_policies->empty()) { | 142 if (!changed_policies->empty()) { |
| 143 policy_updated_callback_.Run(changed_policies.Pass()); | 143 policy_updated_callback_.Run(changed_policies.Pass()); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void PolicyWatcher::SignalPolicyError() { | 147 void PolicyWatcher::SignalPolicyError() { |
| 148 old_policies_->Clear(); |
| 148 policy_error_callback_.Run(); | 149 policy_error_callback_.Run(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 PolicyWatcher::PolicyWatcher( | 152 PolicyWatcher::PolicyWatcher( |
| 152 policy::PolicyService* policy_service, | 153 policy::PolicyService* policy_service, |
| 153 scoped_ptr<policy::PolicyService> owned_policy_service, | 154 scoped_ptr<policy::PolicyService> owned_policy_service, |
| 154 scoped_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider, | 155 scoped_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider, |
| 155 scoped_ptr<policy::SchemaRegistry> owned_schema_registry) | 156 scoped_ptr<policy::SchemaRegistry> owned_schema_registry) |
| 156 : old_policies_(new base::DictionaryValue()), | 157 : old_policies_(new base::DictionaryValue()), |
| 157 default_values_(new base::DictionaryValue()), | 158 default_values_(new base::DictionaryValue()), |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 policy::POLICY_SCOPE_MACHINE)); | 299 policy::POLICY_SCOPE_MACHINE)); |
| 299 #else | 300 #else |
| 300 #error OS that is not yet supported by PolicyWatcher code. | 301 #error OS that is not yet supported by PolicyWatcher code. |
| 301 #endif | 302 #endif |
| 302 | 303 |
| 303 return PolicyWatcher::CreateFromPolicyLoader(policy_loader.Pass()); | 304 return PolicyWatcher::CreateFromPolicyLoader(policy_loader.Pass()); |
| 304 #endif // !(OS_CHROMEOS) | 305 #endif // !(OS_CHROMEOS) |
| 305 } | 306 } |
| 306 | 307 |
| 307 } // namespace remoting | 308 } // namespace remoting |
| OLD | NEW |