| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 VLOG(1) << "Dropping IQ packet with no request id: " << stanza->Str(); | 50 VLOG(1) << "Dropping IQ packet with no request id: " << stanza->Str(); |
| 51 } else { | 51 } else { |
| 52 // TODO(ajwong): We should look at the logic inside libjingle's | 52 // TODO(ajwong): We should look at the logic inside libjingle's |
| 53 // XmppTask::MatchResponseIq() and make sure we're fully in sync. | 53 // XmppTask::MatchResponseIq() and make sure we're fully in sync. |
| 54 // They check more fields and conditions than us. | 54 // They check more fields and conditions than us. |
| 55 | 55 |
| 56 // TODO(ajwong): This logic is weird. We add to the register in | 56 // TODO(ajwong): This logic is weird. We add to the register in |
| 57 // JavascriptIqRequest::SendIq(), but remove in | 57 // JavascriptIqRequest::SendIq(), but remove in |
| 58 // JavascriptIqRegistry::OnIq(). We should try to keep the | 58 // JavascriptIqRegistry::OnIq(). We should try to keep the |
| 59 // registration/deregistration in one spot. | 59 // registration/deregistration in one spot. |
| 60 if (it->second->callback_.is_null()) { | 60 if (!it->second->callback_.is_null()) { |
| 61 it->second->callback_.Run(stanza); | 61 it->second->callback_.Run(stanza); |
| 62 it->second->callback_.Reset(); | 62 it->second->callback_.Reset(); |
| 63 } else { | 63 } else { |
| 64 VLOG(1) << "No callback, so dropping: " << stanza->Str(); | 64 VLOG(1) << "No callback, so dropping: " << stanza->Str(); |
| 65 } | 65 } |
| 66 requests_.erase(it); | 66 requests_.erase(it); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 void JavascriptIqRegistry::RegisterRequest( | 70 void JavascriptIqRegistry::RegisterRequest( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 89 std::string id = signal_strategy_->GetNextId(); | 89 std::string id = signal_strategy_->GetNextId(); |
| 90 registry_->RegisterRequest(this, id); | 90 registry_->RegisterRequest(this, id); |
| 91 signal_strategy_->SendStanza(MakeIqStanza(type, addressee, iq_body, id)); | 91 signal_strategy_->SendStanza(MakeIqStanza(type, addressee, iq_body, id)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void JavascriptIqRequest::set_callback(const ReplyCallback& callback) { | 94 void JavascriptIqRequest::set_callback(const ReplyCallback& callback) { |
| 95 callback_ = callback; | 95 callback_ = callback; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace remoting | 98 } // namespace remoting |
| OLD | NEW |