| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 const char PolicyWatcher::kHostTokenValidationUrlPolicyName[] = | 98 const char PolicyWatcher::kHostTokenValidationUrlPolicyName[] = |
| 99 "RemoteAccessHostTokenValidationUrl"; | 99 "RemoteAccessHostTokenValidationUrl"; |
| 100 | 100 |
| 101 const char PolicyWatcher::kHostTokenValidationCertIssuerPolicyName[] = | 101 const char PolicyWatcher::kHostTokenValidationCertIssuerPolicyName[] = |
| 102 "RemoteAccessHostTokenValidationCertificateIssuer"; | 102 "RemoteAccessHostTokenValidationCertificateIssuer"; |
| 103 | 103 |
| 104 const char PolicyWatcher::kHostAllowClientPairing[] = | 104 const char PolicyWatcher::kHostAllowClientPairing[] = |
| 105 "RemoteAccessHostAllowClientPairing"; | 105 "RemoteAccessHostAllowClientPairing"; |
| 106 | 106 |
| 107 const char PolicyWatcher::kHostAllowGnubbyAuthPolicyName[] = |
| 108 "RemoteAccessHostAllowGnubbyAuth"; |
| 109 |
| 107 const char PolicyWatcher::kHostDebugOverridePoliciesName[] = | 110 const char PolicyWatcher::kHostDebugOverridePoliciesName[] = |
| 108 "RemoteAccessHostDebugOverridePolicies"; | 111 "RemoteAccessHostDebugOverridePolicies"; |
| 109 | 112 |
| 110 PolicyWatcher::PolicyWatcher( | 113 PolicyWatcher::PolicyWatcher( |
| 111 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 114 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 112 : task_runner_(task_runner), | 115 : task_runner_(task_runner), |
| 113 old_policies_(new base::DictionaryValue()), | 116 old_policies_(new base::DictionaryValue()), |
| 114 default_values_(new base::DictionaryValue()), | 117 default_values_(new base::DictionaryValue()), |
| 115 weak_factory_(this) { | 118 weak_factory_(this) { |
| 116 // Initialize the default values for each policy. | 119 // Initialize the default values for each policy. |
| 117 default_values_->SetBoolean(kNatPolicyName, true); | 120 default_values_->SetBoolean(kNatPolicyName, true); |
| 118 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false); | 121 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false); |
| 119 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false); | 122 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false); |
| 120 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false); | 123 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false); |
| 121 default_values_->SetString(kHostDomainPolicyName, std::string()); | 124 default_values_->SetString(kHostDomainPolicyName, std::string()); |
| 122 default_values_->SetString(kHostTalkGadgetPrefixPolicyName, | 125 default_values_->SetString(kHostTalkGadgetPrefixPolicyName, |
| 123 kDefaultHostTalkGadgetPrefix); | 126 kDefaultHostTalkGadgetPrefix); |
| 124 default_values_->SetString(kHostTokenUrlPolicyName, std::string()); | 127 default_values_->SetString(kHostTokenUrlPolicyName, std::string()); |
| 125 default_values_->SetString(kHostTokenValidationUrlPolicyName, std::string()); | 128 default_values_->SetString(kHostTokenValidationUrlPolicyName, std::string()); |
| 126 default_values_->SetString(kHostTokenValidationCertIssuerPolicyName, | 129 default_values_->SetString(kHostTokenValidationCertIssuerPolicyName, |
| 127 std::string()); | 130 std::string()); |
| 128 default_values_->SetBoolean(kHostAllowClientPairing, true); | 131 default_values_->SetBoolean(kHostAllowClientPairing, true); |
| 132 default_values_->SetBoolean(kHostAllowGnubbyAuthPolicyName, true); |
| 129 #if !defined(NDEBUG) | 133 #if !defined(NDEBUG) |
| 130 default_values_->SetString(kHostDebugOverridePoliciesName, std::string()); | 134 default_values_->SetString(kHostDebugOverridePoliciesName, std::string()); |
| 131 #endif | 135 #endif |
| 132 | 136 |
| 133 // Initialize the fall-back values to use for unreadable policies. | 137 // Initialize the fall-back values to use for unreadable policies. |
| 134 // For most policies these match the defaults. | 138 // For most policies these match the defaults. |
| 135 bad_type_values_.reset(default_values_->DeepCopy()); | 139 bad_type_values_.reset(default_values_->DeepCopy()); |
| 136 bad_type_values_->SetBoolean(kNatPolicyName, false); | 140 bad_type_values_->SetBoolean(kNatPolicyName, false); |
| 137 } | 141 } |
| 138 | 142 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 old_policies_.swap(new_policies); | 219 old_policies_.swap(new_policies); |
| 216 | 220 |
| 217 // Notify our client of the changed policies. | 221 // Notify our client of the changed policies. |
| 218 if (!changed_policies->empty()) { | 222 if (!changed_policies->empty()) { |
| 219 policy_callback_.Run(changed_policies.Pass()); | 223 policy_callback_.Run(changed_policies.Pass()); |
| 220 } | 224 } |
| 221 } | 225 } |
| 222 | 226 |
| 223 } // namespace policy_hack | 227 } // namespace policy_hack |
| 224 } // namespace remoting | 228 } // namespace remoting |
| OLD | NEW |