Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: remoting/jingle_glue/signal_strategy.h

Issue 10378110: Verify that xmpp_login specified in the config matches auth token. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/jingle_glue/mock_objects.h ('k') | remoting/jingle_glue/xmpp_signal_strategy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 CONNECTING, 23 CONNECTING,
24 24
25 // Signalling is connected. 25 // Signalling is connected.
26 CONNECTED, 26 CONNECTED,
27 27
28 // Connection is closed due to an error or because Disconnect() 28 // Connection is closed due to an error or because Disconnect()
29 // was called. 29 // was called.
30 DISCONNECTED, 30 DISCONNECTED,
31 }; 31 };
32 32
33 enum Error {
34 OK,
35 AUTHENTICATION_FAILED,
36 NETWORK_ERROR,
37 };
38
33 // Callback interface for signaling event. Event handlers are not 39 // Callback interface for signaling event. Event handlers are not
34 // allowed to destroy SignalStrategy, but may add or remove other 40 // allowed to destroy SignalStrategy, but may add or remove other
35 // listeners. 41 // listeners.
36 class Listener { 42 class Listener {
37 public: 43 public:
38 virtual ~Listener() {} 44 virtual ~Listener() {}
39 45
40 // Called after state of the connection has changed. 46 // Called after state of the connection has changed. If the state
47 // is DISCONNECTED, then GetError() can be used to get the reason
48 // for the disconnection.
41 virtual void OnSignalStrategyStateChange(State state) {} 49 virtual void OnSignalStrategyStateChange(State state) {}
42 50
43 // Must return true if the stanza was handled, false 51 // Must return true if the stanza was handled, false
44 // otherwise. The signal strategy must not be deleted from a 52 // otherwise. The signal strategy must not be deleted from a
45 // handler of this message. 53 // handler of this message.
46 virtual bool OnSignalStrategyIncomingStanza( 54 virtual bool OnSignalStrategyIncomingStanza(
47 const buzz::XmlElement* stanza) { return false; } 55 const buzz::XmlElement* stanza) { return false; }
48 }; 56 };
49 57
50 SignalStrategy() {} 58 SignalStrategy() {}
51 virtual ~SignalStrategy() {} 59 virtual ~SignalStrategy() {}
52 60
53 // Starts connection attempt. If connection is currently active 61 // Starts connection attempt. If connection is currently active
54 // disconnects it and opens a new connection (implicit disconnect 62 // disconnects it and opens a new connection (implicit disconnect
55 // triggers CLOSED notification). Connection is finished 63 // triggers CLOSED notification). Connection is finished
56 // asynchronously. 64 // asynchronously.
57 virtual void Connect() = 0; 65 virtual void Connect() = 0;
58 66
59 // Disconnects current connection if connected. Triggers CLOSED 67 // Disconnects current connection if connected. Triggers CLOSED
60 // notification. 68 // notification.
61 virtual void Disconnect() = 0; 69 virtual void Disconnect() = 0;
62 70
63 // Returns current state. 71 // Returns current state.
64 virtual State GetState() const = 0; 72 virtual State GetState() const = 0;
65 73
74 // Returns the last error. Set when state changes to DISCONNECT.
75 virtual Error GetError() const = 0;
76
66 // Returns local JID or an empty string when not connected. 77 // Returns local JID or an empty string when not connected.
67 virtual std::string GetLocalJid() const = 0; 78 virtual std::string GetLocalJid() const = 0;
68 79
69 // Add a |listener| that can listen to all incoming 80 // Add a |listener| that can listen to all incoming
70 // messages. Doesn't take ownership of the |listener|. All listeners 81 // messages. Doesn't take ownership of the |listener|. All listeners
71 // must be removed before this object is destroyed. 82 // must be removed before this object is destroyed.
72 virtual void AddListener(Listener* listener) = 0; 83 virtual void AddListener(Listener* listener) = 0;
73 84
74 // Remove a |listener| previously added with AddListener(). 85 // Remove a |listener| previously added with AddListener().
75 virtual void RemoveListener(Listener* listener) = 0; 86 virtual void RemoveListener(Listener* listener) = 0;
76 87
77 // Sends a raw XMPP stanza. 88 // Sends a raw XMPP stanza.
78 virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) = 0; 89 virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) = 0;
79 90
80 // Returns new ID that should be used for the next outgoing IQ 91 // Returns new ID that should be used for the next outgoing IQ
81 // request. 92 // request.
82 virtual std::string GetNextId() = 0; 93 virtual std::string GetNextId() = 0;
83 94
84 private: 95 private:
85 DISALLOW_COPY_AND_ASSIGN(SignalStrategy); 96 DISALLOW_COPY_AND_ASSIGN(SignalStrategy);
86 }; 97 };
87 98
88 } // namespace remoting 99 } // namespace remoting
89 100
90 #endif // REMOTING_JINGLE_GLUE_SIGNAL_STRATEGY_H_ 101 #endif // REMOTING_JINGLE_GLUE_SIGNAL_STRATEGY_H_
OLDNEW
« no previous file with comments | « remoting/jingle_glue/mock_objects.h ('k') | remoting/jingle_glue/xmpp_signal_strategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698