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

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

Issue 10837022: [Chromoting] Add names of host policies for requiring 2-factor auth, and for the talkgadget name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 default_if_value_not_string))); 81 default_if_value_not_string)));
82 } 82 }
83 83
84 // Copies all policy values from one dictionary to another, using default values 84 // Copies all policy values from one dictionary to another, using default values
85 // when necessary. 85 // when necessary.
86 scoped_ptr<base::DictionaryValue> AddDefaultValuesWhenNecessary( 86 scoped_ptr<base::DictionaryValue> AddDefaultValuesWhenNecessary(
87 const base::DictionaryValue* from) { 87 const base::DictionaryValue* from) {
88 scoped_ptr<base::DictionaryValue> to(new base::DictionaryValue()); 88 scoped_ptr<base::DictionaryValue> to(new base::DictionaryValue());
89 CopyBooleanOrDefault(to.get(), from, 89 CopyBooleanOrDefault(to.get(), from,
90 PolicyWatcher::kNatPolicyName, true, false); 90 PolicyWatcher::kNatPolicyName, true, false);
91 CopyBooleanOrDefault(to.get(), from,
92 PolicyWatcher::kRequireTwoFactorPolicyName,
93 false, false);
91 CopyStringOrDefault(to.get(), from, 94 CopyStringOrDefault(to.get(), from,
92 PolicyWatcher::kHostDomainPolicyName, "", ""); 95 PolicyWatcher::kHostDomainPolicyName, "", "");
96 CopyStringOrDefault(to.get(), from,
97 PolicyWatcher::kTalkGadgetPolicyName,
98 "chromoting", "chromoting");
99
93 return to.Pass(); 100 return to.Pass();
94 } 101 }
95 102
96 } // namespace 103 } // namespace
97 104
98 const char PolicyWatcher::kNatPolicyName[] = 105 const char PolicyWatcher::kNatPolicyName[] =
99 "RemoteAccessHostFirewallTraversal"; 106 "RemoteAccessHostFirewallTraversal";
100 107
108 const char PolicyWatcher::kRequireTwoFactorPolicyName[] =
109 "RemoteAccessHostRequireTwoFactor";
110
101 const char PolicyWatcher::kHostDomainPolicyName[] = 111 const char PolicyWatcher::kHostDomainPolicyName[] =
102 "RemoteAccessHostDomain"; 112 "RemoteAccessHostDomain";
103 113
114 const char PolicyWatcher::kTalkGadgetPolicyName[] =
115 "RemoteAccessHostTalkGadget";
116
104 const char* const PolicyWatcher::kBooleanPolicyNames[] = 117 const char* const PolicyWatcher::kBooleanPolicyNames[] =
105 { PolicyWatcher::kNatPolicyName }; 118 { PolicyWatcher::kNatPolicyName,
119 PolicyWatcher::kRequireTwoFactorPolicyName
120 };
106 121
107 const int PolicyWatcher::kBooleanPolicyNamesNum = 122 const int PolicyWatcher::kBooleanPolicyNamesNum =
108 arraysize(kBooleanPolicyNames); 123 arraysize(kBooleanPolicyNames);
109 124
110 const char* const PolicyWatcher::kStringPolicyNames[] = 125 const char* const PolicyWatcher::kStringPolicyNames[] =
111 { PolicyWatcher::kHostDomainPolicyName }; 126 { PolicyWatcher::kHostDomainPolicyName,
127 PolicyWatcher::kTalkGadgetPolicyName
128 };
112 129
113 const int PolicyWatcher::kStringPolicyNamesNum = 130 const int PolicyWatcher::kStringPolicyNamesNum =
114 arraysize(kStringPolicyNames); 131 arraysize(kStringPolicyNames);
115 132
116 PolicyWatcher::PolicyWatcher( 133 PolicyWatcher::PolicyWatcher(
117 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 134 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
118 : task_runner_(task_runner), 135 : task_runner_(task_runner),
119 old_policies_(new base::DictionaryValue()), 136 old_policies_(new base::DictionaryValue()),
120 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 137 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
121 } 138 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 old_policies_.swap(new_policies); 211 old_policies_.swap(new_policies);
195 212
196 // Notify our client of the changed policies. 213 // Notify our client of the changed policies.
197 if (!changed_policies->empty()) { 214 if (!changed_policies->empty()) {
198 policy_callback_.Run(changed_policies.Pass()); 215 policy_callback_.Run(changed_policies.Pass());
199 } 216 }
200 } 217 }
201 218
202 } // namespace policy_hack 219 } // namespace policy_hack
203 } // namespace remoting 220 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/policy_hack/policy_watcher.h ('k') | remoting/host/policy_hack/policy_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698