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

Unified Diff: remoting/host/policy_watcher.cc

Issue 2682473003: Add support for multiple allowed domains (Closed)
Patch Set: Rebase patch 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..9bb9007185590716a766da7166b8710e783a195d 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,37 @@ 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);
+ if (!domain.empty()) {
+ 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);
+ if (!domain.empty()) {
+ auto list = base::MakeUnique<base::ListValue>();
+ list->AppendString(domain);
+ dict->Set(policy::key::kRemoteAccessHostClientDomainList,
+ std::move(list));
+ }
+ }
+ dict->Remove(policy::key::kRemoteAccessHostClientDomain, nullptr);
+ }
+}
+
namespace {
void CopyDictionaryValue(const base::DictionaryValue& from,
base::DictionaryValue& to,

Powered by Google App Engine
This is Rietveld 408576698