| Index: remoting/host/plugin/host_script_object.cc
|
| diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
|
| index ac8f9af8ae1cbd658f96649972e78224e23d0bc7..4323bdd521af5e7ceee8f3793ee20e11d13db2f2 100644
|
| --- a/remoting/host/plugin/host_script_object.cc
|
| +++ b/remoting/host/plugin/host_script_object.cc
|
| @@ -104,11 +104,11 @@ HostNPScriptObject::~HostNPScriptObject() {
|
| plugin_task_runner_->Detach();
|
|
|
| // Stop listening for policy updates.
|
| - if (nat_policy_.get()) {
|
| - base::WaitableEvent nat_policy_stopped_(true, false);
|
| - nat_policy_->StopWatching(&nat_policy_stopped_);
|
| - nat_policy_stopped_.Wait();
|
| - nat_policy_.reset();
|
| + if (policy_watcher_.get()) {
|
| + base::WaitableEvent policy_watcher_stopped_(true, false);
|
| + policy_watcher_->StopWatching(&policy_watcher_stopped_);
|
| + policy_watcher_stopped_.Wait();
|
| + policy_watcher_.reset();
|
| }
|
|
|
| if (host_context_.get()) {
|
| @@ -144,10 +144,10 @@ bool HostNPScriptObject::Init() {
|
| return false;
|
| }
|
|
|
| - nat_policy_.reset(
|
| - policy_hack::NatPolicy::Create(host_context_->network_task_runner()));
|
| - nat_policy_->StartWatching(
|
| - base::Bind(&HostNPScriptObject::OnNatPolicyUpdate,
|
| + policy_watcher_.reset(
|
| + policy_hack::PolicyWatcher::Create(host_context_->network_task_runner()));
|
| + policy_watcher_->StartWatching(
|
| + base::Bind(&HostNPScriptObject::OnPolicyUpdate,
|
| base::Unretained(this)));
|
| return true;
|
| }
|
| @@ -891,6 +891,23 @@ void HostNPScriptObject::OnShutdownFinished() {
|
| disconnected_event_.Signal();
|
| }
|
|
|
| +void HostNPScriptObject::OnPolicyUpdate(
|
| + scoped_ptr<base::DictionaryValue> policies) {
|
| + if (!host_context_->network_task_runner()->BelongsToCurrentThread()) {
|
| + host_context_->network_task_runner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&HostNPScriptObject::OnPolicyUpdate,
|
| + base::Unretained(this), base::Passed(&policies)));
|
| + return;
|
| + }
|
| +
|
| + bool bool_value;
|
| + if (policies->GetBoolean(policy_hack::PolicyWatcher::kNatPolicyName,
|
| + &bool_value)) {
|
| + OnNatPolicyUpdate(bool_value);
|
| + }
|
| +}
|
| +
|
| void HostNPScriptObject::OnNatPolicyUpdate(bool nat_traversal_enabled) {
|
| if (!host_context_->network_task_runner()->BelongsToCurrentThread()) {
|
| host_context_->network_task_runner()->PostTask(
|
|
|