| Index: remoting/host/native_messaging/pipe_messaging_channel.h
|
| diff --git a/remoting/host/native_messaging/native_messaging_channel.h b/remoting/host/native_messaging/pipe_messaging_channel.h
|
| similarity index 52%
|
| rename from remoting/host/native_messaging/native_messaging_channel.h
|
| rename to remoting/host/native_messaging/pipe_messaging_channel.h
|
| index 926f547692e37c257f6e44aacea6ed8775377551..4a6f6e1cd7285e68ad5a471dd89675dd42bbaca0 100644
|
| --- a/remoting/host/native_messaging/native_messaging_channel.h
|
| +++ b/remoting/host/native_messaging/pipe_messaging_channel.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
|
| -#define REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
|
| +#ifndef REMOTING_HOST_NATIVE_MESSAGING_PIPE_MESSAGING_CHANNEL_H_
|
| +#define REMOTING_HOST_NATIVE_MESSAGING_PIPE_MESSAGING_CHANNEL_H_
|
|
|
| #include "base/callback.h"
|
| #include "base/files/file.h"
|
| @@ -11,6 +11,8 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/threading/non_thread_safe.h"
|
| +#include "chrome/browser/extensions/api/messaging/native_messaging_channel.h"
|
| +
|
| #include "remoting/host/native_messaging/native_messaging_reader.h"
|
| #include "remoting/host/native_messaging/native_messaging_writer.h"
|
|
|
| @@ -21,25 +23,25 @@ class Value;
|
|
|
| namespace remoting {
|
|
|
| -// Implements reading messages and sending responses across the native messaging
|
| -// host pipe.
|
| -class NativeMessagingChannel : public base::NonThreadSafe {
|
| +// An implementation of |extensions::NativeMessagingChannel| using a pipe. It
|
| +// is used by the |It2MeNativeMessagingHost| and |Me2MeNativeMessagingHost| to
|
| +// communicate with the chrome process.
|
| +class PipeMessagingChannel :
|
| + public extensions::NativeMessagingChannel,
|
| + public base::NonThreadSafe {
|
| public:
|
| - // Used to send a message to the client app.
|
| - typedef base::Callback<void(scoped_ptr<base::DictionaryValue> message)>
|
| + typedef extensions::NativeMessagingChannel::SendMessageCallback
|
| SendMessageCallback;
|
|
|
| // Constructs an object taking the ownership of |input| and |output|. Closes
|
| // |input| and |output| to prevent the caller from using them.
|
| - NativeMessagingChannel(base::File input, base::File output);
|
| - ~NativeMessagingChannel();
|
| -
|
| - // Starts reading and processing messages.
|
| - void Start(const SendMessageCallback& received_message,
|
| - const base::Closure& quit_closure);
|
| + PipeMessagingChannel(base::File input, base::File output);
|
| + virtual ~PipeMessagingChannel();
|
|
|
| - // Sends a message to the client app.
|
| - void SendMessage(scoped_ptr<base::DictionaryValue> message);
|
| + // extensions::NativeMessagingChannel implementation.
|
| + virtual void Start(const SendMessageCallback& received_message,
|
| + const base::Closure& quit_closure) OVERRIDE;
|
| + virtual void SendMessage(scoped_ptr<base::DictionaryValue> message) OVERRIDE;
|
|
|
| private:
|
| // Processes a message received from the client app.
|
| @@ -57,12 +59,12 @@ class NativeMessagingChannel : public base::NonThreadSafe {
|
| // The callback to invoke when a message is received.
|
| SendMessageCallback received_message_;
|
|
|
| - base::WeakPtr<NativeMessagingChannel> weak_ptr_;
|
| - base::WeakPtrFactory<NativeMessagingChannel> weak_factory_;
|
| + base::WeakPtr<PipeMessagingChannel> weak_ptr_;
|
| + base::WeakPtrFactory<PipeMessagingChannel> weak_factory_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(NativeMessagingChannel);
|
| + DISALLOW_COPY_AND_ASSIGN(PipeMessagingChannel);
|
| };
|
|
|
| } // namespace remoting
|
|
|
| -#endif // REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
|
| +#endif // REMOTING_HOST_NATIVE_MESSAGING_PIPE_MESSAGING_CHANNEL_H_
|
|
|