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_SESSION_PLUGIN_H_ |
| 6 #define REMOTING_PROTOCOL_SESSION_PLUGIN_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "remoting/protocol/jingle_messages.h" |
| 12 #include "remoting/protocol/session.h" |
| 13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 14 |
| 15 namespace remoting { |
| 16 namespace protocol { |
| 17 |
| 18 // Interface for Session plugins. Plugins allow to send and receive optional |
| 19 // information that is not essential for session handshake. Messages generated |
| 20 // by the plugins on one end of a connection are attached to the session |
| 21 // handshake messages and passed to the plugins on the other end. Plugins are |
| 22 // optional, i.e. Session doesn't need any plugins to connect successfully. |
| 23 class SessionPlugin { |
| 24 public: |
| 25 SessionPlugin() = default; |
| 26 virtual ~SessionPlugin() = default; |
| 27 |
| 28 // Returns an XmlElement if the SessionPlugin requires to attach some data |
| 29 // into the outgoing message. This function will be called after other |
| 30 // components have finished generating messages, and have set the state and |
| 31 // action. So |state| is the current session state, |action| is the current |
| 32 // ActionType in message. |
| 33 virtual std::unique_ptr<buzz::XmlElement> GetNextMessage( |
| 34 Session::State state) = 0; |
| 35 |
| 36 // Handles messages in |attachments|. This function will be called before |
| 37 // other components have handled the incoming message. So |state| is the last |
| 38 // session state, |action| is the current ActionType in message. |
| 39 virtual void OnIncomingMessage(Session::State state, |
| 40 const buzz::XmlElement& attachments) = 0; |
| 41 }; |
| 42 |
| 43 } // namespace protocol |
| 44 } // namespace remoting |
| 45 |
| 46 #endif // REMOTING_PROTOCOL_SESSION_PLUGIN_H_ |
OLD | NEW |