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 // An interface to attach data on an outgoing message or handle an incoming of |
| 19 // message. The plugin data are designed to be optional, so this class won't |
| 20 // impact a session generation. |
| 21 class SessionPlugin { |
| 22 public: |
| 23 SessionPlugin(const base::Callback<std::unique_ptr<buzz::XmlElement>()>& |
| 24 new_attachments); |
| 25 virtual ~SessionPlugin(); |
| 26 |
| 27 // Attachs messages in |attachments|. |state| is the current session state. |
| 28 // |action| is the current ActionType in message. |
| 29 virtual void OnSending(Session::State state, |
| 30 JingleMessage::ActionType action, |
| 31 std::unique_ptr<buzz::XmlElement>* attachments) = 0; |
| 32 |
| 33 // Handles messages in |attachments|. |state| is the last session state. |
| 34 // |action| is the current ActionType in message. |
| 35 virtual void OnReceiving( |
| 36 Session::State state, |
| 37 JingleMessage::ActionType action, |
| 38 const std::unique_ptr<buzz::XmlElement>& attachments) = 0; |
| 39 |
| 40 protected: |
| 41 // Creates a new "attachments" xml element. |
| 42 const base::Callback<std::unique_ptr<buzz::XmlElement>()> new_attachments_; |
| 43 }; |
| 44 |
| 45 } // namespace protocol |
| 46 } // namespace remoting |
| 47 |
| 48 #endif // REMOTING_PROTOCOL_SESSION_PLUGIN_H_ |
OLD | NEW |