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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 1140053003: Refactoring: Moving the SafeJsonParser to its own component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving to namespace Created 5 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: chrome/utility/chrome_content_utility_client.cc
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index a9c67a133c7e1a4f4dec099deca72bc820651e0b..e5988b7c225cb18f5182c00e056bd8e02832b21f 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -6,7 +6,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/json/json_reader.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "chrome/common/chrome_utility_messages.h"
@@ -60,6 +59,8 @@
#include "chrome/utility/local_discovery/service_discovery_message_handler.h"
#endif
+#include "chrome/utility/safe_json_parser_handler.h"
Robert Sesek 2015/05/14 20:12:33 Put this in the proper #includes block.
Eran Messeri 2015/05/15 12:52:40 Done.
+
namespace {
bool Send(IPC::Message* message) {
@@ -123,6 +124,8 @@ ChromeContentUtilityClient::ChromeContentUtilityClient()
handlers_.push_back(new ShellHandler());
handlers_.push_back(new FontCacheHandler());
#endif
+
+ handlers_.push_back(new SafeJsonParserHandler());
}
ChromeContentUtilityClient::~ChromeContentUtilityClient() {
@@ -155,7 +158,6 @@ bool ChromeContentUtilityClient::OnMessageReceived(
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage,
OnRobustJPEGDecodeImage)
#endif // defined(OS_CHROMEOS)
- IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff,
OnPatchFileBsdiff)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette,
@@ -336,21 +338,6 @@ void ChromeContentUtilityClient::OnRobustJPEGDecodeImage(
}
#endif // defined(OS_CHROMEOS)
-void ChromeContentUtilityClient::OnParseJSON(const std::string& json) {
- int error_code;
- std::string error;
- base::Value* value = base::JSONReader::ReadAndReturnError(
- json, base::JSON_PARSE_RFC, &error_code, &error);
- if (value) {
- base::ListValue wrapper;
- wrapper.Append(value);
- Send(new ChromeUtilityHostMsg_ParseJSON_Succeeded(wrapper));
- } else {
- Send(new ChromeUtilityHostMsg_ParseJSON_Failed(error));
- }
- ReleaseProcessIfNeeded();
-}
-
void ChromeContentUtilityClient::OnPatchFileBsdiff(
const base::FilePath& input_file,
const base::FilePath& patch_file,

Powered by Google App Engine
This is Rietveld 408576698