OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_PROTOCOL_MESSAGE_CHANNEL_FACTORY_H_ |
| 6 #define REMOTING_PROTOCOL_MESSAGE_CHANNEL_FACTORY_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback_forward.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 namespace remoting { |
| 14 namespace protocol { |
| 15 |
| 16 class MessagePipe; |
| 17 |
| 18 class MessageChannelFactory { |
| 19 public: |
| 20 typedef base::Callback<void(scoped_ptr<MessagePipe>)> ChannelCreatedCallback; |
| 21 |
| 22 virtual ~MessageChannelFactory() {} |
| 23 |
| 24 // Creates new channels and calls the |callback| when then new channel is |
| 25 // created and connected. Callback may be called synchronously, before the |
| 26 // call returns. If channel creation fails the callback is never called. All |
| 27 // channels must be destroyed, and CancelChannelCreation() called for any |
| 28 // pending channels, before the factory is destroyed. |
| 29 virtual void CreateChannel(const std::string& name, |
| 30 const ChannelCreatedCallback& callback) = 0; |
| 31 |
| 32 // Cancels a pending CreateChannel() operation for the named channel. If the |
| 33 // channel creation already completed then canceling it has no effect. When |
| 34 // shutting down this method must be called for each channel pending creation. |
| 35 virtual void CancelChannelCreation(const std::string& name) = 0; |
| 36 }; |
| 37 |
| 38 } // namespace protocol |
| 39 } // namespace remoting |
| 40 |
| 41 #endif // REMOTING_PROTOCOL_MESSAGE_CHANNEL_FACTORY_H_ |
OLD | NEW |