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

Side by Side Diff: extensions/browser/api/messaging/native_messaging_channel.h

Issue 558403002: Remote Assistance on Chrome OS Part II - Native Messaging renaming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows host 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 EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
6 #define EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
7
8 #include "base/callback.h"
9
10 namespace base {
11 class Value;
12 } // namespace base
13
14 namespace extensions {
15
16 // Defines an interface to read messages and send responses between a native
Sergey Ulanov 2014/09/18 18:08:35 nit: "Defines an " is redundant. Just "Interface .
kelvinp 2014/09/18 19:03:50 Done.
17 // component and chrome.
18 class NativeMessagingChannel {
19 public:
20 // Callback interface for the channel. EventHandler must be valid as long as
21 // NativeMessagingChannel is valid.
Sergey Ulanov 2014/09/18 18:08:35 "valid" is ambiguous. Suggest rewording second sen
kelvinp 2014/09/18 19:03:50 Done.
22 class EventHandler {
23 public:
24 // Invoked when a message is received from the other endpoint.
25 virtual void OnMessage(scoped_ptr<base::Value> message) = 0;
26
27 // Invoked when there is an error in sending or receiving a message.
Sergey Ulanov 2014/09/18 18:08:35 Suggest "Called when the channel is disconnected."
kelvinp 2014/09/18 19:03:50 Done.
28 // The event handler should shut down the channel on this event.
Sergey Ulanov 2014/09/18 18:08:35 It's not clear what this means. Does it mean that
kelvinp 2014/09/18 19:03:50 Done.
29 virtual void OnDisconnect() = 0;
30
31 virtual ~EventHandler() {}
32 };
33
34 virtual ~NativeMessagingChannel() {}
35
36 // Starts reading and processing messages.
37 virtual void Start(EventHandler* event_handler) = 0;
38
39 // Sends a message to the other endpoint.
40 virtual void SendMessage(scoped_ptr<base::Value> message) = 0;
41 };
42
43 } // namespace extensions
44
45 #endif // EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698