| 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_REGISTER_SUPPORT_HOST_REQUEST_H_ | 5 #ifndef REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ |
| 6 #define REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ | 6 #define REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // callback to invoke when a registration response is received. | 49 // callback to invoke when a registration response is received. |
| 50 // |callback| is called when registration response is received from | 50 // |callback| is called when registration response is received from |
| 51 // the server. Ownership of |callback| is given to the request | 51 // the server. Ownership of |callback| is given to the request |
| 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) OVERRIDE; |
| 60 const std::string& full_jid) OVERRIDE; | |
| 61 virtual void OnSignallingDisconnected() OVERRIDE; | 60 virtual void OnSignallingDisconnected() OVERRIDE; |
| 62 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 61 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
| 63 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 62 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
| 64 virtual void OnAccessDenied() OVERRIDE; | 63 virtual void OnAccessDenied() OVERRIDE; |
| 65 virtual void OnShutdown() OVERRIDE; | 64 virtual void OnShutdown() OVERRIDE; |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 void DoSend(); | 67 void DoSend(); |
| 69 | 68 |
| 70 // Caller owns the result. | 69 // Caller owns the result. |
| 71 buzz::XmlElement* CreateRegistrationRequest(const std::string& jid); | 70 buzz::XmlElement* CreateRegistrationRequest(const std::string& jid); |
| 72 buzz::XmlElement* CreateSignature(const std::string& jid); | 71 buzz::XmlElement* CreateSignature(const std::string& jid); |
| 73 | 72 |
| 74 void ProcessResponse(const buzz::XmlElement* response); | 73 void ProcessResponse(const buzz::XmlElement* response); |
| 75 bool ParseResponse(const buzz::XmlElement* response, | 74 bool ParseResponse(const buzz::XmlElement* response, |
| 76 std::string* support_id, base::TimeDelta* lifetime); | 75 std::string* support_id, base::TimeDelta* lifetime); |
| 77 | 76 |
| 78 MessageLoop* message_loop_; | 77 MessageLoop* message_loop_; |
| 79 RegisterCallback callback_; | 78 RegisterCallback callback_; |
| 80 scoped_ptr<IqSender> iq_sender_; | 79 scoped_ptr<IqSender> iq_sender_; |
| 81 scoped_ptr<IqRequest> request_; | 80 scoped_ptr<IqRequest> request_; |
| 82 HostKeyPair key_pair_; | 81 HostKeyPair key_pair_; |
| 83 | 82 |
| 84 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); | 83 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); |
| 85 }; | 84 }; |
| 86 | 85 |
| 87 } // namespace remoting | 86 } // namespace remoting |
| 88 | 87 |
| 89 #endif // REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ | 88 #endif // REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ |
| OLD | NEW |