| 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..710dae26ff998711708f98bbc66c1bf2792152ba 100644
|
| --- a/remoting/host/it2me/it2me_native_messaging_host.h
|
| +++ b/remoting/host/it2me/it2me_native_messaging_host.h
|
| @@ -8,32 +8,30 @@
|
| #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,
|
| + int port_id,
|
| + base::WeakPtr<Client> client,
|
| + 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.
|
| + virtual void Send(const std::string& json) OVERRIDE;
|
|
|
| // It2MeHost::Observer implementation.
|
| virtual void OnClientAuthenticated(const std::string& client_username)
|
| @@ -49,6 +47,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 +56,15 @@ 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_;
|
| + // The remote port on the chrome messaging service. This is only used in
|
| + // ChromeOS.
|
| + int port_id_;
|
| +
|
| + base::WeakPtr<Client> client_;
|
| scoped_ptr<It2MeHostFactory> factory_;
|
| scoped_ptr<ChromotingHostContext> host_context_;
|
| scoped_refptr<It2MeHost> it2me_host_;
|
|
|