| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "remoting/jingle_glue/javascript_iq_request.h" | 5 #include "remoting/jingle_glue/javascript_iq_request.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "remoting/jingle_glue/signal_strategy.h" | 9 #include "remoting/jingle_glue/signal_strategy.h" |
| 10 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 10 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 JavascriptIqRequest::JavascriptIqRequest(SignalStrategy* signal_strategy, | 76 JavascriptIqRequest::JavascriptIqRequest(SignalStrategy* signal_strategy, |
| 77 JavascriptIqRegistry* registry) | 77 JavascriptIqRegistry* registry) |
| 78 : signal_strategy_(signal_strategy), | 78 : signal_strategy_(signal_strategy), |
| 79 registry_(registry) { | 79 registry_(registry) { |
| 80 } | 80 } |
| 81 | 81 |
| 82 JavascriptIqRequest::~JavascriptIqRequest() { | 82 JavascriptIqRequest::~JavascriptIqRequest() { |
| 83 registry_->RemoveAllRequests(this); | 83 registry_->RemoveAllRequests(this); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void JavascriptIqRequest::SendIq(const std::string& type, | 86 void JavascriptIqRequest::SendIq(buzz::XmlElement* stanza) { |
| 87 const std::string& addressee, | |
| 88 buzz::XmlElement* iq_body) { | |
| 89 std::string id = signal_strategy_->GetNextId(); | 87 std::string id = signal_strategy_->GetNextId(); |
| 88 stanza->AddAttr(buzz::QN_ID, id); |
| 90 registry_->RegisterRequest(this, id); | 89 registry_->RegisterRequest(this, id); |
| 91 signal_strategy_->SendStanza(MakeIqStanza(type, addressee, iq_body, id)); | 90 signal_strategy_->SendStanza(stanza); |
| 92 } | 91 } |
| 93 | 92 |
| 94 void JavascriptIqRequest::set_callback(const ReplyCallback& callback) { | 93 void JavascriptIqRequest::set_callback(const ReplyCallback& callback) { |
| 95 callback_ = callback; | 94 callback_ = callback; |
| 96 } | 95 } |
| 97 | 96 |
| 98 } // namespace remoting | 97 } // namespace remoting |
| OLD | NEW |