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

Unified Diff: remoting/host/register_support_host_request.cc

Issue 8432009: Refactor IqRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/register_support_host_request.cc
diff --git a/remoting/host/register_support_host_request.cc b/remoting/host/register_support_host_request.cc
index d9e2166c3fb23b6f1a11d280a7c647dd43666847..6da2efb4f30ac5230f707da0f38bb494f3050737 100644
--- a/remoting/host/register_support_host_request.cc
+++ b/remoting/host/register_support_host_request.cc
@@ -11,7 +11,7 @@
#include "base/time.h"
#include "remoting/base/constants.h"
#include "remoting/host/host_config.h"
-#include "remoting/jingle_glue/iq_request.h"
+#include "remoting/jingle_glue/iq_sender.h"
#include "remoting/jingle_glue/jingle_thread.h"
#include "remoting/jingle_glue/signal_strategy.h"
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
@@ -59,12 +59,12 @@ void RegisterSupportHostRequest::OnSignallingConnected(
message_loop_ = MessageLoop::current();
- request_.reset(signal_strategy->CreateIqRequest());
- request_->set_callback(base::Bind(
- &RegisterSupportHostRequest::ProcessResponse, base::Unretained(this)));
-
- request_->SendIq(IqRequest::MakeIqStanza(
- buzz::STR_SET, kChromotingBotJid, CreateRegistrationRequest(jid)));
+ iq_sender_.reset(new IqSender(signal_strategy));
+ request_.reset(iq_sender_->SendIq(
+ IqSender::MakeIqStanza(buzz::STR_SET, kChromotingBotJid,
+ CreateRegistrationRequest(jid)),
+ base::Bind(&RegisterSupportHostRequest::ProcessResponse,
+ base::Unretained(this))));
}
void RegisterSupportHostRequest::OnSignallingDisconnected() {
@@ -78,6 +78,7 @@ void RegisterSupportHostRequest::OnSignallingDisconnected() {
}
DCHECK_EQ(message_loop_, MessageLoop::current());
request_.reset();
+ iq_sender_.reset();
}
// Ignore any notifications other than signalling
@@ -129,7 +130,10 @@ bool RegisterSupportHostRequest::ParseResponse(const XmlElement* response,
}
// This method must only be called for error or result stanzas.
- DCHECK_EQ(buzz::STR_RESULT, type);
+ if (type != buzz::STR_RESULT) {
+ LOG(ERROR) << "Received unexpect stanza of type \"" << type << "\"";
+ return false;
+ }
const XmlElement* result_element = response->FirstNamed(QName(
kChromotingXmlNamespace, kRegisterQueryResultTag));

Powered by Google App Engine
This is Rietveld 408576698