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

Unified Diff: remoting/host/policy_watcher.cc

Issue 2682473003: Add support for multiple allowed domains (Closed)
Patch Set: Rework to follow a deprecation approach Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/policy_watcher.cc
diff --git a/remoting/host/policy_watcher.cc b/remoting/host/policy_watcher.cc
index 569e3289c887f130aa6dcbf0dc79105f2a27f629..6b868cf3b5fb7edd92ab9234bf81ef3e0b5453b7 100644
--- a/remoting/host/policy_watcher.cc
+++ b/remoting/host/policy_watcher.cc
@@ -181,8 +181,10 @@ PolicyWatcher::PolicyWatcher(
default_values_->SetBoolean(key::kRemoteAccessHostFirewallTraversal, true);
default_values_->SetBoolean(key::kRemoteAccessHostRequireCurtain, false);
default_values_->SetBoolean(key::kRemoteAccessHostMatchUsername, false);
- default_values_->SetString(key::kRemoteAccessHostClientDomain, std::string());
- default_values_->SetString(key::kRemoteAccessHostDomain, std::string());
+ default_values_->Set(key::kRemoteAccessHostClientDomainList,
+ base::MakeUnique<base::ListValue>());
+ default_values_->Set(key::kRemoteAccessHostDomainList,
+ base::MakeUnique<base::ListValue>());
default_values_->SetString(key::kRemoteAccessHostTalkGadgetPrefix,
kDefaultHostTalkGadgetPrefix);
default_values_->SetString(key::kRemoteAccessHostTokenUrl, std::string());
@@ -232,6 +234,7 @@ bool PolicyWatcher::NormalizePolicies(base::DictionaryValue* policy_dict) {
LOG(WARNING) << "Unknown (unrecognized or unsupported) policy: " << path
<< ": " << error;
}
+ HandleDeprecatedPolicies(policy_dict);
return true;
} else {
LOG(ERROR) << "Invalid policy contents: " << path << ": " << error;
@@ -239,6 +242,33 @@ bool PolicyWatcher::NormalizePolicies(base::DictionaryValue* policy_dict) {
}
}
+void PolicyWatcher::HandleDeprecatedPolicies(base::DictionaryValue* dict) {
+ // RemoteAccessHostDomain
+ if (dict->HasKey(policy::key::kRemoteAccessHostDomain)) {
+ if (!dict->HasKey(policy::key::kRemoteAccessHostDomainList)) {
+ std::string domain;
+ dict->GetString(policy::key::kRemoteAccessHostDomain, &domain);
+ auto list = base::MakeUnique<base::ListValue>();
+ list->AppendString(domain);
+ dict->Set(policy::key::kRemoteAccessHostDomainList, std::move(list));
+ }
+ dict->Remove(policy::key::kRemoteAccessHostDomain, nullptr);
+ }
+
+ // RemoteAccessHostClientDomain
+ if (dict->HasKey(policy::key::kRemoteAccessHostClientDomain)) {
+ if (!dict->HasKey(policy::key::kRemoteAccessHostClientDomainList)) {
+ std::string domain;
+ dict->GetString(policy::key::kRemoteAccessHostClientDomain, &domain);
+ auto list = base::MakeUnique<base::ListValue>();
+ list->AppendString(domain);
+ dict->Set(policy::key::kRemoteAccessHostClientDomainList,
+ std::move(list));
+ }
+ dict->Remove(policy::key::kRemoteAccessHostClientDomain, nullptr);
+ }
+}
Jamie 2017/04/19 00:29:02 Does the existing PolicyWatcher test code cover th
rkjnsn 2017/04/19 16:45:26 It's getting exercised by the It2MeHost tests, but
+
namespace {
void CopyDictionaryValue(const base::DictionaryValue& from,
base::DictionaryValue& to,

Powered by Google App Engine
This is Rietveld 408576698