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

Side by Side Diff: remoting/host/register_support_host_request.cc

Issue 7809003: Simplify IqRequest interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
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/host/register_support_host_request.h" 5 #include "remoting/host/register_support_host_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SignalStrategy* signal_strategy, 56 SignalStrategy* signal_strategy,
57 const std::string& jid) { 57 const std::string& jid) {
58 DCHECK(!callback_.is_null()); 58 DCHECK(!callback_.is_null());
59 59
60 message_loop_ = MessageLoop::current(); 60 message_loop_ = MessageLoop::current();
61 61
62 request_.reset(signal_strategy->CreateIqRequest()); 62 request_.reset(signal_strategy->CreateIqRequest());
63 request_->set_callback(base::Bind( 63 request_->set_callback(base::Bind(
64 &RegisterSupportHostRequest::ProcessResponse, base::Unretained(this))); 64 &RegisterSupportHostRequest::ProcessResponse, base::Unretained(this)));
65 65
66 request_->SendIq(buzz::STR_SET, kChromotingBotJid, 66 request_->SendIq(IqRequest::MakeIqStanza(
67 CreateRegistrationRequest(jid)); 67 buzz::STR_SET, kChromotingBotJid, CreateRegistrationRequest(jid)));
68 } 68 }
69 69
70 void RegisterSupportHostRequest::OnSignallingDisconnected() { 70 void RegisterSupportHostRequest::OnSignallingDisconnected() {
71 if (!message_loop_) { 71 if (!message_loop_) {
72 // We will reach here with |message_loop_| NULL if the Host's 72 // We will reach here with |message_loop_| NULL if the Host's
73 // XMPP connection attempt fails. 73 // XMPP connection attempt fails.
74 CHECK(!callback_.is_null()); 74 CHECK(!callback_.is_null());
75 DCHECK(!request_.get()); 75 DCHECK(!request_.get());
76 callback_.Run(false, std::string(), base::TimeDelta()); 76 callback_.Run(false, std::string(), base::TimeDelta());
77 return; 77 return;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 void RegisterSupportHostRequest::ProcessResponse(const XmlElement* response) { 177 void RegisterSupportHostRequest::ProcessResponse(const XmlElement* response) {
178 DCHECK_EQ(message_loop_, MessageLoop::current()); 178 DCHECK_EQ(message_loop_, MessageLoop::current());
179 std::string support_id; 179 std::string support_id;
180 base::TimeDelta lifetime; 180 base::TimeDelta lifetime;
181 bool success = ParseResponse(response, &support_id, &lifetime); 181 bool success = ParseResponse(response, &support_id, &lifetime);
182 callback_.Run(success, support_id, lifetime); 182 callback_.Run(success, support_id, lifetime);
183 } 183 }
184 184
185 } // namespace remoting 185 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/heartbeat_sender_unittest.cc ('k') | remoting/host/register_support_host_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698