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

Side by Side Diff: remoting/jingle_glue/javascript_iq_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/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
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
OLDNEW
« no previous file with comments | « remoting/jingle_glue/javascript_iq_request.h ('k') | remoting/jingle_glue/jingle_info_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698