Chromium Code Reviews| Index: remoting/host/register_support_host_request.h |
| diff --git a/remoting/host/register_support_host_request.h b/remoting/host/register_support_host_request.h |
| index 84dab325184d2543cde9b5ff1d3b1143f4fbd61c..f525a8c46fd2dccb39137f81bcd29d5e58e00ca3 100644 |
| --- a/remoting/host/register_support_host_request.h |
| +++ b/remoting/host/register_support_host_request.h |
| @@ -10,8 +10,8 @@ |
| #include "base/callback.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "remoting/jingle_glue/signal_strategy.h" |
| #include "remoting/host/host_key_pair.h" |
| -#include "remoting/host/host_status_observer.h" |
| #include "testing/gtest/include/gtest/gtest_prod.h" |
| class MessageLoop; |
| @@ -30,11 +30,11 @@ class IqRequest; |
| class IqSender; |
| // RegisterSupportHostRequest sends support host registeration request |
| -// to the Chromoting Bot. It listens to the status of the host using |
| -// HostStatusObserver interface and sends the request when signalling |
| -// channel is connected. When a response is received from the bot, it |
| -// calls the callback specified in the Init() method. |
| -class RegisterSupportHostRequest : public HostStatusObserver { |
| +// to the Chromoting Bot. It listens to signalling channel status and |
| +// sends the request when signalling channel is connected. When a |
|
Wez
2012/01/03 16:25:04
nit: ... sends a request to register the host for
Sergey Ulanov
2012/01/03 21:51:02
Done.
|
| +// response is received from the bot, it calls the callback specified |
| +// in the Init() method. |
| +class RegisterSupportHostRequest : public SignalStrategy::Listener { |
| public: |
| // First parameter is set to true on success. Second parameter is |
| // the new SessionID received from the bot. Third parameter is the |
| @@ -48,20 +48,18 @@ class RegisterSupportHostRequest : public HostStatusObserver { |
| // Provide the configuration to use to register the host, and a |
|
Wez
2012/01/03 16:25:04
nit: Initializes the registration to use a supplie
Sergey Ulanov
2012/01/03 21:51:02
Done.
|
| // callback to invoke when a registration response is received. |
| // |callback| is called when registration response is received from |
| - // the server. Ownership of |callback| is given to the request |
| - // object. Caller must ensure that the callback object is valid |
| - // while signalling connection exists. Returns false on falure |
| - // (e.g. config is invalid). Callback is never called if the bot |
| - // malfunctions and doesn't respond to the request. |
| - bool Init(HostConfig* config, const RegisterCallback& callback); |
| + // the server. Returns false on falure (e.g. config is |
| + // invalid). Callback is never called if the bot malfunctions and |
|
Wez
2012/01/03 16:25:04
nit: Would it simplify the interface to notify the
Sergey Ulanov
2012/01/03 21:51:02
Having result here is useful to detect config erro
|
| + // doesn't respond to the request. |
|
Wez
2012/01/03 16:25:04
If the caller is responsible for implementing a se
Sergey Ulanov
2012/01/03 21:51:02
Normally GTalk would reply with an error when the
|
| + bool Init(SignalStrategy* signal_strategy_, |
| + HostConfig* config, |
| + const RegisterCallback& callback); |
| // HostStatusObserver implementation. |
| - virtual void OnSignallingConnected(SignalStrategy* signal_strategy) OVERRIDE; |
| - virtual void OnSignallingDisconnected() OVERRIDE; |
| - virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
| - virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
| - virtual void OnAccessDenied() OVERRIDE; |
| - virtual void OnShutdown() OVERRIDE; |
| + virtual void OnSignalStrategyStateChange( |
| + SignalStrategy::State state) OVERRIDE; |
| + virtual bool OnSignalStrategyIncomingStanza( |
| + const buzz::XmlElement* stanza) OVERRIDE; |
| private: |
| void DoSend(); |
| @@ -74,7 +72,7 @@ class RegisterSupportHostRequest : public HostStatusObserver { |
| bool ParseResponse(const buzz::XmlElement* response, |
| std::string* support_id, base::TimeDelta* lifetime); |
| - MessageLoop* message_loop_; |
| + SignalStrategy* signal_strategy_; |
| RegisterCallback callback_; |
| scoped_ptr<IqSender> iq_sender_; |
| scoped_ptr<IqRequest> request_; |