MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / remoting / host / native_messaging / native_messaging_pipe.h
bloba333943e4ea9c40cdddad112a25512375f38bbb8
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
6 #define REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "extensions/browser/api/messaging/native_message_host.h"
11 #include "extensions/browser/api/messaging/native_messaging_channel.h"
13 namespace base {
14 class Value;
17 namespace remoting {
19 // Connects a extensions::NativeMessageHost to a PipeMessagingChannel.
20 class NativeMessagingPipe
21 : public extensions::NativeMessagingChannel::EventHandler,
22 public extensions::NativeMessageHost::Client {
23 public:
24 NativeMessagingPipe();
25 ~NativeMessagingPipe() override;
27 // Starts processing messages from the pipe.
28 void Start(scoped_ptr<extensions::NativeMessageHost> host,
29 scoped_ptr<extensions::NativeMessagingChannel> channel);
31 // extensions::NativeMessageHost::Client implementation.
32 void PostMessageFromNativeHost(const std::string& message) override;
33 void CloseChannel(const std::string& error_message) override;
35 // extensions::NativeMessagingChannel::EventHandler implementation.
36 void OnMessage(scoped_ptr<base::Value> message) override;
37 void OnDisconnect() override;
39 private:
40 scoped_ptr<extensions::NativeMessagingChannel> channel_;
41 scoped_ptr<extensions::NativeMessageHost> host_;
43 DISALLOW_COPY_AND_ASSIGN(NativeMessagingPipe);
46 } // namespace remoting
48 #endif // REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_