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

Side by Side Diff: remoting/signaling/xmpp_login_handler.h

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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/signaling/signal_strategy.h ('k') | remoting/signaling/xmpp_login_handler.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SIGNALING_XMPP_LOGIN_HANDLER_H_ 5 #ifndef REMOTING_SIGNALING_XMPP_LOGIN_HANDLER_H_
6 #define REMOTING_SIGNALING_XMPP_LOGIN_HANDLER_H_ 6 #define REMOTING_SIGNALING_XMPP_LOGIN_HANDLER_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "remoting/signaling/signal_strategy.h" 12 #include "remoting/signaling/signal_strategy.h"
13 13
14 // Undefine SendMessage and ERROR defined in Windows headers. 14 // Undefine SendMessage and ERROR defined in Windows headers.
15 #ifdef SendMessage 15 #ifdef SendMessage
16 #undef SendMessage 16 #undef SendMessage
17 #endif 17 #endif
18 18
19 #ifdef ERROR 19 #ifdef ERROR
20 #undef ERROR 20 #undef ERROR
21 #endif 21 #endif
(...skipping 11 matching lines...) Expand all
33 class XmppLoginHandler { 33 class XmppLoginHandler {
34 public: 34 public:
35 class Delegate { 35 class Delegate {
36 public: 36 public:
37 Delegate() {} 37 Delegate() {}
38 38
39 // All Delegate methods are allowed to destroy XmppLoginHandler. 39 // All Delegate methods are allowed to destroy XmppLoginHandler.
40 virtual void SendMessage(const std::string& message) = 0; 40 virtual void SendMessage(const std::string& message) = 0;
41 virtual void StartTls() = 0; 41 virtual void StartTls() = 0;
42 virtual void OnHandshakeDone(const std::string& jid, 42 virtual void OnHandshakeDone(const std::string& jid,
43 scoped_ptr<XmppStreamParser> parser) = 0; 43 std::unique_ptr<XmppStreamParser> parser) = 0;
44 virtual void OnLoginHandlerError(SignalStrategy::Error error) = 0; 44 virtual void OnLoginHandlerError(SignalStrategy::Error error) = 0;
45 45
46 protected: 46 protected:
47 virtual ~Delegate() {} 47 virtual ~Delegate() {}
48 }; 48 };
49 49
50 enum class TlsMode { 50 enum class TlsMode {
51 NO_TLS, 51 NO_TLS,
52 WITH_HANDSHAKE, 52 WITH_HANDSHAKE,
53 WITHOUT_HANDSHAKE, 53 WITHOUT_HANDSHAKE,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 WAIT_STREAM_HEADER_AFTER_TLS, 105 WAIT_STREAM_HEADER_AFTER_TLS,
106 WAIT_AUTH_RESULT, 106 WAIT_AUTH_RESULT,
107 WAIT_STREAM_HEADER_AFTER_AUTH, 107 WAIT_STREAM_HEADER_AFTER_AUTH,
108 WAIT_BIND_RESULT, 108 WAIT_BIND_RESULT,
109 WAIT_SESSION_IQ_RESULT, 109 WAIT_SESSION_IQ_RESULT,
110 DONE, 110 DONE,
111 ERROR, 111 ERROR,
112 }; 112 };
113 113
114 // Callbacks for XmppStreamParser. 114 // Callbacks for XmppStreamParser.
115 void OnStanza(scoped_ptr<buzz::XmlElement> stanza); 115 void OnStanza(std::unique_ptr<buzz::XmlElement> stanza);
116 void OnParserError(); 116 void OnParserError();
117 117
118 // Starts authentication handshake in WAIT_STREAM_HEADER_AFTER_TLS state. 118 // Starts authentication handshake in WAIT_STREAM_HEADER_AFTER_TLS state.
119 void StartAuthHandshake(); 119 void StartAuthHandshake();
120 120
121 // Helper used to send stream header. 121 // Helper used to send stream header.
122 void StartStream(const std::string& first_message); 122 void StartStream(const std::string& first_message);
123 123
124 // Report the |error| to the delegate and changes |state_| to ERROR, 124 // Report the |error| to the delegate and changes |state_| to ERROR,
125 void OnError(SignalStrategy::Error error); 125 void OnError(SignalStrategy::Error error);
126 126
127 std::string server_; 127 std::string server_;
128 std::string username_; 128 std::string username_;
129 std::string auth_token_; 129 std::string auth_token_;
130 TlsMode tls_mode_; 130 TlsMode tls_mode_;
131 Delegate* delegate_; 131 Delegate* delegate_;
132 132
133 State state_; 133 State state_;
134 134
135 std::string jid_; 135 std::string jid_;
136 136
137 scoped_ptr<XmppStreamParser> stream_parser_; 137 std::unique_ptr<XmppStreamParser> stream_parser_;
138 138
139 DISALLOW_COPY_AND_ASSIGN(XmppLoginHandler); 139 DISALLOW_COPY_AND_ASSIGN(XmppLoginHandler);
140 }; 140 };
141 141
142 } // namespace remoting 142 } // namespace remoting
143 143
144 #endif // REMOTING_SIGNALING_XMPP_LOGIN_HANDLER_H_ 144 #endif // REMOTING_SIGNALING_XMPP_LOGIN_HANDLER_H_
OLDNEW
« no previous file with comments | « remoting/signaling/signal_strategy.h ('k') | remoting/signaling/xmpp_login_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698