Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
Sergey Ulanov
2014/09/15 19:53:39
I think it's better to add this file under extensi
kelvinp
2014/09/16 00:32:51
Done.
| |
| 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 CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 | |
| 10 namespace base { | |
| 11 class DictionaryValue; | |
| 12 } // namespace base | |
| 13 | |
| 14 namespace extensions { | |
| 15 | |
| 16 // Defines an interface to read messages and send responses between a native | |
| 17 // component and chrome. | |
| 18 class NativeMessagingChannel { | |
| 19 public: | |
| 20 // Used to send a message to the other endpoint. | |
| 21 typedef base::Callback<void(scoped_ptr<base::DictionaryValue> message)> | |
|
Sergey Ulanov
2014/09/15 19:53:39
this should be base::Value instead of DictionaryVa
kelvinp
2014/09/16 00:32:51
Done.
| |
| 22 SendMessageCallback; | |
| 23 | |
| 24 virtual ~NativeMessagingChannel() {} | |
| 25 | |
| 26 // Starts reading and processing messages. | |
| 27 // |received_message| is called whenever a message is received from the other | |
| 28 // endpoint. | |
| 29 // |quit_closure| is called by the channel to shut down the native component | |
| 30 // whenever it encounter failures in sending or receiving a message. | |
| 31 virtual void Start(const SendMessageCallback& received_message, | |
|
Sergey Ulanov
2014/09/15 19:53:39
I suggest you replace these two callbacks with a c
kelvinp
2014/09/16 00:32:51
Done.
| |
| 32 const base::Closure& quit_closure) = 0; | |
| 33 | |
| 34 // Sends a message to the other endpoint. | |
| 35 virtual void SendMessage(scoped_ptr<base::DictionaryValue> message) = 0; | |
|
Sergey Ulanov
2014/09/15 19:53:39
base::Value
kelvinp
2014/09/16 00:32:51
Done.
| |
| 36 }; | |
| 37 | |
| 38 } // namespace extensions | |
| 39 | |
| 40 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_ | |
| OLD | NEW |