| 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 <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "remoting/base/rsa_key_pair.h" | 14 #include "remoting/base/rsa_key_pair.h" |
| 15 #include "remoting/signaling/signal_strategy.h" | 15 #include "remoting/signaling/signal_strategy.h" |
| 16 #include "testing/gtest/include/gtest/gtest_prod.h" | 16 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 17 | 17 |
| 18 namespace buzz { | 18 namespace buzz { |
| 19 class XmlElement; | 19 class XmlElement; |
| 20 } // namespace buzz | 20 } // namespace buzz |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class TimeDelta; | 23 class TimeDelta; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 54 const RegisterCallback& callback); | 54 const RegisterCallback& callback); |
| 55 ~RegisterSupportHostRequest() override; | 55 ~RegisterSupportHostRequest() override; |
| 56 | 56 |
| 57 // HostStatusObserver implementation. | 57 // HostStatusObserver implementation. |
| 58 void OnSignalStrategyStateChange(SignalStrategy::State state) override; | 58 void OnSignalStrategyStateChange(SignalStrategy::State state) override; |
| 59 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; | 59 bool OnSignalStrategyIncomingStanza(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 std::unique_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 std::unique_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 void ParseResponse(const buzz::XmlElement* response, | 69 void ParseResponse(const buzz::XmlElement* response, |
| 70 std::string* support_id, base::TimeDelta* lifetime, | 70 std::string* support_id, base::TimeDelta* lifetime, |
| 71 std::string* error_message); | 71 std::string* error_message); |
| 72 | 72 |
| 73 void CallCallback( | 73 void CallCallback( |
| 74 const std::string& support_id, base::TimeDelta lifetime, | 74 const std::string& support_id, base::TimeDelta lifetime, |
| 75 const std::string& error_message); | 75 const std::string& error_message); |
| 76 | 76 |
| 77 SignalStrategy* signal_strategy_; | 77 SignalStrategy* signal_strategy_; |
| 78 scoped_refptr<RsaKeyPair> key_pair_; | 78 scoped_refptr<RsaKeyPair> key_pair_; |
| 79 std::string directory_bot_jid_; | 79 std::string directory_bot_jid_; |
| 80 RegisterCallback callback_; | 80 RegisterCallback callback_; |
| 81 | 81 |
| 82 scoped_ptr<IqSender> iq_sender_; | 82 std::unique_ptr<IqSender> iq_sender_; |
| 83 scoped_ptr<IqRequest> request_; | 83 std::unique_ptr<IqRequest> request_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); | 85 DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace remoting | 88 } // namespace remoting |
| 89 | 89 |
| 90 #endif // REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ | 90 #endif // REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_ |
| OLD | NEW |