diff options
Diffstat (limited to 'chrome/browser/extensions/api/messaging/native_message_process_host.cc')
-rw-r--r-- | chrome/browser/extensions/api/messaging/native_message_process_host.cc | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc index 9f8c50b..9187a08 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc +++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc @@ -5,9 +5,7 @@ #include "chrome/browser/extensions/api/messaging/native_message_process_host.h" #include "base/bind.h" -#include "base/bind_helpers.h" #include "base/files/file_path.h" -#include "base/json/json_reader.h" #include "base/logging.h" #include "base/platform_file.h" #include "base/process_util.h" @@ -44,8 +42,6 @@ const char kForbiddenError[] = "Access to the specified native messaging host is forbidden."; const char kHostInputOuputError[] = "Error when communicating with the native messaging host."; -const char kInvalidJsonError[] = - "Message must be valid JSON"; } // namespace @@ -272,35 +268,10 @@ void NativeMessageProcessHost::ProcessIncomingData( if (incoming_data_.size() < message_size + kMessageHeaderSize) return; - scoped_ptr<base::ListValue> message(new base::ListValue()); - { - std::string message_as_json = - incoming_data_.substr(kMessageHeaderSize, message_size); - int error_code; - std::string error_message; - scoped_ptr<base::Value> message_as_value( - base::JSONReader::ReadAndReturnError(message_as_json, - 0, // no flags - &error_code, - &error_message)); - if (!message_as_value) { - base::JSONReader::JsonParseError parse_error = - static_cast<base::JSONReader::JsonParseError>(error_code); - LOG(ERROR) << "Native Messaging host sent message with invalid JSON \"" - << message_as_json << "\": " << error_message << " (" - << base::JSONReader::ErrorCodeToString(parse_error) << "), " - << "message size " << message_size << ", " - << "incoming data size " << incoming_data_.size() << "."; - Close(kInvalidJsonError); - return; - } - message->Append(message_as_value.release()); - } - content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, base::Bind(&Client::PostMessageFromNativeProcess, weak_client_ui_, destination_port_, - base::Passed(&message))); + incoming_data_.substr(kMessageHeaderSize, message_size))); incoming_data_.erase(0, kMessageHeaderSize + message_size); } |