| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ | 5 #ifndef REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ |
| 6 #define REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ | 6 #define REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 void set_fail_create(bool fail_create) { fail_create_ = fail_create; } | 94 void set_fail_create(bool fail_create) { fail_create_ = fail_create; } |
| 95 | 95 |
| 96 // Pair with |peer_factory|. Once paired the factory will be automatically | 96 // Pair with |peer_factory|. Once paired the factory will be automatically |
| 97 // pairing created sockets with the sockets with the same name from the peer | 97 // pairing created sockets with the sockets with the same name from the peer |
| 98 // factory. | 98 // factory. |
| 99 void PairWith(FakeDatagramChannelFactory* peer_factory); | 99 void PairWith(FakeDatagramChannelFactory* peer_factory); |
| 100 | 100 |
| 101 // Can be used to retrieve FakeDatagramSocket created by this factory, e.g. to | 101 // Can be used to retrieve FakeDatagramSocket created by this factory, e.g. to |
| 102 // feed data into it. The caller doesn't get ownership of the result. Returns | 102 // feed data into it. The caller doesn't get ownership of the result. Returns |
| 103 // NULL if the socket doesn't exist. | 103 // nullptr if the socket doesn't exist. |
| 104 FakeDatagramSocket* GetFakeChannel(const std::string& name); | 104 FakeDatagramSocket* GetFakeChannel(const std::string& name); |
| 105 | 105 |
| 106 // DatagramChannelFactory interface. | 106 // DatagramChannelFactory interface. |
| 107 void CreateChannel(const std::string& name, | 107 void CreateChannel(const std::string& name, |
| 108 const ChannelCreatedCallback& callback) override; | 108 const ChannelCreatedCallback& callback) override; |
| 109 void CancelChannelCreation(const std::string& name) override; | 109 void CancelChannelCreation(const std::string& name) override; |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 typedef std::map<std::string, base::WeakPtr<FakeDatagramSocket> > ChannelsMap; | 112 typedef std::map<std::string, base::WeakPtr<FakeDatagramSocket> > ChannelsMap; |
| 113 | 113 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 125 | 125 |
| 126 base::WeakPtrFactory<FakeDatagramChannelFactory> weak_factory_; | 126 base::WeakPtrFactory<FakeDatagramChannelFactory> weak_factory_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(FakeDatagramChannelFactory); | 128 DISALLOW_COPY_AND_ASSIGN(FakeDatagramChannelFactory); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 } // namespace protocol | 131 } // namespace protocol |
| 132 } // namespace remoting | 132 } // namespace remoting |
| 133 | 133 |
| 134 #endif // REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ | 134 #endif // REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ |
| OLD | NEW |