Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: remoting/host/native_messaging/native_messaging_pipe.h

Issue 591463003: Remote Assistance on Chrome OS Part III - NativeMessageHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@native_messaging
Patch Set: Address Sergey's feedback Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
6 #define REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
7
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"
12
13 namespace base {
14 class Value;
Sergey Ulanov 2014/09/25 01:45:22 nit: this line doesn't need to be indented.
kelvinp 2014/09/26 18:12:27 Done.
15 }
16
17 namespace remoting {
18
19 // Connects a extensions::NativeMessageHost to a PipeMessagingChannel
Sergey Ulanov 2014/09/25 01:45:22 nit: add . at the end of the sentence.
kelvinp 2014/09/26 18:12:27 Done.
20 class NativeMessagingPipe
21 : public extensions::NativeMessagingChannel::EventHandler,
22 public extensions::NativeMessageHost::Client,
23 public base::SupportsWeakPtr<NativeMessagingPipe> {
24 public:
25 NativeMessagingPipe();
26 virtual ~NativeMessagingPipe();
27
28 void Init(scoped_ptr<extensions::NativeMessageHost> host,
29 scoped_ptr<extensions::NativeMessagingChannel> channel);
30
31 // Starts processing messages from the pipe.
32 void Start(const base::Closure& quit_closure);
33
34 // extensions::NativeMessageHost::Client implementation.
35 virtual void PostMessageFromNativeHost(int port_id,
36 const std::string& message) OVERRIDE;
37 virtual void CloseChannel(int port_id,
38 const std::string& error_message) OVERRIDE;
39
40 // extensions::NativeMessagingChannel::EventHandler implementation.
41 virtual void OnMessage(scoped_ptr<base::Value> message) OVERRIDE;
42 virtual void OnDisconnect() OVERRIDE;
43
44 private:
45 base::Closure quit_closure_;
46 scoped_ptr<extensions::NativeMessagingChannel> channel_;
47 scoped_ptr<extensions::NativeMessageHost> host_;
48
49 DISALLOW_COPY_AND_ASSIGN(NativeMessagingPipe);
50 };
51
52 } // namespace remoting
53
54 #endif // REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698