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

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

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 years, 4 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
« no previous file with comments | « remoting/host/json_host_config.cc ('k') | remoting/host/plugin/policy_hack/nat_policy_linux.cc » ('j') | 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (!new_policy->HasKey(kNatPolicyName)) { 88 if (!new_policy->HasKey(kNatPolicyName)) {
89 // If unspecified, the default value of this policy is true. 89 // If unspecified, the default value of this policy is true.
90 // 90 //
91 // TODO(ajwong): Currently defaults to false until we have policy 91 // TODO(ajwong): Currently defaults to false until we have policy
92 // implemented and verified in all 3 platforms. 92 // implemented and verified in all 3 platforms.
93 new_nat_enabled_state = false; 93 new_nat_enabled_state = false;
94 } else { 94 } else {
95 // Otherwise, try to parse the value and only change from false if we get 95 // Otherwise, try to parse the value and only change from false if we get
96 // a successful read. 96 // a successful read.
97 base::Value* value; 97 base::Value* value;
98 if (new_policy->Get(kNatPolicyName, &value) && 98 if (new_policy->Get(kNatPolicyName, &value) && value->IsBoolean())
99 value->IsType(base::Value::TYPE_BOOLEAN)) {
100 CHECK(value->GetAsBoolean(&new_nat_enabled_state)); 99 CHECK(value->GetAsBoolean(&new_nat_enabled_state));
101 }
102 } 100 }
103 101
104 if (!first_state_published_ || 102 if (!first_state_published_ ||
105 (new_nat_enabled_state != current_nat_enabled_state_)) { 103 (new_nat_enabled_state != current_nat_enabled_state_)) {
106 first_state_published_ = true; 104 first_state_published_ = true;
107 current_nat_enabled_state_ = new_nat_enabled_state; 105 current_nat_enabled_state_ = new_nat_enabled_state;
108 nat_enabled_cb_.Run(current_nat_enabled_state_); 106 nat_enabled_cb_.Run(current_nat_enabled_state_);
109 } 107 }
110 } 108 }
111 109
112 } // namespace policy_hack 110 } // namespace policy_hack
113 } // namespace remoting 111 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/json_host_config.cc ('k') | remoting/host/plugin/policy_hack/nat_policy_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698