| 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 #ifndef REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_ |
| 6 #define REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_ | 6 #define REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
| 10 | 10 |
| 11 #include "ppapi/cpp/completion_callback.h" | 11 #include "ppapi/cpp/completion_callback.h" |
| 12 | 12 |
| 13 struct PP_NetAddress_Private; |
| 14 |
| 15 namespace talk_base { |
| 16 class SocketAddress; |
| 17 } // namespace talk_base |
| 18 |
| 13 namespace remoting { | 19 namespace remoting { |
| 14 | 20 |
| 15 // Adapts a base::Callback to a pp::CompletionCallback, which may be passed to | 21 // Adapts a base::Callback to a pp::CompletionCallback, which may be passed to |
| 16 // exactly one Pepper API. If the adapted callback is not used then a copy of | 22 // exactly one Pepper API. If the adapted callback is not used then a copy of |
| 17 // |callback| will be leaked, including references & passed values bound to it. | 23 // |callback| will be leaked, including references & passed values bound to it. |
| 18 pp::CompletionCallback PpCompletionCallback(base::Callback<void(int)> callback); | 24 pp::CompletionCallback PpCompletionCallback(base::Callback<void(int)> callback); |
| 19 | 25 |
| 26 // Helpers to convert between different socket address representations. |
| 27 bool SocketAddressToPpAddressWithPort(const talk_base::SocketAddress& address, |
| 28 PP_NetAddress_Private* pp_address, |
| 29 uint16_t port); |
| 30 bool SocketAddressToPpAddress(const talk_base::SocketAddress& address, |
| 31 PP_NetAddress_Private* pp_address); |
| 32 bool PpAddressToSocketAddress(const PP_NetAddress_Private& pp_address, |
| 33 talk_base::SocketAddress* address); |
| 34 |
| 20 } // namespace remoting | 35 } // namespace remoting |
| 21 | 36 |
| 22 #endif // REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_ | 37 #endif // REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_ |
| OLD | NEW |