| Index: chrome/browser/extensions/api/messaging/native_messaging_channel.h
|
| diff --git a/chrome/browser/extensions/api/messaging/native_messaging_channel.h b/chrome/browser/extensions/api/messaging/native_messaging_channel.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..995deacf2214bc0e73a13819569c72ce579aff6e
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/api/messaging/native_messaging_channel.h
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
|
| +#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
|
| +
|
| +#include "base/callback.h"
|
| +
|
| +namespace base {
|
| +class DictionaryValue;
|
| +class Value;
|
| +} // namespace base
|
| +
|
| +namespace extensions {
|
| +
|
| +// Defines an interface to read messages and send responses between the native
|
| +// process and chrome.
|
| +class NativeMessagingChannel {
|
| + public:
|
| + // Used to send a message to the other endpoint.
|
| + typedef base::Callback<void(scoped_ptr<base::DictionaryValue> message)>
|
| + SendMessageCallback;
|
| +
|
| + virtual ~NativeMessagingChannel() {}
|
| +
|
| + // Starts reading and processing messages.
|
| + // |received_message| is called whenever a message is received from the other
|
| + // endpoint.
|
| + // |quit_closure| is called by the channel to shut down the native process
|
| + // whenever it encounter failures in sending or receiving a message.
|
| + virtual void Start(const SendMessageCallback& received_message,
|
| + const base::Closure& quit_closure) = 0;
|
| +
|
| + // Sends a message to the other endpoint.
|
| + virtual void SendMessage(scoped_ptr<base::DictionaryValue> message) = 0;
|
| +};
|
| +
|
| +} // namespace extensions
|
| +
|
| +#endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
|
|
|