| OLD | NEW |
| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "remoting/host/constants.h" | 18 #include "remoting/host/dns_blackhole_checker.h" |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 namespace policy_hack { | 21 namespace policy_hack { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 // The time interval for rechecking policy. This is our fallback in case the | 24 // The time interval for rechecking policy. This is our fallback in case the |
| 25 // delegate never reports a change to the ReloadObserver. | 25 // delegate never reports a change to the ReloadObserver. |
| 26 const int kFallbackReloadDelayMinutes = 15; | 26 const int kFallbackReloadDelayMinutes = 15; |
| 27 | 27 |
| 28 // Gets a boolean from a dictionary, or returns a default value if the boolean | 28 // Gets a boolean from a dictionary, or returns a default value if the boolean |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 scoped_ptr<base::DictionaryValue> to(new base::DictionaryValue()); | 89 scoped_ptr<base::DictionaryValue> to(new base::DictionaryValue()); |
| 90 CopyBooleanOrDefault(to.get(), from, | 90 CopyBooleanOrDefault(to.get(), from, |
| 91 PolicyWatcher::kNatPolicyName, true, false); | 91 PolicyWatcher::kNatPolicyName, true, false); |
| 92 CopyBooleanOrDefault(to.get(), from, | 92 CopyBooleanOrDefault(to.get(), from, |
| 93 PolicyWatcher::kHostRequireTwoFactorPolicyName, | 93 PolicyWatcher::kHostRequireTwoFactorPolicyName, |
| 94 false, false); | 94 false, false); |
| 95 CopyStringOrDefault(to.get(), from, | 95 CopyStringOrDefault(to.get(), from, |
| 96 PolicyWatcher::kHostDomainPolicyName, "", ""); | 96 PolicyWatcher::kHostDomainPolicyName, "", ""); |
| 97 CopyStringOrDefault(to.get(), from, | 97 CopyStringOrDefault(to.get(), from, |
| 98 PolicyWatcher::kHostTalkGadgetPrefixPolicyName, | 98 PolicyWatcher::kHostTalkGadgetPrefixPolicyName, |
| 99 kDefaultTalkGadgetPrefix, kDefaultTalkGadgetPrefix); | 99 kDefaultHostTalkGadgetPrefix, |
| 100 kDefaultHostTalkGadgetPrefix); |
| 100 CopyBooleanOrDefault(to.get(), from, | 101 CopyBooleanOrDefault(to.get(), from, |
| 101 PolicyWatcher::kHostRequireCurtainPolicyName, | 102 PolicyWatcher::kHostRequireCurtainPolicyName, |
| 102 false, false); | 103 false, false); |
| 103 | 104 |
| 104 return to.Pass(); | 105 return to.Pass(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace | 108 } // namespace |
| 108 | 109 |
| 109 const char PolicyWatcher::kNatPolicyName[] = | 110 const char PolicyWatcher::kNatPolicyName[] = |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 old_policies_.swap(new_policies); | 220 old_policies_.swap(new_policies); |
| 220 | 221 |
| 221 // Notify our client of the changed policies. | 222 // Notify our client of the changed policies. |
| 222 if (!changed_policies->empty()) { | 223 if (!changed_policies->empty()) { |
| 223 policy_callback_.Run(changed_policies.Pass()); | 224 policy_callback_.Run(changed_policies.Pass()); |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 | 227 |
| 227 } // namespace policy_hack | 228 } // namespace policy_hack |
| 228 } // namespace remoting | 229 } // namespace remoting |
| OLD | NEW |