summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorprashhir <prashhir@cisco.com>2015-03-05 01:30:57 -0800
committerCommit bot <commit-bot@chromium.org>2015-03-05 09:31:42 +0000
commit54a99450c633d64842217b10fa6841b2a3e7eb77 (patch)
tree743fdd828070286b7fb0223d140e4ded87954b13 /extensions
parent60cab6b4116a9c297795d6e32dc30c28f67a959e (diff)
downloadchromium_src-54a99450c633d64842217b10fa6841b2a3e7eb77.zip
chromium_src-54a99450c633d64842217b10fa6841b2a3e7eb77.tar.gz
chromium_src-54a99450c633d64842217b10fa6841b2a3e7eb77.tar.bz2
Split ValueSerializer into separate Serializer and Deserializer classes.
This CL removes the Deserializer functionality from ValueSerializer, and puts into separate class ValueDeserializer, so that class responsibility is maintained. BUG=455453 TBR=brettw@chromium.org Review URL: https://codereview.chromium.org/925783002 Cr-Commit-Position: refs/heads/master@{#319239}
Diffstat (limited to 'extensions')
-rw-r--r--extensions/browser/api/printer_provider/printer_provider_api.cc4
-rw-r--r--extensions/browser/api/printer_provider/printer_provider_apitest.cc4
-rw-r--r--extensions/browser/extension_icon_image_unittest.cc7
-rw-r--r--extensions/browser/image_loader_unittest.cc6
-rw-r--r--extensions/common/extension_l10n_util.cc4
-rw-r--r--extensions/common/file_util.cc4
-rw-r--r--extensions/common/file_util_unittest.cc4
-rw-r--r--extensions/common/manifest_test.cc6
-rw-r--r--extensions/utility/unpacker.cc8
9 files changed, 24 insertions, 23 deletions
diff --git a/extensions/browser/api/printer_provider/printer_provider_api.cc b/extensions/browser/api/printer_provider/printer_provider_api.cc
index a74838d..9074942 100644
--- a/extensions/browser/api/printer_provider/printer_provider_api.cc
+++ b/extensions/browser/api/printer_provider/printer_provider_api.cc
@@ -471,8 +471,8 @@ void PrinterProviderAPIImpl::DispatchPrintRequested(
core_api::printer_provider::PrintJob print_job;
print_job.printer_id = internal_printer_id;
- JSONStringValueSerializer serializer(job.ticket_json);
- scoped_ptr<base::Value> ticket_value(serializer.Deserialize(NULL, NULL));
+ JSONStringValueDeserializer deserializer(job.ticket_json);
+ scoped_ptr<base::Value> ticket_value(deserializer.Deserialize(NULL, NULL));
if (!ticket_value ||
!core_api::printer_provider::PrintJob::Ticket::Populate(
*ticket_value, &print_job.ticket)) {
diff --git a/extensions/browser/api/printer_provider/printer_provider_apitest.cc b/extensions/browser/api/printer_provider/printer_provider_apitest.cc
index 0a4662a..84e47f7 100644
--- a/extensions/browser/api/printer_provider/printer_provider_apitest.cc
+++ b/extensions/browser/api/printer_provider/printer_provider_apitest.cc
@@ -212,10 +212,10 @@ class PrinterProviderApiTest : public extensions::ShellApiTest {
const std::vector<std::string>& expected_printers) {
ASSERT_EQ(expected_printers.size(), printers.GetSize());
for (size_t i = 0; i < expected_printers.size(); ++i) {
- JSONStringValueSerializer serializer(expected_printers[i]);
+ JSONStringValueDeserializer deserializer(expected_printers[i]);
int error_code;
scoped_ptr<base::Value> printer_value(
- serializer.Deserialize(&error_code, NULL));
+ deserializer.Deserialize(&error_code, NULL));
ASSERT_TRUE(printer_value) << "Failed to deserialize "
<< expected_printers[i] << ": "
<< "error code " << error_code;
diff --git a/extensions/browser/extension_icon_image_unittest.cc b/extensions/browser/extension_icon_image_unittest.cc
index 24d0ac2..3fb4e69 100644
--- a/extensions/browser/extension_icon_image_unittest.cc
+++ b/extensions/browser/extension_icon_image_unittest.cc
@@ -150,10 +150,11 @@ class ExtensionIconImageTest : public ExtensionsTest,
test_file = test_file.AppendASCII(name);
int error_code = 0;
std::string error;
- JSONFileValueSerializer serializer(test_file.AppendASCII("manifest.json"));
+ JSONFileValueDeserializer deserializer(
+ test_file.AppendASCII("manifest.json"));
scoped_ptr<base::DictionaryValue> valid_value(
- static_cast<base::DictionaryValue*>(serializer.Deserialize(&error_code,
- &error)));
+ static_cast<base::DictionaryValue*>(
+ deserializer.Deserialize(&error_code, &error)));
EXPECT_EQ(0, error_code) << error;
if (error_code != 0)
return NULL;
diff --git a/extensions/browser/image_loader_unittest.cc b/extensions/browser/image_loader_unittest.cc
index 06763805..f1f2aad 100644
--- a/extensions/browser/image_loader_unittest.cc
+++ b/extensions/browser/image_loader_unittest.cc
@@ -81,11 +81,11 @@ class ImageLoaderTest : public ExtensionsTest {
extension_dir = extension_dir.AppendASCII(dir_name);
int error_code = 0;
std::string error;
- JSONFileValueSerializer serializer(
+ JSONFileValueDeserializer deserializer(
extension_dir.AppendASCII("manifest.json"));
scoped_ptr<base::DictionaryValue> valid_value(
- static_cast<base::DictionaryValue*>(serializer.Deserialize(&error_code,
- &error)));
+ static_cast<base::DictionaryValue*>(
+ deserializer.Deserialize(&error_code, &error)));
EXPECT_EQ(0, error_code) << error;
if (error_code != 0)
return NULL;
diff --git a/extensions/common/extension_l10n_util.cc b/extensions/common/extension_l10n_util.cc
index e60e2ec7..dbdd5d9 100644
--- a/extensions/common/extension_l10n_util.cc
+++ b/extensions/common/extension_l10n_util.cc
@@ -38,8 +38,8 @@ base::DictionaryValue* LoadMessageFile(const base::FilePath& locale_path,
std::string* error) {
base::FilePath file =
locale_path.AppendASCII(locale).Append(extensions::kMessagesFilename);
- JSONFileValueSerializer messages_serializer(file);
- base::Value* dictionary = messages_serializer.Deserialize(NULL, error);
+ JSONFileValueDeserializer messages_deserializer(file);
+ base::Value* dictionary = messages_deserializer.Deserialize(NULL, error);
if (!dictionary) {
if (error->empty()) {
// JSONFileValueSerializer just returns NULL if file cannot be found. It
diff --git a/extensions/common/file_util.cc b/extensions/common/file_util.cc
index e0ce339..399b6e7 100644
--- a/extensions/common/file_util.cc
+++ b/extensions/common/file_util.cc
@@ -168,8 +168,8 @@ base::DictionaryValue* LoadManifest(
return NULL;
}
- JSONFileValueSerializer serializer(manifest_path);
- scoped_ptr<base::Value> root(serializer.Deserialize(NULL, error));
+ JSONFileValueDeserializer deserializer(manifest_path);
+ scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, error));
if (!root.get()) {
if (error->empty()) {
// If |error| is empty, than the file could not be read.
diff --git a/extensions/common/file_util_unittest.cc b/extensions/common/file_util_unittest.cc
index 7e2f51d..750f598 100644
--- a/extensions/common/file_util_unittest.cc
+++ b/extensions/common/file_util_unittest.cc
@@ -43,8 +43,8 @@ scoped_refptr<Extension> LoadExtensionManifest(
Manifest::Location location,
int extra_flags,
std::string* error) {
- JSONStringValueSerializer serializer(manifest_value);
- scoped_ptr<base::Value> result(serializer.Deserialize(NULL, error));
+ JSONStringValueDeserializer deserializer(manifest_value);
+ scoped_ptr<base::Value> result(deserializer.Deserialize(NULL, error));
if (!result.get())
return NULL;
CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType());
diff --git a/extensions/common/manifest_test.cc b/extensions/common/manifest_test.cc
index 14e0aef..a3712d0 100644
--- a/extensions/common/manifest_test.cc
+++ b/extensions/common/manifest_test.cc
@@ -26,9 +26,9 @@ base::DictionaryValue* LoadManifestFile(const base::FilePath& manifest_path,
EXPECT_TRUE(base::PathExists(manifest_path)) <<
"Couldn't find " << manifest_path.value();
- JSONFileValueSerializer serializer(manifest_path);
- base::DictionaryValue* manifest =
- static_cast<base::DictionaryValue*>(serializer.Deserialize(NULL, error));
+ JSONFileValueDeserializer deserializer(manifest_path);
+ base::DictionaryValue* manifest = static_cast<base::DictionaryValue*>(
+ deserializer.Deserialize(NULL, error));
// Most unit tests don't need localization, and they'll fail if we try to
// localize them, since their manifests don't have a default_locale key.
diff --git a/extensions/utility/unpacker.cc b/extensions/utility/unpacker.cc
index d244ba5..c61faa2 100644
--- a/extensions/utility/unpacker.cc
+++ b/extensions/utility/unpacker.cc
@@ -118,9 +118,9 @@ base::DictionaryValue* Unpacker::ReadManifest() {
return NULL;
}
- JSONFileValueSerializer serializer(manifest_path);
+ JSONFileValueDeserializer deserializer(manifest_path);
std::string error;
- scoped_ptr<base::Value> root(serializer.Deserialize(NULL, &error));
+ scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, &error));
if (!root.get()) {
SetError(error);
return NULL;
@@ -270,9 +270,9 @@ bool Unpacker::AddDecodedImage(const base::FilePath& path) {
bool Unpacker::ReadMessageCatalog(const base::FilePath& message_path) {
std::string error;
- JSONFileValueSerializer serializer(message_path);
+ JSONFileValueDeserializer deserializer(message_path);
scoped_ptr<base::DictionaryValue> root(static_cast<base::DictionaryValue*>(
- serializer.Deserialize(NULL, &error)));
+ deserializer.Deserialize(NULL, &error)));
if (!root.get()) {
base::string16 messages_file = message_path.LossyDisplayName();
if (error.empty()) {