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

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

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 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 #ifndef REMOTING_HOST_SUPPORT_HOST_REGISTER_QUERY_H_ 5 #ifndef REMOTING_HOST_SUPPORT_HOST_REGISTER_QUERY_H_
6 #define REMOTING_HOST_SUPPORT_HOST_REGISTER_QUERY_H_ 6 #define REMOTING_HOST_SUPPORT_HOST_REGISTER_QUERY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/host/host_key_pair.h" 13 #include "remoting/host/host_key_pair.h"
14 #include "remoting/host/host_status_observer.h" 14 #include "remoting/host/host_status_observer.h"
15 #include "testing/gtest/include/gtest/gtest_prod.h" 15 #include "testing/gtest/include/gtest/gtest_prod.h"
16 16
17 class MessageLoop; 17 class MessageLoop;
18 18
19 namespace buzz { 19 namespace buzz {
20 class XmlElement; 20 class XmlElement;
21 } // namespace buzz 21 } // namespace buzz
22 22
23 namespace base { 23 namespace base {
24 class TimeDelta; 24 class TimeDelta;
25 } // namespace base 25 } // namespace base
26 26
27 namespace remoting { 27 namespace remoting {
28 28
29 class IqRequest; 29 class IqRequest;
30 class IqSender;
30 class MutableHostConfig; 31 class MutableHostConfig;
31 32
32 // RegisterSupportHostRequest sends support host registeration request 33 // RegisterSupportHostRequest sends support host registeration request
33 // to the Chromoting Bot. It listens to the status of the host using 34 // to the Chromoting Bot. It listens to the status of the host using
34 // HostStatusObserver interface and sends the request when signalling 35 // HostStatusObserver interface and sends the request when signalling
35 // channel is connected. When a response is received from the bot, it 36 // channel is connected. When a response is received from the bot, it
36 // calls the callback specified in the Init() method. 37 // calls the callback specified in the Init() method.
37 class RegisterSupportHostRequest : public HostStatusObserver { 38 class RegisterSupportHostRequest : public HostStatusObserver {
38 public: 39 public:
39 // First parameter is set to true on success. Second parameter is 40 // First parameter is set to true on success. Second parameter is
(...skipping 30 matching lines...) Expand all
70 // Caller owns the result. 71 // Caller owns the result.
71 buzz::XmlElement* CreateRegistrationRequest(const std::string& jid); 72 buzz::XmlElement* CreateRegistrationRequest(const std::string& jid);
72 buzz::XmlElement* CreateSignature(const std::string& jid); 73 buzz::XmlElement* CreateSignature(const std::string& jid);
73 74
74 void ProcessResponse(const buzz::XmlElement* response); 75 void ProcessResponse(const buzz::XmlElement* response);
75 bool ParseResponse(const buzz::XmlElement* response, 76 bool ParseResponse(const buzz::XmlElement* response,
76 std::string* support_id, base::TimeDelta* lifetime); 77 std::string* support_id, base::TimeDelta* lifetime);
77 78
78 MessageLoop* message_loop_; 79 MessageLoop* message_loop_;
79 RegisterCallback callback_; 80 RegisterCallback callback_;
81 scoped_ptr<IqSender> iq_sender_;
80 scoped_ptr<IqRequest> request_; 82 scoped_ptr<IqRequest> request_;
81 HostKeyPair key_pair_; 83 HostKeyPair key_pair_;
82 84
83 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); 85 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest);
84 }; 86 };
85 87
86 } // namespace remoting 88 } // namespace remoting
87 89
88 #endif // REMOTING_HOST_SUPPORT_HOST_REGISTER_QUERY_H_ 90 #endif // REMOTING_HOST_SUPPORT_HOST_REGISTER_QUERY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698