| Index: chrome/browser/extensions/api/messaging/native_message_port.cc
|
| diff --git a/chrome/browser/extensions/api/messaging/native_message_port.cc b/chrome/browser/extensions/api/messaging/native_message_port.cc
|
| index cc0a4cfef524c734e371fa6dda86ba46260197cc..c340e33e5307292e0aaf7fe2d26065d08c890dbb 100644
|
| --- a/chrome/browser/extensions/api/messaging/native_message_port.cc
|
| +++ b/chrome/browser/extensions/api/messaging/native_message_port.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "chrome/browser/extensions/api/messaging/native_message_port.h"
|
|
|
| +#include "base/bind.h"
|
| +#include "base/json/json_writer.h"
|
| #include "chrome/browser/extensions/api/messaging/native_message_process_host.h"
|
| #include "content/public/browser/browser_thread.h"
|
|
|
| @@ -18,12 +20,20 @@ NativeMessagePort::~NativeMessagePort() {
|
| content::BrowserThread::IO, FROM_HERE, native_process_);
|
| }
|
|
|
| -void NativeMessagePort::DispatchOnMessage(const std::string& message,
|
| +void NativeMessagePort::DispatchOnMessage(scoped_ptr<base::ListValue> message,
|
| int target_port_id) {
|
| + std::string message_as_json;
|
| + if (!message->empty()) {
|
| + DCHECK_EQ(1u, message->GetSize());
|
| + base::Value* value = NULL;
|
| + message->Get(0, &value);
|
| + base::JSONWriter::Write(value, &message_as_json);
|
| + }
|
| content::BrowserThread::PostTask(
|
| content::BrowserThread::IO, FROM_HERE,
|
| base::Bind(&NativeMessageProcessHost::Send,
|
| - base::Unretained(native_process_), message));
|
| + base::Unretained(native_process_),
|
| + message_as_json));
|
| }
|
|
|
| } // namespace extensions
|
|
|