OLD | NEW |
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_STREAM_PARSER_H_ | 5 #ifndef REMOTING_SIGNALING_XMPP_STREAM_PARSER_H_ |
6 #define REMOTING_SIGNALING_XMPP_STREAM_PARSER_H_ | 6 #define REMOTING_SIGNALING_XMPP_STREAM_PARSER_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 | 13 |
14 namespace buzz { | 14 namespace buzz { |
15 class XmlElement; | 15 class XmlElement; |
16 } // namespace buzz | 16 } // namespace buzz |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 // XmppStreamParser is used to parse XMPP stream. Data is fed to the parser | 20 // XmppStreamParser is used to parse XMPP stream. Data is fed to the parser |
21 // using appendData() method and it calls |on_stanza_callback\ and | 21 // using appendData() method and it calls |on_stanza_callback\ and |
22 // |on_error_callback| specified using SetCallbacks(). | 22 // |on_error_callback| specified using SetCallbacks(). |
23 class XmppStreamParser { | 23 class XmppStreamParser { |
24 public: | 24 public: |
25 typedef base::Callback<void(scoped_ptr<buzz::XmlElement> stanza)> | 25 typedef base::Callback<void(std::unique_ptr<buzz::XmlElement> stanza)> |
26 OnStanzaCallback; | 26 OnStanzaCallback; |
27 | 27 |
28 XmppStreamParser(); | 28 XmppStreamParser(); |
29 ~XmppStreamParser(); | 29 ~XmppStreamParser(); |
30 | 30 |
31 void SetCallbacks(const OnStanzaCallback& on_stanza_callback, | 31 void SetCallbacks(const OnStanzaCallback& on_stanza_callback, |
32 const base::Closure& on_error_callback); | 32 const base::Closure& on_error_callback); |
33 | 33 |
34 void AppendData(const std::string& data); | 34 void AppendData(const std::string& data); |
35 | 35 |
36 private: | 36 private: |
37 class Core; | 37 class Core; |
38 | 38 |
39 scoped_ptr<Core> core_; | 39 std::unique_ptr<Core> core_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(XmppStreamParser); | 41 DISALLOW_COPY_AND_ASSIGN(XmppStreamParser); |
42 }; | 42 }; |
43 | 43 |
44 } // namespace remoting | 44 } // namespace remoting |
45 | 45 |
46 #endif // REMOTING_SIGNALING_XMPP_STREAM_PARSER_H_ | 46 #endif // REMOTING_SIGNALING_XMPP_STREAM_PARSER_H_ |
OLD | NEW |