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

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

Issue 209323002: New policies: enable/disable relay; port range (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #endif // defined(NDEBUG) 70 #endif // defined(NDEBUG)
71 71
72 return to.Pass(); 72 return to.Pass();
73 } 73 }
74 74
75 } // namespace 75 } // namespace
76 76
77 const char PolicyWatcher::kNatPolicyName[] = 77 const char PolicyWatcher::kNatPolicyName[] =
78 "RemoteAccessHostFirewallTraversal"; 78 "RemoteAccessHostFirewallTraversal";
79 79
80 const char PolicyWatcher::kRelayPolicyName[] =
Sergey Ulanov 2014/03/24 23:37:12 The new policies also need to be added in chrome/a
dcaiafa 2014/03/26 15:29:16 Done.
81 "RemoteAccessHostAllowRelayedConnection";
82
83 const char PolicyWatcher::kUdpPortRangePolicyName[] =
84 "RemoteAccessHostUdpPortRange";
85
80 const char PolicyWatcher::kHostRequireTwoFactorPolicyName[] = 86 const char PolicyWatcher::kHostRequireTwoFactorPolicyName[] =
81 "RemoteAccessHostRequireTwoFactor"; 87 "RemoteAccessHostRequireTwoFactor";
82 88
83 const char PolicyWatcher::kHostDomainPolicyName[] = 89 const char PolicyWatcher::kHostDomainPolicyName[] =
84 "RemoteAccessHostDomain"; 90 "RemoteAccessHostDomain";
85 91
86 const char PolicyWatcher::kHostMatchUsernamePolicyName[] = 92 const char PolicyWatcher::kHostMatchUsernamePolicyName[] =
87 "RemoteAccessHostMatchUsername"; 93 "RemoteAccessHostMatchUsername";
88 94
89 const char PolicyWatcher::kHostTalkGadgetPrefixPolicyName[] = 95 const char PolicyWatcher::kHostTalkGadgetPrefixPolicyName[] =
(...skipping 21 matching lines...) Expand all
111 "RemoteAccessHostDebugOverridePolicies"; 117 "RemoteAccessHostDebugOverridePolicies";
112 118
113 PolicyWatcher::PolicyWatcher( 119 PolicyWatcher::PolicyWatcher(
114 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 120 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
115 : task_runner_(task_runner), 121 : task_runner_(task_runner),
116 old_policies_(new base::DictionaryValue()), 122 old_policies_(new base::DictionaryValue()),
117 default_values_(new base::DictionaryValue()), 123 default_values_(new base::DictionaryValue()),
118 weak_factory_(this) { 124 weak_factory_(this) {
119 // Initialize the default values for each policy. 125 // Initialize the default values for each policy.
120 default_values_->SetBoolean(kNatPolicyName, true); 126 default_values_->SetBoolean(kNatPolicyName, true);
127 default_values_->SetBoolean(kRelayPolicyName, true);
128 default_values_->SetString(kUdpPortRangePolicyName, "");
121 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false); 129 default_values_->SetBoolean(kHostRequireTwoFactorPolicyName, false);
122 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false); 130 default_values_->SetBoolean(kHostRequireCurtainPolicyName, false);
123 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false); 131 default_values_->SetBoolean(kHostMatchUsernamePolicyName, false);
124 default_values_->SetString(kHostDomainPolicyName, std::string()); 132 default_values_->SetString(kHostDomainPolicyName, std::string());
125 default_values_->SetString(kHostTalkGadgetPrefixPolicyName, 133 default_values_->SetString(kHostTalkGadgetPrefixPolicyName,
126 kDefaultHostTalkGadgetPrefix); 134 kDefaultHostTalkGadgetPrefix);
127 default_values_->SetString(kHostTokenUrlPolicyName, std::string()); 135 default_values_->SetString(kHostTokenUrlPolicyName, std::string());
128 default_values_->SetString(kHostTokenValidationUrlPolicyName, std::string()); 136 default_values_->SetString(kHostTokenValidationUrlPolicyName, std::string());
129 default_values_->SetString(kHostTokenValidationCertIssuerPolicyName, 137 default_values_->SetString(kHostTokenValidationCertIssuerPolicyName,
130 std::string()); 138 std::string());
131 default_values_->SetBoolean(kHostAllowClientPairing, true); 139 default_values_->SetBoolean(kHostAllowClientPairing, true);
132 default_values_->SetBoolean(kHostAllowGnubbyAuthPolicyName, true); 140 default_values_->SetBoolean(kHostAllowGnubbyAuthPolicyName, true);
133 #if !defined(NDEBUG) 141 #if !defined(NDEBUG)
134 default_values_->SetString(kHostDebugOverridePoliciesName, std::string()); 142 default_values_->SetString(kHostDebugOverridePoliciesName, std::string());
135 #endif 143 #endif
136 144
137 // Initialize the fall-back values to use for unreadable policies. 145 // Initialize the fall-back values to use for unreadable policies.
138 // For most policies these match the defaults. 146 // For most policies these match the defaults.
139 bad_type_values_.reset(default_values_->DeepCopy()); 147 bad_type_values_.reset(default_values_->DeepCopy());
140 bad_type_values_->SetBoolean(kNatPolicyName, false); 148 bad_type_values_->SetBoolean(kNatPolicyName, false);
149 bad_type_values_->SetBoolean(kRelayPolicyName, false);
141 } 150 }
142 151
143 PolicyWatcher::~PolicyWatcher() { 152 PolicyWatcher::~PolicyWatcher() {
144 } 153 }
145 154
146 void PolicyWatcher::StartWatching(const PolicyCallback& policy_callback) { 155 void PolicyWatcher::StartWatching(const PolicyCallback& policy_callback) {
147 if (!OnPolicyWatcherThread()) { 156 if (!OnPolicyWatcherThread()) {
148 task_runner_->PostTask(FROM_HERE, 157 task_runner_->PostTask(FROM_HERE,
149 base::Bind(&PolicyWatcher::StartWatching, 158 base::Bind(&PolicyWatcher::StartWatching,
150 base::Unretained(this), 159 base::Unretained(this),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 old_policies_.swap(new_policies); 228 old_policies_.swap(new_policies);
220 229
221 // Notify our client of the changed policies. 230 // Notify our client of the changed policies.
222 if (!changed_policies->empty()) { 231 if (!changed_policies->empty()) {
223 policy_callback_.Run(changed_policies.Pass()); 232 policy_callback_.Run(changed_policies.Pass());
224 } 233 }
225 } 234 }
226 235
227 } // namespace policy_hack 236 } // namespace policy_hack
228 } // namespace remoting 237 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698