Chromium Code Reviews| Index: remoting/host/it2me/it2me_native_messaging_host.h |
| diff --git a/remoting/host/it2me/it2me_native_messaging_host.h b/remoting/host/it2me/it2me_native_messaging_host.h |
| index f9d8ac9753f97230cf674ddf86c340bf07972431..5c3e920232c3c0bbdbe156fe326ac93ab8cbb99b 100644 |
| --- a/remoting/host/it2me/it2me_native_messaging_host.h |
| +++ b/remoting/host/it2me/it2me_native_messaging_host.h |
| @@ -8,32 +8,29 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| -#include "extensions/browser/api/messaging/native_messaging_channel.h" |
| +#include "extensions/browser/api/messaging/native_message_host.h" |
| #include "remoting/base/auto_thread_task_runner.h" |
| #include "remoting/host/it2me/it2me_host.h" |
| namespace base { |
| class DictionaryValue; |
| +class Value; |
| } // namespace base |
| namespace remoting { |
| // Implementation of the native messaging host process. |
| -class It2MeNativeMessagingHost |
| - : public It2MeHost::Observer, |
| - public extensions::NativeMessagingChannel::EventHandler { |
| +class It2MeNativeMessagingHost : public It2MeHost::Observer, |
| + public extensions::NativeMessageHost { |
| public: |
| - It2MeNativeMessagingHost( |
| - scoped_refptr<AutoThreadTaskRunner> task_runner, |
| - scoped_ptr<extensions::NativeMessagingChannel> channel, |
| - scoped_ptr<It2MeHostFactory> factory); |
| + It2MeNativeMessagingHost(scoped_refptr<AutoThreadTaskRunner> task_runner, |
| + scoped_ptr<It2MeHostFactory> factory); |
| virtual ~It2MeNativeMessagingHost(); |
| - void Start(const base::Closure& quit_closure); |
| - |
| - // extensions::NativeMessagingChannel::EventHandler implementation. |
| - virtual void OnMessage(scoped_ptr<base::Value> message) OVERRIDE; |
| - virtual void OnDisconnect() OVERRIDE; |
| + // extensions::NativeMessageHost implementation. |
| + // Called when a message is received from the client. |
|
Sergey Ulanov
2014/09/27 00:24:10
This comment wouldn't be necessary if you rename S
kelvinp
2014/09/29 22:59:40
Done.
|
| + virtual void Send(const std::string& json) OVERRIDE; |
| + virtual void set_client(base::WeakPtr<Client> client) OVERRIDE; |
| // It2MeHost::Observer implementation. |
| virtual void OnClientAuthenticated(const std::string& client_username) |
| @@ -49,6 +46,7 @@ class It2MeNativeMessagingHost |
| // These "Process.." methods handle specific request types. The |response| |
| // dictionary is pre-filled by ProcessMessage() with the parts of the |
| // response already known ("id" and "type" fields). |
| + void OnMessageFromClient(scoped_ptr<base::Value> message); |
| void ProcessHello(const base::DictionaryValue& message, |
| scoped_ptr<base::DictionaryValue> response) const; |
| void ProcessConnect(const base::DictionaryValue& message, |
| @@ -57,12 +55,11 @@ class It2MeNativeMessagingHost |
| scoped_ptr<base::DictionaryValue> response); |
| void SendErrorAndExit(scoped_ptr<base::DictionaryValue> response, |
| const std::string& description) const; |
| - |
| - base::Closure quit_closure_; |
| + void SendMessageToClient(scoped_ptr<base::DictionaryValue> message) const; |
| scoped_refptr<AutoThreadTaskRunner> task_runner() const; |
| - scoped_ptr<extensions::NativeMessagingChannel> channel_; |
| + base::WeakPtr<Client> client_; |
| scoped_ptr<It2MeHostFactory> factory_; |
| scoped_ptr<ChromotingHostContext> host_context_; |
| scoped_refptr<It2MeHost> it2me_host_; |