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