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 namespace base { |
| 12 class MessageLoopProxy; |
| 13 class WaitableEvent; |
| 14 } // namespace base |
| 15 |
| 16 namespace remoting { |
| 17 namespace policy_hack { |
| 18 |
| 19 // Watches for changes to the managed remote access host NAT policies. |
| 20 // If StartWatching() has been called, then before this object can be deleted, |
| 21 // StopWatching() have completed (the provided |done| event must be signaled). |
| 22 class NatPolicy { |
| 23 public: |
| 24 // Called with the current status of whether or not NAT traversal is enabled. |
| 25 typedef base::Callback<void(bool)> NatEnabledCallback; |
| 26 |
| 27 NatPolicy() {} |
| 28 virtual ~NatPolicy() {} |
| 29 |
| 30 // This guarantees that the |nat_enabled_cb| is called at least once with |
| 31 // the current policy. After that, |nat_enabled_cb| will be called whenever |
| 32 // a change to the nat policy is detected. |
| 33 virtual void StartWatching(const NatEnabledCallback& nat_enabled_cb) = 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. This message loop should be an IO message |
| 40 // loop on linux. |
| 41 // |
| 42 // TODO(ajwong): figure out the right message loop for win/mac. |
| 43 static NatPolicy* Create(base::MessageLoopProxy* message_loop_proxy); |
| 44 }; |
| 45 |
| 46 } // namespace policy_hack |
| 47 } // namespace remoting |
| 48 |
| 49 #endif // REMOTING_HOST_PLUGIN_POLICY_HACK_NAT_POLICY_H_ |
OLD | NEW |