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

Unified Diff: trunk/src/chrome/browser/extensions/api/messaging/native_message_process_host.cc

Issue 16336011: Revert 203489 "Replace JSON (de)serialization of extension messa..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/extensions/api/messaging/native_message_process_host.cc
===================================================================
--- trunk/src/chrome/browser/extensions/api/messaging/native_message_process_host.cc (revision 203729)
+++ trunk/src/chrome/browser/extensions/api/messaging/native_message_process_host.cc (working copy)
@@ -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 @@
"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 @@
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);
}

Powered by Google App Engine
This is Rietveld 408576698