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

Side by Side Diff: remoting/host/plugin/policy_hack/nat_policy.cc

Issue 8423020: Change linux nat traversal default for Chromoting. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/plugin/policy_hack/nat_policy.h" 8 #include "remoting/host/plugin/policy_hack/nat_policy.h"
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 bool NatPolicy::OnPolicyThread() const { 83 bool NatPolicy::OnPolicyThread() const {
84 return message_loop_proxy_->BelongsToCurrentThread(); 84 return message_loop_proxy_->BelongsToCurrentThread();
85 } 85 }
86 86
87 void NatPolicy::UpdateNatPolicy(base::DictionaryValue* new_policy) { 87 void NatPolicy::UpdateNatPolicy(base::DictionaryValue* new_policy) {
88 DCHECK(OnPolicyThread()); 88 DCHECK(OnPolicyThread());
89 bool new_nat_enabled_state = false; 89 bool new_nat_enabled_state = false;
90 if (!new_policy->HasKey(kNatPolicyName)) { 90 if (!new_policy->HasKey(kNatPolicyName)) {
91 // If unspecified, the default value of this policy is true. 91 // If unspecified, the default value of this policy is true.
92 //
93 // TODO(dmaclach): Currently defaults to false on Linux until
94 // we have policy in place. http://crbug.com/97689
95 #if defined(OS_WIN)
96 new_nat_enabled_state = true; 92 new_nat_enabled_state = true;
97 #elif defined(OS_MACOSX)
98 new_nat_enabled_state = true;
99 #elif defined(OS_LINUX)
100 new_nat_enabled_state = false;
101 #else
102 // Be conservative for now
103 new_nat_enabled_state = false;
104 #endif // defined(OS_WIN)
105 } else { 93 } else {
106 // Otherwise, try to parse the value and only change from false if we get 94 // Otherwise, try to parse the value and only change from false if we get
107 // a successful read. 95 // a successful read.
108 base::Value* value; 96 base::Value* value;
109 if (new_policy->Get(kNatPolicyName, &value) && 97 if (new_policy->Get(kNatPolicyName, &value) &&
110 value->IsType(base::Value::TYPE_BOOLEAN)) { 98 value->IsType(base::Value::TYPE_BOOLEAN)) {
111 CHECK(value->GetAsBoolean(&new_nat_enabled_state)); 99 CHECK(value->GetAsBoolean(&new_nat_enabled_state));
112 } 100 }
113 } 101 }
114 102
115 if (!first_state_published_ || 103 if (!first_state_published_ ||
116 (new_nat_enabled_state != current_nat_enabled_state_)) { 104 (new_nat_enabled_state != current_nat_enabled_state_)) {
117 first_state_published_ = true; 105 first_state_published_ = true;
118 current_nat_enabled_state_ = new_nat_enabled_state; 106 current_nat_enabled_state_ = new_nat_enabled_state;
119 nat_enabled_cb_.Run(current_nat_enabled_state_); 107 nat_enabled_cb_.Run(current_nat_enabled_state_);
120 } 108 }
121 } 109 }
122 110
123 } // namespace policy_hack 111 } // namespace policy_hack
124 } // namespace remoting 112 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698