OLD | NEW |
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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // object. Caller must ensure that the callback object is valid | 52 // object. Caller must ensure that the callback object is valid |
53 // while signalling connection exists. Returns false on falure | 53 // while signalling connection exists. Returns false on falure |
54 // (e.g. config is invalid). Callback is never called if the bot | 54 // (e.g. config is invalid). Callback is never called if the bot |
55 // malfunctions and doesn't respond to the request. | 55 // malfunctions and doesn't respond to the request. |
56 bool Init(HostConfig* config, const RegisterCallback& callback); | 56 bool Init(HostConfig* config, const RegisterCallback& callback); |
57 | 57 |
58 // HostStatusObserver implementation. | 58 // HostStatusObserver implementation. |
59 virtual void OnSignallingConnected(SignalStrategy* signal_strategy, | 59 virtual void OnSignallingConnected(SignalStrategy* signal_strategy, |
60 const std::string& full_jid) OVERRIDE; | 60 const std::string& full_jid) OVERRIDE; |
61 virtual void OnSignallingDisconnected() OVERRIDE; | 61 virtual void OnSignallingDisconnected() OVERRIDE; |
62 virtual void OnClientAuthenticated( | 62 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
63 remoting::protocol::ConnectionToClient* client) OVERRIDE; | 63 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
64 virtual void OnClientDisconnected( | |
65 remoting::protocol::ConnectionToClient* client) OVERRIDE; | |
66 virtual void OnAccessDenied() OVERRIDE; | 64 virtual void OnAccessDenied() OVERRIDE; |
67 virtual void OnShutdown() OVERRIDE; | 65 virtual void OnShutdown() OVERRIDE; |
68 | 66 |
69 private: | 67 private: |
70 void DoSend(); | 68 void DoSend(); |
71 | 69 |
72 // Caller owns the result. | 70 // Caller owns the result. |
73 buzz::XmlElement* CreateRegistrationRequest(const std::string& jid); | 71 buzz::XmlElement* CreateRegistrationRequest(const std::string& jid); |
74 buzz::XmlElement* CreateSignature(const std::string& jid); | 72 buzz::XmlElement* CreateSignature(const std::string& jid); |
75 | 73 |
76 void ProcessResponse(const buzz::XmlElement* response); | 74 void ProcessResponse(const buzz::XmlElement* response); |
77 bool ParseResponse(const buzz::XmlElement* response, | 75 bool ParseResponse(const buzz::XmlElement* response, |
78 std::string* support_id, base::TimeDelta* lifetime); | 76 std::string* support_id, base::TimeDelta* lifetime); |
79 | 77 |
80 MessageLoop* message_loop_; | 78 MessageLoop* message_loop_; |
81 RegisterCallback callback_; | 79 RegisterCallback callback_; |
82 scoped_ptr<IqRequest> request_; | 80 scoped_ptr<IqRequest> request_; |
83 HostKeyPair key_pair_; | 81 HostKeyPair key_pair_; |
84 | 82 |
85 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); | 83 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); |
86 }; | 84 }; |
87 | 85 |
88 } // namespace remoting | 86 } // namespace remoting |
89 | 87 |
90 #endif // REMOTING_HOST_SUPPORT_HOST_REGISTER_QUERY_H_ | 88 #endif // REMOTING_HOST_SUPPORT_HOST_REGISTER_QUERY_H_ |
OLD | NEW |