| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // TODO(sergeyu): This class should have timeout for the bot | 47 // TODO(sergeyu): This class should have timeout for the bot |
| 48 // response. | 48 // response. |
| 49 RegisterSupportHostRequest(SignalStrategy* signal_strategy, | 49 RegisterSupportHostRequest(SignalStrategy* signal_strategy, |
| 50 scoped_refptr<RsaKeyPair> key_pair, | 50 scoped_refptr<RsaKeyPair> key_pair, |
| 51 const std::string& directory_bot_jid, | 51 const std::string& directory_bot_jid, |
| 52 const RegisterCallback& callback); | 52 const RegisterCallback& callback); |
| 53 virtual ~RegisterSupportHostRequest(); | 53 virtual ~RegisterSupportHostRequest(); |
| 54 | 54 |
| 55 // HostStatusObserver implementation. | 55 // HostStatusObserver implementation. |
| 56 virtual void OnSignalStrategyStateChange( | 56 virtual void OnSignalStrategyStateChange( |
| 57 SignalStrategy::State state) OVERRIDE; | 57 SignalStrategy::State state) override; |
| 58 virtual bool OnSignalStrategyIncomingStanza( | 58 virtual bool OnSignalStrategyIncomingStanza( |
| 59 const buzz::XmlElement* stanza) OVERRIDE; | 59 const buzz::XmlElement* stanza) override; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 void DoSend(); | 62 void DoSend(); |
| 63 | 63 |
| 64 scoped_ptr<buzz::XmlElement> CreateRegistrationRequest( | 64 scoped_ptr<buzz::XmlElement> CreateRegistrationRequest( |
| 65 const std::string& jid); | 65 const std::string& jid); |
| 66 scoped_ptr<buzz::XmlElement> CreateSignature(const std::string& jid); | 66 scoped_ptr<buzz::XmlElement> CreateSignature(const std::string& jid); |
| 67 | 67 |
| 68 void ProcessResponse(IqRequest* request, const buzz::XmlElement* response); | 68 void ProcessResponse(IqRequest* request, const buzz::XmlElement* response); |
| 69 bool ParseResponse(const buzz::XmlElement* response, | 69 bool ParseResponse(const buzz::XmlElement* response, |
| 70 std::string* support_id, base::TimeDelta* lifetime); | 70 std::string* support_id, base::TimeDelta* lifetime); |
| 71 | 71 |
| 72 void CallCallback( | 72 void CallCallback( |
| 73 bool success, const std::string& support_id, base::TimeDelta lifetime); | 73 bool success, const std::string& support_id, base::TimeDelta lifetime); |
| 74 | 74 |
| 75 SignalStrategy* signal_strategy_; | 75 SignalStrategy* signal_strategy_; |
| 76 scoped_refptr<RsaKeyPair> key_pair_; | 76 scoped_refptr<RsaKeyPair> key_pair_; |
| 77 std::string directory_bot_jid_; | 77 std::string directory_bot_jid_; |
| 78 RegisterCallback callback_; | 78 RegisterCallback callback_; |
| 79 | 79 |
| 80 scoped_ptr<IqSender> iq_sender_; | 80 scoped_ptr<IqSender> iq_sender_; |
| 81 scoped_ptr<IqRequest> request_; | 81 scoped_ptr<IqRequest> request_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); | 83 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace remoting | 86 } // namespace remoting |
| 87 | 87 |
| 88 #endif // REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ | 88 #endif // REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ |
| OLD | NEW |