OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_PLUGIN_POLICY_HACK_NAT_POLICY_H_ |
| 6 #define REMOTING_HOST_PLUGIN_POLICY_HACK_NAT_POLICY_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 |
| 11 class MessageLoop; |
| 12 |
| 13 namespace base { |
| 14 class WaitableEvent; |
| 15 } // namespace base |
| 16 |
| 17 namespace remoting { |
| 18 namespace policy_hack { |
| 19 |
| 20 // Watches for changes to the managed remote access host NAT policies. |
| 21 // If StartWatching() has been called, then before this object can be deleted, |
| 22 // StopWatching() have completed (the provided |done| event must be signaled). |
| 23 class NatPolicy { |
| 24 public: |
| 25 // Called with the current status of whether or not NAT traversal is enabled. |
| 26 typedef base::Callback<void(bool)> NatEnabledCallback; |
| 27 |
| 28 NatPolicy() {} |
| 29 virtual ~NatPolicy() {} |
| 30 |
| 31 // This guarantees that the policy_update_cb is called at least once with the |
| 32 // current policy. |
| 33 virtual void StartWatching() = 0; |
| 34 |
| 35 // Should be called after StartWatching() before the object is deleted. Calls |
| 36 // just wait for |done| to be signaled before deleting the object. |
| 37 virtual void StopWatching(base::WaitableEvent* done) = 0; |
| 38 |
| 39 // Implemented by each platform. |
| 40 static NatPolicy* Create(MessageLoop* message_loop, |
| 41 const NatEnabledCallback& policy_update_cb); |
| 42 }; |
| 43 |
| 44 } // namespace policy_hack |
| 45 } // namespace remoting |
| 46 |
| 47 #endif // REMOTING_HOST_PLUGIN_POLICY_HACK_NAT_POLICY_H_ |
OLD | NEW |