#include "base/location.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
-#include "base/synchronization/waitable_event.h"
#include "base/time/time.h"
#include "base/values.h"
#include "remoting/host/dns_blackhole_checker.h"
const char PolicyWatcher::kHostAllowGnubbyAuthPolicyName[] =
"RemoteAccessHostAllowGnubbyAuth";
+const char PolicyWatcher::kRelayPolicyName[] =
+ "RemoteAccessHostAllowRelayedConnection";
+
+const char PolicyWatcher::kUdpPortRangePolicyName[] =
+ "RemoteAccessHostUdpPortRange";
+
const char PolicyWatcher::kHostDebugOverridePoliciesName[] =
"RemoteAccessHostDebugOverridePolicies";
std::string());
default_values_->SetBoolean(kHostAllowClientPairing, true);
default_values_->SetBoolean(kHostAllowGnubbyAuthPolicyName, true);
+ default_values_->SetBoolean(kRelayPolicyName, true);
+ default_values_->SetString(kUdpPortRangePolicyName, "");
#if !defined(NDEBUG)
default_values_->SetString(kHostDebugOverridePoliciesName, std::string());
#endif
// For most policies these match the defaults.
bad_type_values_.reset(default_values_->DeepCopy());
bad_type_values_->SetBoolean(kNatPolicyName, false);
+ bad_type_values_->SetBoolean(kRelayPolicyName, false);
}
PolicyWatcher::~PolicyWatcher() {
StartWatchingInternal();
}
-void PolicyWatcher::StopWatching(base::WaitableEvent* done) {
- if (!OnPolicyWatcherThread()) {
- task_runner_->PostTask(FROM_HERE,
- base::Bind(&PolicyWatcher::StopWatching,
- base::Unretained(this), done));
- return;
- }
+void PolicyWatcher::StopWatching(const base::Closure& stopped_callback) {
+ task_runner_->PostTaskAndReply(
+ FROM_HERE, base::Bind(&PolicyWatcher::StopWatchingOnPolicyWatcherThread,
+ base::Unretained(this)),
+ stopped_callback);
+}
+void PolicyWatcher::StopWatchingOnPolicyWatcherThread() {
StopWatchingInternal();
weak_factory_.InvalidateWeakPtrs();
policy_callback_.Reset();
-
- done->Signal();
}
void PolicyWatcher::ScheduleFallbackReloadTask() {