Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(620)

Side by Side Diff: remoting/host/register_support_host_request.h

Issue 12316083: Move HostKeyPair into protocol::KeyPair. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add missing files, move TestKeyPair. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/jingle_glue/signal_strategy.h" 13 #include "remoting/jingle_glue/signal_strategy.h"
14 #include "remoting/host/host_key_pair.h" 14 #include "remoting/protocol/key_pair.h"
15 #include "testing/gtest/include/gtest/gtest_prod.h" 15 #include "testing/gtest/include/gtest/gtest_prod.h"
16 16
17 class MessageLoop; 17 class MessageLoop;
18 18
19 namespace buzz { 19 namespace buzz {
20 class XmlElement; 20 class XmlElement;
21 } // namespace buzz 21 } // namespace buzz
22 22
23 namespace base { 23 namespace base {
24 class TimeDelta; 24 class TimeDelta;
(...skipping 17 matching lines...) Expand all
42 const base::TimeDelta&)> RegisterCallback; 42 const base::TimeDelta&)> RegisterCallback;
43 43
44 // |signal_strategy| and |key_pair| must outlive this 44 // |signal_strategy| and |key_pair| must outlive this
45 // object. |callback| is called when registration response is 45 // object. |callback| is called when registration response is
46 // received from the server. Callback is never called if the bot 46 // received from the server. Callback is never called if the bot
47 // malfunctions and doesn't respond to the request. 47 // malfunctions and doesn't respond to the request.
48 // 48 //
49 // TODO(sergeyu): This class should have timeout for the bot 49 // TODO(sergeyu): This class should have timeout for the bot
50 // response. 50 // response.
51 RegisterSupportHostRequest(SignalStrategy* signal_strategy, 51 RegisterSupportHostRequest(SignalStrategy* signal_strategy,
52 HostKeyPair* key_pair, 52 protocol::KeyPair* key_pair,
Wez 2013/02/23 03:43:20 Now that we can copy, use scoped_ptr<> here?
rmsousa 2013/02/26 02:38:52 Done.
53 const std::string& directory_bot_jid, 53 const std::string& directory_bot_jid,
54 const RegisterCallback& callback); 54 const RegisterCallback& callback);
55 virtual ~RegisterSupportHostRequest(); 55 virtual ~RegisterSupportHostRequest();
56 56
57 // HostStatusObserver implementation. 57 // HostStatusObserver implementation.
58 virtual void OnSignalStrategyStateChange( 58 virtual void OnSignalStrategyStateChange(
59 SignalStrategy::State state) OVERRIDE; 59 SignalStrategy::State state) OVERRIDE;
60 virtual bool OnSignalStrategyIncomingStanza( 60 virtual bool OnSignalStrategyIncomingStanza(
61 const buzz::XmlElement* stanza) OVERRIDE; 61 const buzz::XmlElement* stanza) OVERRIDE;
62 62
63 private: 63 private:
64 void DoSend(); 64 void DoSend();
65 65
66 scoped_ptr<buzz::XmlElement> CreateRegistrationRequest( 66 scoped_ptr<buzz::XmlElement> CreateRegistrationRequest(
67 const std::string& jid); 67 const std::string& jid);
68 scoped_ptr<buzz::XmlElement> CreateSignature(const std::string& jid); 68 scoped_ptr<buzz::XmlElement> CreateSignature(const std::string& jid);
69 69
70 void ProcessResponse(IqRequest* request, const buzz::XmlElement* response); 70 void ProcessResponse(IqRequest* request, const buzz::XmlElement* response);
71 bool ParseResponse(const buzz::XmlElement* response, 71 bool ParseResponse(const buzz::XmlElement* response,
72 std::string* support_id, base::TimeDelta* lifetime); 72 std::string* support_id, base::TimeDelta* lifetime);
73 73
74 void CallCallback( 74 void CallCallback(
75 bool success, const std::string& support_id, base::TimeDelta lifetime); 75 bool success, const std::string& support_id, base::TimeDelta lifetime);
76 76
77 SignalStrategy* signal_strategy_; 77 SignalStrategy* signal_strategy_;
78 HostKeyPair* key_pair_; 78 protocol::KeyPair* 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 scoped_ptr<IqSender> iq_sender_;
83 scoped_ptr<IqRequest> request_; 83 scoped_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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698