| OLD | NEW |
| 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 // 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_hack/policy_watcher.h" | 8 #include "remoting/host/policy_hack/policy_watcher.h" |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 const char PolicyWatcher::kHostMatchUsernamePolicyName[] = | 86 const char PolicyWatcher::kHostMatchUsernamePolicyName[] = |
| 87 "RemoteAccessHostMatchUsername"; | 87 "RemoteAccessHostMatchUsername"; |
| 88 | 88 |
| 89 const char PolicyWatcher::kHostTalkGadgetPrefixPolicyName[] = | 89 const char PolicyWatcher::kHostTalkGadgetPrefixPolicyName[] = |
| 90 "RemoteAccessHostTalkGadgetPrefix"; | 90 "RemoteAccessHostTalkGadgetPrefix"; |
| 91 | 91 |
| 92 const char PolicyWatcher::kHostRequireCurtainPolicyName[] = | 92 const char PolicyWatcher::kHostRequireCurtainPolicyName[] = |
| 93 "RemoteAccessHostRequireCurtain"; | 93 "RemoteAccessHostRequireCurtain"; |
| 94 | 94 |
| 95 const char PolicyWatcher::kHostTokenIssueUrlPolicyName[] = |
| 96 "RemoteAccessHostTokenIssueUrl"; |
| 97 |
| 98 const char PolicyWatcher::kHostTokenVerificationUrlPolicyName[] = |
| 99 "RemoteAccessHostTokenVerificationUrl"; |
| 100 |
| 95 const char PolicyWatcher::kHostDebugOverridePoliciesName[] = | 101 const char PolicyWatcher::kHostDebugOverridePoliciesName[] = |
| 96 "RemoteAccessHostDebugOverridePolicies"; | 102 "RemoteAccessHostDebugOverridePolicies"; |
| 97 | 103 |
| 98 PolicyWatcher::PolicyWatcher( | 104 PolicyWatcher::PolicyWatcher( |
| 99 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 105 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 100 : task_runner_(task_runner), | 106 : task_runner_(task_runner), |
| 101 old_policies_(new base::DictionaryValue()), | 107 old_policies_(new base::DictionaryValue()), |
| 102 default_values_(new base::DictionaryValue()), | 108 default_values_(new base::DictionaryValue()), |
| 103 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 109 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 104 // Initialize the default values for each policy. | 110 // Initialize the default values for each policy. |
| 105 default_values_->SetBoolean(kNatPolicyName, true); | 111 default_values_->SetBoolean(kNatPolicyName, true); |
| 106 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false); | 112 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false); |
| 107 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false); | 113 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false); |
| 108 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false); | 114 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false); |
| 109 default_values_->SetString(kHostDomainPolicyName, ""); | 115 default_values_->SetString(kHostDomainPolicyName, ""); |
| 110 default_values_->SetString(kHostTalkGadgetPrefixPolicyName, | 116 default_values_->SetString(kHostTalkGadgetPrefixPolicyName, |
| 111 kDefaultHostTalkGadgetPrefix); | 117 kDefaultHostTalkGadgetPrefix); |
| 118 default_values_->SetString(kHostTokenIssueUrlPolicyName, ""); |
| 119 default_values_->SetString(kHostTokenVerificationUrlPolicyName, ""); |
| 112 #if !defined(NDEBUG) | 120 #if !defined(NDEBUG) |
| 113 default_values_->SetString(kHostDebugOverridePoliciesName, ""); | 121 default_values_->SetString(kHostDebugOverridePoliciesName, ""); |
| 114 #endif | 122 #endif |
| 115 | 123 |
| 116 // Initialize the fall-back values to use for unreadable policies. | 124 // Initialize the fall-back values to use for unreadable policies. |
| 117 // For most policies these match the defaults. | 125 // For most policies these match the defaults. |
| 118 bad_type_values_.reset(default_values_->DeepCopy()); | 126 bad_type_values_.reset(default_values_->DeepCopy()); |
| 119 bad_type_values_->SetBoolean(kNatPolicyName, false); | 127 bad_type_values_->SetBoolean(kNatPolicyName, false); |
| 120 } | 128 } |
| 121 | 129 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 old_policies_.swap(new_policies); | 206 old_policies_.swap(new_policies); |
| 199 | 207 |
| 200 // Notify our client of the changed policies. | 208 // Notify our client of the changed policies. |
| 201 if (!changed_policies->empty()) { | 209 if (!changed_policies->empty()) { |
| 202 policy_callback_.Run(changed_policies.Pass()); | 210 policy_callback_.Run(changed_policies.Pass()); |
| 203 } | 211 } |
| 204 } | 212 } |
| 205 | 213 |
| 206 } // namespace policy_hack | 214 } // namespace policy_hack |
| 207 } // namespace remoting | 215 } // namespace remoting |
| OLD | NEW |