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

Side by Side Diff: remoting/client/plugin/delegating_signal_strategy.cc

Issue 2384063008: Enables delegating signal strategy for It2Me Host. (Closed)
Patch Set: Fix typos Created 4 years, 2 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/client/plugin/delegating_signal_strategy.h ('k') | remoting/host/it2me/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 #include "remoting/client/plugin/delegating_signal_strategy.h"
6
7 #include "base/rand_util.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
10
11 namespace remoting {
12
13 DelegatingSignalStrategy::DelegatingSignalStrategy(
14 std::string local_jid,
15 const SendIqCallback& send_iq_callback)
16 : local_jid_(local_jid),
17 send_iq_callback_(send_iq_callback) {
18 }
19
20 DelegatingSignalStrategy::~DelegatingSignalStrategy() {
21 }
22
23 void DelegatingSignalStrategy::OnIncomingMessage(const std::string& message) {
24 std::unique_ptr<buzz::XmlElement> stanza(buzz::XmlElement::ForStr(message));
25 if (!stanza.get()) {
26 LOG(WARNING) << "Malformed XMPP stanza received: " << message;
27 return;
28 }
29
30 base::ObserverListBase<Listener>::Iterator it(&listeners_);
31 Listener* listener;
32 while ((listener = it.GetNext()) != nullptr) {
33 if (listener->OnSignalStrategyIncomingStanza(stanza.get()))
34 break;
35 }
36 }
37
38 void DelegatingSignalStrategy::Connect() {
39 }
40
41 void DelegatingSignalStrategy::Disconnect() {
42 }
43
44 SignalStrategy::State DelegatingSignalStrategy::GetState() const {
45 return CONNECTED;
46 }
47
48 SignalStrategy::Error DelegatingSignalStrategy::GetError() const {
49 return OK;
50 }
51
52 std::string DelegatingSignalStrategy::GetLocalJid() const {
53 return local_jid_;
54 }
55
56 void DelegatingSignalStrategy::AddListener(Listener* listener) {
57 listeners_.AddObserver(listener);
58 }
59
60 void DelegatingSignalStrategy::RemoveListener(Listener* listener) {
61 listeners_.RemoveObserver(listener);
62 }
63
64 bool DelegatingSignalStrategy::SendStanza(
65 std::unique_ptr<buzz::XmlElement> stanza) {
66 send_iq_callback_.Run(stanza->Str());
67 return true;
68 }
69
70 std::string DelegatingSignalStrategy::GetNextId() {
71 return base::Uint64ToString(base::RandUint64());
72 }
73
74 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/delegating_signal_strategy.h ('k') | remoting/host/it2me/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698