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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 const char PolicyWatcher::kHostRequireCurtainPolicyName[] = | 92 const char PolicyWatcher::kHostRequireCurtainPolicyName[] = |
93 "RemoteAccessHostRequireCurtain"; | 93 "RemoteAccessHostRequireCurtain"; |
94 | 94 |
95 const char PolicyWatcher::kHostTokenUrlPolicyName[] = | 95 const char PolicyWatcher::kHostTokenUrlPolicyName[] = |
96 "RemoteAccessHostTokenUrl"; | 96 "RemoteAccessHostTokenUrl"; |
97 | 97 |
98 const char PolicyWatcher::kHostTokenValidationUrlPolicyName[] = | 98 const char PolicyWatcher::kHostTokenValidationUrlPolicyName[] = |
99 "RemoteAccessHostTokenValidationUrl"; | 99 "RemoteAccessHostTokenValidationUrl"; |
100 | 100 |
| 101 const char PolicyWatcher::kHostAllowClientPairing[] = |
| 102 "RemoteAccessHostAllowClientPairing"; |
| 103 |
101 const char PolicyWatcher::kHostDebugOverridePoliciesName[] = | 104 const char PolicyWatcher::kHostDebugOverridePoliciesName[] = |
102 "RemoteAccessHostDebugOverridePolicies"; | 105 "RemoteAccessHostDebugOverridePolicies"; |
103 | 106 |
104 PolicyWatcher::PolicyWatcher( | 107 PolicyWatcher::PolicyWatcher( |
105 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 108 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
106 : task_runner_(task_runner), | 109 : task_runner_(task_runner), |
107 old_policies_(new base::DictionaryValue()), | 110 old_policies_(new base::DictionaryValue()), |
108 default_values_(new base::DictionaryValue()), | 111 default_values_(new base::DictionaryValue()), |
109 weak_factory_(this) { | 112 weak_factory_(this) { |
110 // Initialize the default values for each policy. | 113 // Initialize the default values for each policy. |
111 default_values_->SetBoolean(kNatPolicyName, true); | 114 default_values_->SetBoolean(kNatPolicyName, true); |
112 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false); | 115 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false); |
113 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false); | 116 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false); |
114 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false); | 117 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false); |
115 default_values_->SetString(kHostDomainPolicyName, std::string()); | 118 default_values_->SetString(kHostDomainPolicyName, std::string()); |
116 default_values_->SetString(kHostTalkGadgetPrefixPolicyName, | 119 default_values_->SetString(kHostTalkGadgetPrefixPolicyName, |
117 kDefaultHostTalkGadgetPrefix); | 120 kDefaultHostTalkGadgetPrefix); |
118 default_values_->SetString(kHostTokenUrlPolicyName, std::string()); | 121 default_values_->SetString(kHostTokenUrlPolicyName, std::string()); |
119 default_values_->SetString(kHostTokenValidationUrlPolicyName, std::string()); | 122 default_values_->SetString(kHostTokenValidationUrlPolicyName, std::string()); |
| 123 default_values_->SetBoolean(kHostAllowClientPairing, true); |
120 #if !defined(NDEBUG) | 124 #if !defined(NDEBUG) |
121 default_values_->SetString(kHostDebugOverridePoliciesName, std::string()); | 125 default_values_->SetString(kHostDebugOverridePoliciesName, std::string()); |
122 #endif | 126 #endif |
123 | 127 |
124 // Initialize the fall-back values to use for unreadable policies. | 128 // Initialize the fall-back values to use for unreadable policies. |
125 // For most policies these match the defaults. | 129 // For most policies these match the defaults. |
126 bad_type_values_.reset(default_values_->DeepCopy()); | 130 bad_type_values_.reset(default_values_->DeepCopy()); |
127 bad_type_values_->SetBoolean(kNatPolicyName, false); | 131 bad_type_values_->SetBoolean(kNatPolicyName, false); |
128 } | 132 } |
129 | 133 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 old_policies_.swap(new_policies); | 210 old_policies_.swap(new_policies); |
207 | 211 |
208 // Notify our client of the changed policies. | 212 // Notify our client of the changed policies. |
209 if (!changed_policies->empty()) { | 213 if (!changed_policies->empty()) { |
210 policy_callback_.Run(changed_policies.Pass()); | 214 policy_callback_.Run(changed_policies.Pass()); |
211 } | 215 } |
212 } | 216 } |
213 | 217 |
214 } // namespace policy_hack | 218 } // namespace policy_hack |
215 } // namespace remoting | 219 } // namespace remoting |
OLD | NEW |