Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Side by Side Diff: trunk/src/remoting/host/policy_hack/policy_watcher.cc

Issue 268483003: Revert 267234 "New policies: enable/disable relay; port range" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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[] = 107 const char PolicyWatcher::kHostAllowGnubbyAuthPolicyName[] =
108 "RemoteAccessHostAllowGnubbyAuth"; 108 "RemoteAccessHostAllowGnubbyAuth";
109 109
110 const char PolicyWatcher::kRelayPolicyName[] =
111 "RemoteAccessHostAllowRelayedConnection";
112
113 const char PolicyWatcher::kUdpPortRangePolicyName[] =
114 "RemoteAccessHostUdpPortRange";
115
116 const char PolicyWatcher::kHostDebugOverridePoliciesName[] = 110 const char PolicyWatcher::kHostDebugOverridePoliciesName[] =
117 "RemoteAccessHostDebugOverridePolicies"; 111 "RemoteAccessHostDebugOverridePolicies";
118 112
119 PolicyWatcher::PolicyWatcher( 113 PolicyWatcher::PolicyWatcher(
120 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 114 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
121 : task_runner_(task_runner), 115 : task_runner_(task_runner),
122 old_policies_(new base::DictionaryValue()), 116 old_policies_(new base::DictionaryValue()),
123 default_values_(new base::DictionaryValue()), 117 default_values_(new base::DictionaryValue()),
124 weak_factory_(this) { 118 weak_factory_(this) {
125 // Initialize the default values for each policy. 119 // Initialize the default values for each policy.
126 default_values_->SetBoolean(kNatPolicyName, true); 120 default_values_->SetBoolean(kNatPolicyName, true);
127 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false); 121 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false);
128 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false); 122 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false);
129 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false); 123 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false);
130 default_values_->SetString(kHostDomainPolicyName, std::string()); 124 default_values_->SetString(kHostDomainPolicyName, std::string());
131 default_values_->SetString(kHostTalkGadgetPrefixPolicyName, 125 default_values_->SetString(kHostTalkGadgetPrefixPolicyName,
132 kDefaultHostTalkGadgetPrefix); 126 kDefaultHostTalkGadgetPrefix);
133 default_values_->SetString(kHostTokenUrlPolicyName, std::string()); 127 default_values_->SetString(kHostTokenUrlPolicyName, std::string());
134 default_values_->SetString(kHostTokenValidationUrlPolicyName, std::string()); 128 default_values_->SetString(kHostTokenValidationUrlPolicyName, std::string());
135 default_values_->SetString(kHostTokenValidationCertIssuerPolicyName, 129 default_values_->SetString(kHostTokenValidationCertIssuerPolicyName,
136 std::string()); 130 std::string());
137 default_values_->SetBoolean(kHostAllowClientPairing, true); 131 default_values_->SetBoolean(kHostAllowClientPairing, true);
138 default_values_->SetBoolean(kHostAllowGnubbyAuthPolicyName, true); 132 default_values_->SetBoolean(kHostAllowGnubbyAuthPolicyName, true);
139 default_values_->SetBoolean(kRelayPolicyName, true);
140 default_values_->SetString(kUdpPortRangePolicyName, "");
141 #if !defined(NDEBUG) 133 #if !defined(NDEBUG)
142 default_values_->SetString(kHostDebugOverridePoliciesName, std::string()); 134 default_values_->SetString(kHostDebugOverridePoliciesName, std::string());
143 #endif 135 #endif
144 136
145 // Initialize the fall-back values to use for unreadable policies. 137 // Initialize the fall-back values to use for unreadable policies.
146 // For most policies these match the defaults. 138 // For most policies these match the defaults.
147 bad_type_values_.reset(default_values_->DeepCopy()); 139 bad_type_values_.reset(default_values_->DeepCopy());
148 bad_type_values_->SetBoolean(kNatPolicyName, false); 140 bad_type_values_->SetBoolean(kNatPolicyName, false);
149 bad_type_values_->SetBoolean(kRelayPolicyName, false);
150 } 141 }
151 142
152 PolicyWatcher::~PolicyWatcher() { 143 PolicyWatcher::~PolicyWatcher() {
153 } 144 }
154 145
155 void PolicyWatcher::StartWatching(const PolicyCallback& policy_callback) { 146 void PolicyWatcher::StartWatching(const PolicyCallback& policy_callback) {
156 if (!OnPolicyWatcherThread()) { 147 if (!OnPolicyWatcherThread()) {
157 task_runner_->PostTask(FROM_HERE, 148 task_runner_->PostTask(FROM_HERE,
158 base::Bind(&PolicyWatcher::StartWatching, 149 base::Bind(&PolicyWatcher::StartWatching,
159 base::Unretained(this), 150 base::Unretained(this),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 old_policies_.swap(new_policies); 219 old_policies_.swap(new_policies);
229 220
230 // Notify our client of the changed policies. 221 // Notify our client of the changed policies.
231 if (!changed_policies->empty()) { 222 if (!changed_policies->empty()) {
232 policy_callback_.Run(changed_policies.Pass()); 223 policy_callback_.Run(changed_policies.Pass());
233 } 224 }
234 } 225 }
235 226
236 } // namespace policy_hack 227 } // namespace policy_hack
237 } // namespace remoting 228 } // namespace remoting
OLDNEW
« no previous file with comments | « trunk/src/remoting/host/policy_hack/policy_watcher.h ('k') | trunk/src/remoting/host/policy_hack/policy_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698