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