OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_JINGLE_GLUE_SIGNAL_STRATEGY_H_ | 5 #ifndef REMOTING_JINGLE_GLUE_SIGNAL_STRATEGY_H_ |
6 #define REMOTING_JINGLE_GLUE_SIGNAL_STRATEGY_H_ | 6 #define REMOTING_JINGLE_GLUE_SIGNAL_STRATEGY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Callback interface for signaling event. Event handlers are not | 39 // Callback interface for signaling event. Event handlers are not |
40 // allowed to destroy SignalStrategy, but may add or remove other | 40 // allowed to destroy SignalStrategy, but may add or remove other |
41 // listeners. | 41 // listeners. |
42 class Listener { | 42 class Listener { |
43 public: | 43 public: |
44 virtual ~Listener() {} | 44 virtual ~Listener() {} |
45 | 45 |
46 // Called after state of the connection has changed. If the state | 46 // Called after state of the connection has changed. If the state |
47 // is DISCONNECTED, then GetError() can be used to get the reason | 47 // is DISCONNECTED, then GetError() can be used to get the reason |
48 // for the disconnection. | 48 // for the disconnection. |
49 virtual void OnSignalStrategyStateChange(State state) {} | 49 virtual void OnSignalStrategyStateChange(State state) = 0; |
50 | 50 |
51 // Must return true if the stanza was handled, false | 51 // Must return true if the stanza was handled, false |
52 // otherwise. The signal strategy must not be deleted from a | 52 // otherwise. The signal strategy must not be deleted from a |
53 // handler of this message. | 53 // handler of this message. |
54 virtual bool OnSignalStrategyIncomingStanza( | 54 virtual bool OnSignalStrategyIncomingStanza( |
55 const buzz::XmlElement* stanza) { return false; } | 55 const buzz::XmlElement* stanza) = 0; |
56 }; | 56 }; |
57 | 57 |
58 SignalStrategy() {} | 58 SignalStrategy() {} |
59 virtual ~SignalStrategy() {} | 59 virtual ~SignalStrategy() {} |
60 | 60 |
61 // Starts connection attempt. If connection is currently active | 61 // Starts connection attempt. If connection is currently active |
62 // disconnects it and opens a new connection (implicit disconnect | 62 // disconnects it and opens a new connection (implicit disconnect |
63 // triggers CLOSED notification). Connection is finished | 63 // triggers CLOSED notification). Connection is finished |
64 // asynchronously. | 64 // asynchronously. |
65 virtual void Connect() = 0; | 65 virtual void Connect() = 0; |
(...skipping 26 matching lines...) Expand all Loading... |
92 // request. | 92 // request. |
93 virtual std::string GetNextId() = 0; | 93 virtual std::string GetNextId() = 0; |
94 | 94 |
95 private: | 95 private: |
96 DISALLOW_COPY_AND_ASSIGN(SignalStrategy); | 96 DISALLOW_COPY_AND_ASSIGN(SignalStrategy); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace remoting | 99 } // namespace remoting |
100 | 100 |
101 #endif // REMOTING_JINGLE_GLUE_SIGNAL_STRATEGY_H_ | 101 #endif // REMOTING_JINGLE_GLUE_SIGNAL_STRATEGY_H_ |
OLD | NEW |