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

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, 1 month 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 338513d2e2e05535c3217dcd84f5c2f375d3dd8f..5974675de7c512ad40d6797386a80c1a04f7cd54 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,11 @@ 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(
+ buzz::STR_SET, kChromotingBotJid, CreateRegistrationRequest(jid),
+ base::Bind(&RegisterSupportHostRequest::ProcessResponse,
+ base::Unretained(this))));
}
void RegisterSupportHostRequest::OnSignallingDisconnected() {
@@ -78,6 +77,7 @@ void RegisterSupportHostRequest::OnSignallingDisconnected() {
}
DCHECK_EQ(message_loop_, MessageLoop::current());
request_.reset();
+ iq_sender_.reset();
}
// Ignore any notifications other than signalling
@@ -129,7 +129,10 @@ bool RegisterSupportHostRequest::ParseResponse(const XmlElement* response,
}
// This method must only be called for error or result stanzas.
- DCHECK_EQ(std::string(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