Chromium Code Reviews| 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(); | |
| 24 virtual ~SessionPlugin(); | |
| 25 | |
| 26 // Attachs messages in |attachments|. This function will be called after other | |
|
Jamie
2016/12/20 23:29:21
s/Attachs/Attaches/
Hzj_jie
2016/12/21 01:54:44
Done.
| |
| 27 // components have finished generating messages, and set the state and action. | |
|
Jamie
2016/12/20 23:29:21
s/and set/and have set/
Hzj_jie
2016/12/21 01:54:44
Done.
| |
| 28 // So |state| is the current session state, |action| is the current ActionType | |
| 29 // in message. | |
| 30 virtual void OnSending(Session::State state, | |
|
Jamie
2016/12/20 23:29:21
I think On[Incoming|Outgoing]Message would be bett
Hzj_jie
2016/12/21 01:54:44
Done.
| |
| 31 JingleMessage::ActionType action, | |
| 32 std::unique_ptr<buzz::XmlElement>* attachments) = 0; | |
|
Jamie
2016/12/20 23:29:21
Passing a pointer to a unique_ptr is a bit strange
Hzj_jie
2016/12/21 01:54:44
This function is a little bit different than Execu
| |
| 33 | |
| 34 // Handles messages in |attachments|. This function will be called before | |
| 35 // other components have handled the incoming message. So |state| is the last | |
| 36 // session state, |action| is the current ActionType in message. | |
| 37 virtual void OnReceiving( | |
| 38 Session::State state, | |
| 39 JingleMessage::ActionType action, | |
| 40 const std::unique_ptr<buzz::XmlElement>& attachments) = 0; | |
| 41 | |
| 42 // Finds "attachments" tag from |tag|, returns null if the tag is not found. | |
| 43 static const buzz::XmlElement* FindAttachments(const buzz::XmlElement& tag); | |
| 44 | |
| 45 // Creates a new "attachments" tag. | |
| 46 static std::unique_ptr<buzz::XmlElement> NewAttachments(); | |
| 47 }; | |
| 48 | |
| 49 } // namespace protocol | |
| 50 } // namespace remoting | |
| 51 | |
| 52 #endif // REMOTING_PROTOCOL_SESSION_PLUGIN_H_ | |
| OLD | NEW |