summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 00:15:41 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 00:15:41 +0000
commitcd57857578b7b905ee27580d8ca279f6f7642e82 (patch)
tree82230a21554f358452b508ee64ef1ea3efcb518b /chrome
parentcc7cde43832b547cdab856fe1bedc9514ca38e13 (diff)
downloadchromium_src-cd57857578b7b905ee27580d8ca279f6f7642e82.zip
chromium_src-cd57857578b7b905ee27580d8ca279f6f7642e82.tar.gz
chromium_src-cd57857578b7b905ee27580d8ca279f6f7642e82.tar.bz2
Modify the base::JSONReader interface to take a set of options rather than a boolean flag.
This is just prep work for a large CL that rewrites the JSON parser. Splitting out this interface change will make it easier to review the other CL. BUG=121469 TEST=No functional change. Review URL: https://chromiumcodereview.appspot.com/9960077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc3
-rw-r--r--chrome/browser/chrome_to_mobile_service.cc6
-rw-r--r--chrome/browser/chromeos/cros/network_parser.cc2
-rw-r--r--chrome/browser/chromeos/customization_document.cc4
-rw-r--r--chrome/browser/chromeos/extensions/file_manager_util.cc3
-rw-r--r--chrome/browser/chromeos/gdata/gdata_documents_service_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/gdata/gdata_file_system.cc3
-rw-r--r--chrome/browser/chromeos/gdata/gdata_operations.cc2
-rw-r--r--chrome/browser/chromeos/gdata/gdata_util.cc2
-rw-r--r--chrome/browser/content_settings/content_settings_policy_provider.cc4
-rw-r--r--chrome/browser/content_settings/host_content_settings_map_unittest.cc6
-rw-r--r--chrome/browser/extensions/app_notification_storage.cc3
-rw-r--r--chrome/browser/extensions/app_notify_channel_setup.cc3
-rw-r--r--chrome/browser/extensions/chrome_app_api_browsertest.cc6
-rw-r--r--chrome/browser/extensions/extension_debugger_api.cc2
-rw-r--r--chrome/browser/extensions/extension_function_test_utils.cc3
-rw-r--r--chrome/browser/extensions/extension_menu_manager_unittest.cc3
-rw-r--r--chrome/browser/extensions/settings/setting_sync_data.cc2
-rw-r--r--chrome/browser/gpu_blacklist.cc2
-rw-r--r--chrome/browser/net/gaia/gaia_oauth_fetcher.cc3
-rw-r--r--chrome/browser/plugin_finder.cc3
-rw-r--r--chrome/browser/policy/configuration_policy_handler_chromeos.cc3
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc2
-rw-r--r--chrome/browser/printing/print_dialog_cloud.cc2
-rw-r--r--chrome/browser/profiles/profile_downloader.cc2
-rw-r--r--chrome/browser/spellchecker/spelling_service_client.cc3
-rw-r--r--chrome/browser/sync/notifier/p2p_notifier.cc3
-rw-r--r--chrome/browser/sync/profile_sync_service_preference_unittest.cc6
-rw-r--r--chrome/browser/themes/browser_theme_pack_unittest.cc8
-rw-r--r--chrome/browser/translate/translate_manager.cc3
-rw-r--r--chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc3
-rw-r--r--chrome/browser/ui/webui/options2/core_options_handler2.cc4
-rw-r--r--chrome/browser/ui/webui/print_preview/print_preview_handler.cc2
-rw-r--r--chrome/browser/ui/webui/sync_setup_handler.cc8
-rw-r--r--chrome/browser/web_resource/promo_resource_service_unittest.cc18
-rw-r--r--chrome/common/cloud_print/cloud_print_helpers.cc2
-rw-r--r--chrome/common/extensions/api/extension_api.cc2
-rw-r--r--chrome/common/extensions/simple_feature_provider.cc5
-rw-r--r--chrome/common/json_value_serializer_unittest.cc8
-rw-r--r--chrome/common/net/gaia/gaia_auth_fetcher.cc3
-rw-r--r--chrome/common/net/gaia/gaia_oauth_client.cc2
-rw-r--r--chrome/common/net/gaia/oauth2_access_token_fetcher.cc3
-rw-r--r--chrome/common/net/gaia/oauth2_mint_token_fetcher.cc3
-rw-r--r--chrome/common/web_apps.cc2
-rw-r--r--chrome/common/web_resource/web_resource_unpacker.cc2
-rw-r--r--chrome/renderer/extensions/send_request_natives.cc4
-rw-r--r--chrome/service/cloud_print/print_system_cups.cc5
-rw-r--r--chrome/test/automation/automation_json_requests.cc3
-rw-r--r--chrome/test/automation/browser_proxy.cc5
-rw-r--r--chrome/test/base/ui_test_utils.cc6
-rw-r--r--chrome/test/perf/rendering/throughput_tests.cc2
-rw-r--r--chrome/test/webdriver/webdriver_dispatch.cc2
-rw-r--r--chrome/test/webdriver/webdriver_dispatch_unittest.cc2
-rw-r--r--chrome/test/webdriver/webdriver_session.cc2
-rw-r--r--chrome/utility/chrome_content_utility_client.cc4
55 files changed, 94 insertions, 107 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 843be92..f870b73 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -2198,7 +2198,8 @@ void TestingAutomationProvider::SendJSONRequest(int handle,
scoped_ptr<Value> values;
base::JSONReader reader;
std::string error;
- values.reset(reader.ReadAndReturnError(json_request, true, NULL, &error));
+ values.reset(reader.ReadAndReturnError(json_request,
+ base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error));
if (!error.empty()) {
AutomationJSONReply(this, reply_message).SendError(error);
return;
diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc
index e4b07f6..840a014 100644
--- a/chrome/browser/chrome_to_mobile_service.cc
+++ b/chrome/browser/chrome_to_mobile_service.cc
@@ -425,7 +425,7 @@ void ChromeToMobileService::HandleAccountInfoResponse() {
ListValue* services = NULL;
DictionaryValue* dictionary = NULL;
- scoped_ptr<Value> json(base::JSONReader::Read(data, false));
+ scoped_ptr<Value> json(base::JSONReader::Read(data));
StringValue cloud_print_service(kCloudPrintSerivceValue);
if (json.get() && json->GetAsDictionary(&dictionary) && dictionary &&
dictionary->GetList(kAccountServicesKey, &services) && services &&
@@ -444,7 +444,7 @@ void ChromeToMobileService::HandleSearchResponse() {
ListValue* list = NULL;
DictionaryValue* dictionary = NULL;
- scoped_ptr<Value> json(base::JSONReader::Read(data, false));
+ scoped_ptr<Value> json(base::JSONReader::Read(data));
if (json.get() && json->GetAsDictionary(&dictionary) && dictionary &&
dictionary->GetList(cloud_print::kPrinterListValue, &list)) {
ScopedVector<base::DictionaryValue> mobiles;
@@ -482,7 +482,7 @@ void ChromeToMobileService::HandleSubmitResponse(
source->GetResponseAsString(&data);
bool success = false;
DictionaryValue* dictionary = NULL;
- scoped_ptr<Value> json(base::JSONReader::Read(data, false));
+ scoped_ptr<Value> json(base::JSONReader::Read(data));
if (json.get() && json->GetAsDictionary(&dictionary) && dictionary)
dictionary->GetBoolean("success", &success);
diff --git a/chrome/browser/chromeos/cros/network_parser.cc b/chrome/browser/chromeos/cros/network_parser.cc
index 0bf606d..af41b12 100644
--- a/chrome/browser/chromeos/cros/network_parser.cc
+++ b/chrome/browser/chromeos/cros/network_parser.cc
@@ -217,7 +217,7 @@ bool NetworkParser::ParseValue(PropertyIndex index,
if (!value.GetAsString(&ui_data_json))
return false;
scoped_ptr<base::Value> ui_data_value(
- base::JSONReader::Read(ui_data_json, false));
+ base::JSONReader::Read(ui_data_json));
base::DictionaryValue* ui_data_dict = NULL;
if (!ui_data_value.get() ||
!ui_data_value->GetAsDictionary(&ui_data_dict))
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
index f0434de..01bdb8e 100644
--- a/chrome/browser/chromeos/customization_document.cc
+++ b/chrome/browser/chromeos/customization_document.cc
@@ -92,9 +92,7 @@ bool CustomizationDocument::LoadManifestFromString(
int error_code = 0;
std::string error;
scoped_ptr<Value> root(base::JSONReader::ReadAndReturnError(manifest,
- true,
- &error_code,
- &error));
+ base::JSON_ALLOW_TRAILING_COMMAS, &error_code, &error));
if (error_code != base::JSONReader::JSON_NO_ERROR)
LOG(ERROR) << error;
DCHECK(root.get() != NULL);
diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc
index 4aed8df7..8b15ee4 100644
--- a/chrome/browser/chromeos/extensions/file_manager_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager_util.cc
@@ -527,8 +527,7 @@ void ReadUrlFromGDocOnFileThread(const FilePath& file_path) {
}
scoped_ptr<base::Value> root_value;
- root_value.reset(
- base::JSONReader::Read(contents, false /* no trailing comma */));
+ root_value.reset(base::JSONReader::Read(contents));
DictionaryValue* dictionary_value;
std::string edit_url_string;
diff --git a/chrome/browser/chromeos/gdata/gdata_documents_service_browsertest.cc b/chrome/browser/chromeos/gdata/gdata_documents_service_browsertest.cc
index 1694258..95da95c 100644
--- a/chrome/browser/chromeos/gdata/gdata_documents_service_browsertest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_documents_service_browsertest.cc
@@ -118,7 +118,7 @@ IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) {
std::string expected_contents;
file_util::ReadFileToString(expected_filepath, &expected_contents);
scoped_ptr<base::Value> expected_data(
- base::JSONReader::Read(expected_contents, false));
+ base::JSONReader::Read(expected_contents));
EXPECT_TRUE(base::Value::Equals(expected_data.get(), result_data));
delete result_data;
}
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc
index a06a7a2..c997c2c 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -2237,7 +2237,8 @@ void GDataFileSystem::LoadJsonFileOnIOThreadPool(
int unused_error_code = -1;
std::string unused_error_message;
root_value.reset(base::JSONReader::ReadAndReturnError(
- contents, false, &unused_error_code, &unused_error_message));
+ contents, base::JSON_PARSE_RFC, &unused_error_code,
+ &unused_error_message));
bool has_root = root_value.get();
if (!has_root)
diff --git a/chrome/browser/chromeos/gdata/gdata_operations.cc b/chrome/browser/chromeos/gdata/gdata_operations.cc
index 4aeda4c..4f4b394 100644
--- a/chrome/browser/chromeos/gdata/gdata_operations.cc
+++ b/chrome/browser/chromeos/gdata/gdata_operations.cc
@@ -427,7 +427,7 @@ base::Value* GetDataOperation::ParseResponse(const std::string& data) {
int error_code = -1;
std::string error_message;
scoped_ptr<base::Value> root_value(base::JSONReader::ReadAndReturnError(
- data, false, &error_code, &error_message));
+ data, base::JSON_PARSE_RFC, &error_code, &error_message));
if (!root_value.get()) {
LOG(ERROR) << "Error while parsing entry response: "
<< error_message
diff --git a/chrome/browser/chromeos/gdata/gdata_util.cc b/chrome/browser/chromeos/gdata/gdata_util.cc
index d9304ac..a4adaa5 100644
--- a/chrome/browser/chromeos/gdata/gdata_util.cc
+++ b/chrome/browser/chromeos/gdata/gdata_util.cc
@@ -81,7 +81,7 @@ void GetHostedDocumentURLBlockingThread(const FilePath& gdata_cache_path,
return;
}
DVLOG(1) << "Hosted doc content " << json;
- scoped_ptr<base::Value> val(base::JSONReader::Read(json, false));
+ scoped_ptr<base::Value> val(base::JSONReader::Read(json));
base::DictionaryValue* dict_val;
if (!val.get() || !val->GetAsDictionary(&dict_val)) {
NOTREACHED() << "Parse failure for " << json;
diff --git a/chrome/browser/content_settings/content_settings_policy_provider.cc b/chrome/browser/content_settings/content_settings_policy_provider.cc
index 85a0631..f71bb4ca 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider.cc
+++ b/chrome/browser/content_settings/content_settings_policy_provider.cc
@@ -303,8 +303,8 @@ void PolicyProvider::GetAutoSelectCertificateSettingsFromPreferences(
continue;
}
- scoped_ptr<base::Value> value(
- base::JSONReader::Read(pattern_filter_json, true));
+ scoped_ptr<base::Value> value(base::JSONReader::Read(pattern_filter_json,
+ base::JSON_ALLOW_TRAILING_COMMAS));
if (!value.get()) {
VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:"
" Invalid JSON format: " << pattern_filter_json;
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
index f59e588..73aee59 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -727,12 +727,12 @@ TEST_F(HostContentSettingsMapTest, CanonicalizeExceptionsUnicodeAndPunycode) {
TestingProfile profile;
scoped_ptr<Value> value(base::JSONReader::Read(
- "{\"[*.]\\xC4\\x87ira.com,*\":{\"images\":1}}", false));
+ "{\"[*.]\\xC4\\x87ira.com,*\":{\"images\":1}}"));
profile.GetPrefs()->Set(prefs::kContentSettingsPatternPairs, *value);
// Set punycode equivalent, with different setting.
scoped_ptr<Value> puny_value(base::JSONReader::Read(
- "{\"[*.]xn--ira-ppa.com,*\":{\"images\":2}}", false));
+ "{\"[*.]xn--ira-ppa.com,*\":{\"images\":2}}"));
profile.GetPrefs()->Set(prefs::kContentSettingsPatternPairs, *puny_value);
// Initialize the content map.
@@ -799,7 +799,7 @@ TEST_F(HostContentSettingsMapTest, ResourceIdentifierPrefs) {
TestingProfile profile;
scoped_ptr<Value> value(base::JSONReader::Read(
- "{\"[*.]example.com,*\":{\"per_plugin\":{\"someplugin\":2}}}", false));
+ "{\"[*.]example.com,*\":{\"per_plugin\":{\"someplugin\":2}}}"));
profile.GetPrefs()->Set(prefs::kContentSettingsPatternPairs, *value);
HostContentSettingsMap* host_content_settings_map =
profile.GetHostContentSettingsMap();
diff --git a/chrome/browser/extensions/app_notification_storage.cc b/chrome/browser/extensions/app_notification_storage.cc
index 914f997..42f11b2 100644
--- a/chrome/browser/extensions/app_notification_storage.cc
+++ b/chrome/browser/extensions/app_notification_storage.cc
@@ -80,8 +80,7 @@ void AppNotificationListToJSON(const AppNotificationList& list,
bool JSONToAppNotificationList(const std::string& json,
AppNotificationList* list) {
CHECK(list);
- scoped_ptr<Value> value(JSONReader::Read(json,
- false /* allow_trailing_comma */));
+ scoped_ptr<Value> value(JSONReader::Read(json));
if (!value.get() || value->GetType() != Value::TYPE_LIST)
return false;
diff --git a/chrome/browser/extensions/app_notify_channel_setup.cc b/chrome/browser/extensions/app_notify_channel_setup.cc
index f3200ba..bdce1d5 100644
--- a/chrome/browser/extensions/app_notify_channel_setup.cc
+++ b/chrome/browser/extensions/app_notify_channel_setup.cc
@@ -402,8 +402,7 @@ std::string AppNotifyChannelSetup::MakeAuthorizationHeader(
// static
bool AppNotifyChannelSetup::ParseCWSChannelServiceResponse(
const std::string& data, std::string* result) {
- base::JSONReader reader;
- scoped_ptr<base::Value> value(reader.Read(data, false));
+ scoped_ptr<base::Value> value(base::JSONReader::Read(data));
if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY)
return false;
diff --git a/chrome/browser/extensions/chrome_app_api_browsertest.cc b/chrome/browser/extensions/chrome_app_api_browsertest.cc
index 7335306..44e91cc 100644
--- a/chrome/browser/extensions/chrome_app_api_browsertest.cc
+++ b/chrome/browser/extensions/chrome_app_api_browsertest.cc
@@ -97,8 +97,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, IsInstalled) {
browser()->GetSelectedWebContents()->GetRenderViewHost(),
L"", get_app_details, &result));
scoped_ptr<DictionaryValue> app_details(
- static_cast<DictionaryValue*>(
- base::JSONReader::Read(result, false /* allow trailing comma */)));
+ static_cast<DictionaryValue*>(base::JSONReader::Read(result)));
// extension->manifest() does not contain the id.
app_details->Remove("id", NULL);
EXPECT_TRUE(app_details.get());
@@ -176,8 +175,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, GetDetailsForFrame) {
L"", get_details_for_frame, &json));
scoped_ptr<DictionaryValue> app_details(
- static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false /* allow trailing comma */)));
+ static_cast<DictionaryValue*>(base::JSONReader::Read(json)));
// extension->manifest() does not contain the id.
app_details->Remove("id", NULL);
EXPECT_TRUE(app_details.get());
diff --git a/chrome/browser/extensions/extension_debugger_api.cc b/chrome/browser/extensions/extension_debugger_api.cc
index 5bf283b..646eb0f 100644
--- a/chrome/browser/extensions/extension_debugger_api.cc
+++ b/chrome/browser/extensions/extension_debugger_api.cc
@@ -283,7 +283,7 @@ void ExtensionDevToolsClientHost::DispatchOnInspectorFrontend(
if (profile == NULL || !profile->GetExtensionEventRouter())
return;
- scoped_ptr<Value> result(base::JSONReader::Read(message, false));
+ scoped_ptr<Value> result(base::JSONReader::Read(message));
if (!result->IsType(Value::TYPE_DICTIONARY))
return;
DictionaryValue* dictionary = static_cast<DictionaryValue*>(result.get());
diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc
index 889f6be..35989dc 100644
--- a/chrome/browser/extensions/extension_function_test_utils.cc
+++ b/chrome/browser/extensions/extension_function_test_utils.cc
@@ -44,8 +44,7 @@ class TestFunctionDispatcherDelegate
namespace extension_function_test_utils {
base::Value* ParseJSON(const std::string& data) {
- const bool kAllowTrailingComma = false;
- return base::JSONReader::Read(data, kAllowTrailingComma);
+ return base::JSONReader::Read(data);
}
base::ListValue* ParseList(const std::string& data) {
diff --git a/chrome/browser/extensions/extension_menu_manager_unittest.cc b/chrome/browser/extensions/extension_menu_manager_unittest.cc
index 7fc9ff3..cae9a9b 100644
--- a/chrome/browser/extensions/extension_menu_manager_unittest.cc
+++ b/chrome/browser/extensions/extension_menu_manager_unittest.cc
@@ -467,7 +467,8 @@ TEST_F(ExtensionMenuManagerTest, ExecuteCommand) {
// Parse the json event_args, which should turn into a 2-element list where
// the first element is a dictionary we want to inspect for the correct
// values.
- scoped_ptr<Value> result(base::JSONReader::Read(event_args, true));
+ scoped_ptr<Value> result(
+ base::JSONReader::Read(event_args, base::JSON_ALLOW_TRAILING_COMMAS));
Value* value = result.get();
ASSERT_TRUE(result.get() != NULL);
ASSERT_EQ(Value::TYPE_LIST, value->GetType());
diff --git a/chrome/browser/extensions/settings/setting_sync_data.cc b/chrome/browser/extensions/settings/setting_sync_data.cc
index 6f0cd08..4f54052 100644
--- a/chrome/browser/extensions/settings/setting_sync_data.cc
+++ b/chrome/browser/extensions/settings/setting_sync_data.cc
@@ -46,7 +46,7 @@ void SettingSyncData::InitFromExtensionSettingSpecifics(
const sync_pb::ExtensionSettingSpecifics& specifics) {
DCHECK(!internal_.get());
scoped_ptr<Value> value(
- base::JSONReader().JsonToValue(specifics.value(), false, false));
+ base::JSONReader::Read(specifics.value()));
if (!value.get()) {
LOG(WARNING) << "Specifics for " << specifics.extension_id() << "/" <<
specifics.key() << " had bad JSON for value: " << specifics.value();
diff --git a/chrome/browser/gpu_blacklist.cc b/chrome/browser/gpu_blacklist.cc
index 79c41b9..24bb9da 100644
--- a/chrome/browser/gpu_blacklist.cc
+++ b/chrome/browser/gpu_blacklist.cc
@@ -769,7 +769,7 @@ bool GpuBlacklist::LoadGpuBlacklist(
DCHECK(browser_version_.get() != NULL);
scoped_ptr<Value> root;
- root.reset(base::JSONReader::Read(json_context, false));
+ root.reset(base::JSONReader::Read(json_context));
if (root.get() == NULL || !root->IsType(Value::TYPE_DICTIONARY))
return false;
diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
index 4ee520b..2d12697 100644
--- a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
+++ b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
@@ -264,8 +264,7 @@ void GaiaOAuthFetcher::ParseOAuthWrapBridgeResponse(const std::string& data,
// static
void GaiaOAuthFetcher::ParseUserInfoResponse(const std::string& data,
std::string* email_result) {
- base::JSONReader reader;
- scoped_ptr<base::Value> value(reader.Read(data, false));
+ scoped_ptr<base::Value> value(base::JSONReader::Read(data));
if (value->GetType() == base::Value::TYPE_DICTIONARY) {
Value* email_value;
DictionaryValue* dict = static_cast<DictionaryValue*>(value.get());
diff --git a/chrome/browser/plugin_finder.cc b/chrome/browser/plugin_finder.cc
index 2b66754..a0eaf03 100644
--- a/chrome/browser/plugin_finder.cc
+++ b/chrome/browser/plugin_finder.cc
@@ -51,11 +51,10 @@ DictionaryValue* PluginFinder::LoadPluginListInternal() {
base::StringPiece json_resource(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PLUGIN_DB_JSON));
- bool allow_trailing_comma = false;
std::string error_str;
scoped_ptr<base::Value> value(base::JSONReader::ReadAndReturnError(
json_resource.as_string(),
- allow_trailing_comma,
+ base::JSON_PARSE_RFC,
NULL,
&error_str));
if (!value.get()) {
diff --git a/chrome/browser/policy/configuration_policy_handler_chromeos.cc b/chrome/browser/policy/configuration_policy_handler_chromeos.cc
index ff43551..2ad2655 100644
--- a/chrome/browser/policy/configuration_policy_handler_chromeos.cc
+++ b/chrome/browser/policy/configuration_policy_handler_chromeos.cc
@@ -74,7 +74,8 @@ Value* NetworkConfigurationPolicyHandler::SanitizeNetworkConfig(
if (!config->GetAsString(&json_string))
return NULL;
- scoped_ptr<Value> json_value(base::JSONReader::Read(json_string, true));
+ scoped_ptr<Value> json_value(
+ base::JSONReader::Read(json_string, base::JSON_ALLOW_TRAILING_COMMAS));
if (!json_value.get() || !json_value->IsType(base::Value::TYPE_DICTIONARY))
return NULL;
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc
index 27bd893..fb34458 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc
@@ -36,7 +36,7 @@ void CloudPrintSetupMessageHandler::HandleSubmitAuth(const ListValue* args) {
return;
}
- scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json));
if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) {
NOTREACHED() << "Unable to parse auth data";
return;
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index 42a711d..c495bac 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -130,7 +130,7 @@ namespace internal_cloud_print_helpers {
// parameters.
bool GetPageSetupParameters(const std::string& json,
PrintMsg_Print_Params& parameters) {
- scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json));
DLOG_IF(ERROR, (!parsed_value.get() ||
!parsed_value->IsType(Value::TYPE_DICTIONARY)))
<< "PageSetup call didn't have expected contents";
diff --git a/chrome/browser/profiles/profile_downloader.cc b/chrome/browser/profiles/profile_downloader.cc
index 40a0a42..179a3ce 100644
--- a/chrome/browser/profiles/profile_downloader.cc
+++ b/chrome/browser/profiles/profile_downloader.cc
@@ -139,7 +139,7 @@ bool ProfileDownloader::GetProfileNameAndImageURL(const std::string& data,
int error_code = -1;
std::string error_message;
scoped_ptr<base::Value> root_value(base::JSONReader::ReadAndReturnError(
- data, false, &error_code, &error_message));
+ data, base::JSON_PARSE_RFC, &error_code, &error_message));
if (!root_value.get()) {
LOG(ERROR) << "Error while parsing user entry response: "
<< error_message;
diff --git a/chrome/browser/spellchecker/spelling_service_client.cc b/chrome/browser/spellchecker/spelling_service_client.cc
index 85bbc47..1b406dd 100644
--- a/chrome/browser/spellchecker/spelling_service_client.cc
+++ b/chrome/browser/spellchecker/spelling_service_client.cc
@@ -153,7 +153,8 @@ bool SpellingServiceClient::ParseResponse(
// }
// }
scoped_ptr<DictionaryValue> value(
- static_cast<DictionaryValue*>(base::JSONReader::Read(data, true)));
+ static_cast<DictionaryValue*>(
+ base::JSONReader::Read(data, base::JSON_ALLOW_TRAILING_COMMAS)));
if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY))
return false;
diff --git a/chrome/browser/sync/notifier/p2p_notifier.cc b/chrome/browser/sync/notifier/p2p_notifier.cc
index e9b4ef20..ee3a4da6 100644
--- a/chrome/browser/sync/notifier/p2p_notifier.cc
+++ b/chrome/browser/sync/notifier/p2p_notifier.cc
@@ -109,8 +109,7 @@ std::string P2PNotificationData::ToString() const {
}
bool P2PNotificationData::ResetFromString(const std::string& str) {
- scoped_ptr<Value> data_value(
- base::JSONReader::Read(str, false /* allow_trailing_comma */));
+ scoped_ptr<Value> data_value(base::JSONReader::Read(str));
if (!data_value.get()) {
LOG(WARNING) << "Could not parse " << str;
return false;
diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc
index b22406a..da17a86 100644
--- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc
@@ -164,8 +164,7 @@ class ProfileSyncServicePreferenceTest
const sync_pb::PreferenceSpecifics& specifics(
node.GetEntitySpecifics().preference());
- JSONReader reader;
- return reader.JsonToValue(specifics.value(), false, false);
+ return base::JSONReader::Read(specifics.value());
}
int64 WriteSyncedValue(const std::string& name,
@@ -255,8 +254,7 @@ TEST_F(ProfileSyncServicePreferenceTest, CreatePrefSyncData) {
preference());
EXPECT_EQ(std::string(prefs::kHomePage), specifics.name());
- base::JSONReader reader;
- scoped_ptr<Value> value(reader.JsonToValue(specifics.value(), false, false));
+ scoped_ptr<Value> value(base::JSONReader::Read(specifics.value()));
EXPECT_TRUE(pref->GetValue()->Equals(value.get()));
}
diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc
index c13c72f..bcf81ef 100644
--- a/chrome/browser/themes/browser_theme_pack_unittest.cc
+++ b/chrome/browser/themes/browser_theme_pack_unittest.cc
@@ -79,7 +79,7 @@ class BrowserThemePackTest : public ::testing::Test {
}
void LoadColorJSON(const std::string& json) {
- scoped_ptr<Value> value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> value(base::JSONReader::Read(json));
ASSERT_TRUE(value->IsType(Value::TYPE_DICTIONARY));
LoadColorDictionary(static_cast<DictionaryValue*>(value.get()));
}
@@ -89,7 +89,7 @@ class BrowserThemePackTest : public ::testing::Test {
}
void LoadTintJSON(const std::string& json) {
- scoped_ptr<Value> value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> value(base::JSONReader::Read(json));
ASSERT_TRUE(value->IsType(Value::TYPE_DICTIONARY));
LoadTintDictionary(static_cast<DictionaryValue*>(value.get()));
}
@@ -99,7 +99,7 @@ class BrowserThemePackTest : public ::testing::Test {
}
void LoadDisplayPropertiesJSON(const std::string& json) {
- scoped_ptr<Value> value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> value(base::JSONReader::Read(json));
ASSERT_TRUE(value->IsType(Value::TYPE_DICTIONARY));
LoadDisplayPropertiesDictionary(static_cast<DictionaryValue*>(value.get()));
}
@@ -110,7 +110,7 @@ class BrowserThemePackTest : public ::testing::Test {
void ParseImageNamesJSON(const std::string& json,
std::map<int, FilePath>* out_file_paths) {
- scoped_ptr<Value> value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> value(base::JSONReader::Read(json));
ASSERT_TRUE(value->IsType(Value::TYPE_DICTIONARY));
ParseImageNamesDictionary(static_cast<DictionaryValue*>(value.get()),
out_file_paths);
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 4158484..f5076f0 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -220,7 +220,8 @@ void TranslateManager::SetSupportedLanguages(const std::string& language_list) {
// JSON doesn't support single quotes though this is what is used on the
// translate server so we must replace them with double quotes.
ReplaceSubstringsAfterOffset(&languages_json, 0, "'", "\"");
- scoped_ptr<Value> json_value(base::JSONReader::Read(languages_json, true));
+ scoped_ptr<Value> json_value(
+ base::JSONReader::Read(languages_json, base::JSON_ALLOW_TRAILING_COMMAS));
if (json_value == NULL || !json_value->IsType(Value::TYPE_DICTIONARY)) {
NOTREACHED();
return;
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
index 08710f2..cc8ca0e 100644
--- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
@@ -394,7 +394,8 @@ bool CellularConfigDocument::LoadFromFile(const FilePath& config_path) {
if (!file_util::ReadFileToString(config_path, &config))
return false;
- scoped_ptr<Value> root(base::JSONReader::Read(config, true));
+ scoped_ptr<Value> root(
+ base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS));
DCHECK(root.get() != NULL);
if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) {
LOG(WARNING) << "Bad cellular config file";
diff --git a/chrome/browser/ui/webui/options2/core_options_handler2.cc b/chrome/browser/ui/webui/options2/core_options_handler2.cc
index 226756b..d25a3f1 100644
--- a/chrome/browser/ui/webui/options2/core_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/core_options_handler2.cc
@@ -416,9 +416,7 @@ void CoreOptionsHandler::HandleSetPref(const ListValue* args, PrefType type) {
std::string json_string;
CHECK(value->GetAsString(&json_string));
temp_value.reset(
- base::JSONReader().JsonToValue(json_string,
- false, // no check_root
- false)); // no trailing comma
+ base::JSONReader::Read(json_string));
value = temp_value.get();
CHECK_EQ(base::Value::TYPE_LIST, value->GetType());
break;
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index a8f1b09..016c425 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -132,7 +132,7 @@ DictionaryValue* GetSettingsDictionary(const ListValue* args) {
return NULL;
}
scoped_ptr<DictionaryValue> settings(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json_str, false)));
+ base::JSONReader::Read(json_str)));
if (!settings.get() || !settings->IsType(Value::TYPE_DICTIONARY)) {
NOTREACHED() << "Print job settings must be a dictionary.";
return NULL;
diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc
index 7ce131f..78ea499 100644
--- a/chrome/browser/ui/webui/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler.cc
@@ -95,7 +95,7 @@ bool GetAuthData(const std::string& json,
std::string* password,
std::string* captcha,
std::string* access_code) {
- scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json));
if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY))
return false;
@@ -110,7 +110,7 @@ bool GetAuthData(const std::string& json,
}
bool GetConfiguration(const std::string& json, SyncConfigInfo* config) {
- scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json));
DictionaryValue* result;
if (!parsed_value.get() || !parsed_value->GetAsDictionary(&result)) {
DLOG(ERROR) << "GetConfiguration() not passed a Dictionary";
@@ -161,7 +161,7 @@ bool GetConfiguration(const std::string& json, SyncConfigInfo* config) {
}
bool GetPassphrase(const std::string& json, std::string* passphrase) {
- scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json));
if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY))
return false;
@@ -720,7 +720,7 @@ void SyncSetupHandler::HandleAttachHandler(const ListValue* args) {
bool force_login = false;
std::string json;
if (args->GetString(0, &json) && !json.empty()) {
- scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json));
DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get());
result->GetBoolean("forceLogin", &force_login);
}
diff --git a/chrome/browser/web_resource/promo_resource_service_unittest.cc b/chrome/browser/web_resource/promo_resource_service_unittest.cc
index 017fb85..ee50587 100644
--- a/chrome/browser/web_resource/promo_resource_service_unittest.cc
+++ b/chrome/browser/web_resource/promo_resource_service_unittest.cc
@@ -57,7 +57,7 @@ TEST_F(PromoResourceServiceTest, UnpackLogoSignal) {
" }"
"}";
scoped_ptr<DictionaryValue> test_json(
- static_cast<DictionaryValue*>(base::JSONReader::Read(json, false)));
+ static_cast<DictionaryValue*>(base::JSONReader::Read(json)));
// Check that prefs are set correctly.
web_resource_service_->UnpackLogoSignal(*(test_json.get()));
@@ -88,7 +88,7 @@ TEST_F(PromoResourceServiceTest, UnpackLogoSignal) {
"}";
test_json->Clear();
test_json.reset(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false)));
+ base::JSONReader::Read(json)));
// Check that prefs are set correctly.
web_resource_service_->UnpackLogoSignal(*(test_json.get()));
@@ -107,7 +107,7 @@ TEST_F(PromoResourceServiceTest, UnpackLogoSignal) {
"}";
test_json->Clear();
test_json.reset(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false)));
+ base::JSONReader::Read(json)));
// Check that prefs are set correctly.
web_resource_service_->UnpackLogoSignal(*(test_json.get()));
@@ -150,7 +150,7 @@ class NotificationPromoTestDelegate : public NotificationPromo::Delegate {
notification_promo_ = notification_promo;
test_json_.reset(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false)));
+ base::JSONReader::Read(json)));
start_ = start;
end_ = end;
@@ -696,7 +696,7 @@ TEST_F(PromoResourceServiceTest, UnpackWebStoreSignal) {
" }"
"}";
scoped_ptr<DictionaryValue> test_json(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false)));
+ base::JSONReader::Read(json)));
// Set the source logo URL to verify that it gets cleared.
AppsPromo::SetSourcePromoLogoURL(GURL("https://www.google.com/test.png"));
@@ -732,7 +732,7 @@ TEST_F(PromoResourceServiceTest, UnpackPartialWebStoreSignal) {
" }"
"}";
scoped_ptr<DictionaryValue> test_json(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false)));
+ base::JSONReader::Read(json)));
// Check that prefs are set correctly.
web_resource_service_->UnpackWebStoreSignal(*(test_json.get()));
@@ -769,7 +769,7 @@ TEST_F(PromoResourceServiceTest, UnpackWebStoreSignalHttpsLogo) {
"}";
scoped_ptr<DictionaryValue> test_json(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false)));
+ base::JSONReader::Read(json)));
// Update the promo multiple times to verify the logo is cached correctly.
for (size_t i = 0; i < 2; ++i) {
@@ -829,7 +829,7 @@ TEST_F(PromoResourceServiceTest, UnpackWebStoreSignalHttpsLogoError) {
"}";
scoped_ptr<DictionaryValue> test_json(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false)));
+ base::JSONReader::Read(json)));
web_resource_service_->UnpackWebStoreSignal(*(test_json.get()));
@@ -880,7 +880,7 @@ TEST_F(PromoResourceServiceTest, UnpackWebStoreSignalHttpLogo) {
"}";
scoped_ptr<DictionaryValue> test_json(static_cast<DictionaryValue*>(
- base::JSONReader::Read(json, false)));
+ base::JSONReader::Read(json)));
web_resource_service_->UnpackWebStoreSignal(*(test_json.get()));
diff --git a/chrome/common/cloud_print/cloud_print_helpers.cc b/chrome/common/cloud_print/cloud_print_helpers.cc
index cebe4a3..e8f7650 100644
--- a/chrome/common/cloud_print/cloud_print_helpers.cc
+++ b/chrome/common/cloud_print/cloud_print_helpers.cc
@@ -47,7 +47,7 @@ GURL GetUrlForSubmit(const GURL& cloud_print_server_url) {
bool ParseResponseJSON(const std::string& response_data,
bool* succeeded,
DictionaryValue** response_dict) {
- scoped_ptr<Value> message_value(base::JSONReader::Read(response_data, false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(response_data));
if (!message_value.get())
return false;
diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc
index 44e3951..0b94a3c 100644
--- a/chrome/common/extensions/api/extension_api.cc
+++ b/chrome/common/extensions/api/extension_api.cc
@@ -68,7 +68,7 @@ scoped_ptr<ListValue> LoadSchemaList(const base::StringPiece& schema) {
scoped_ptr<Value> result(
base::JSONReader::ReadAndReturnError(
schema.as_string(),
- false, // allow trailing commas
+ base::JSON_PARSE_RFC, // options
NULL, // error code
&error_message));
CHECK(result.get()) << error_message;
diff --git a/chrome/common/extensions/simple_feature_provider.cc b/chrome/common/extensions/simple_feature_provider.cc
index 63741aa..08bed31 100644
--- a/chrome/common/extensions/simple_feature_provider.cc
+++ b/chrome/common/extensions/simple_feature_provider.cc
@@ -15,8 +15,6 @@ namespace extensions {
namespace {
-const bool kAllowTrailingComma = false;
-
template<class FeatureClass>
Feature* CreateFeature() {
return new FeatureClass();
@@ -48,7 +46,8 @@ struct Static {
int error_code = 0;
std::string error_message;
Value* value = base::JSONReader::ReadAndReturnError(
- manifest_features, kAllowTrailingComma, &error_code, &error_message);
+ manifest_features, base::JSON_PARSE_RFC,
+ &error_code, &error_message);
CHECK(value) << "Could not load features: " << debug_string << " "
<< error_message;
CHECK(value->IsType(Value::TYPE_DICTIONARY)) << debug_string;
diff --git a/chrome/common/json_value_serializer_unittest.cc b/chrome/common/json_value_serializer_unittest.cc
index a7b0c37..11982ec 100644
--- a/chrome/common/json_value_serializer_unittest.cc
+++ b/chrome/common/json_value_serializer_unittest.cc
@@ -195,7 +195,7 @@ TEST(JSONValueSerializerTest, AllowTrailingComma) {
namespace {
void ValidateJsonList(const std::string& json) {
- scoped_ptr<Value> root(base::JSONReader::Read(json, false));
+ scoped_ptr<Value> root(base::JSONReader::Read(json));
ASSERT_TRUE(root.get() && root->IsType(Value::TYPE_LIST));
ListValue* list = static_cast<ListValue*>(root.get());
ASSERT_EQ(1U, list->GetSize());
@@ -219,7 +219,7 @@ TEST(JSONValueSerializerTest, JSONReaderComments) {
scoped_ptr<Value> root;
// It's ok to have a comment in a string.
- root.reset(base::JSONReader::Read("[\"// ok\\n /* foo */ \"]", false));
+ root.reset(base::JSONReader::Read("[\"// ok\\n /* foo */ \"]"));
ASSERT_TRUE(root.get() && root->IsType(Value::TYPE_LIST));
ListValue* list = static_cast<ListValue*>(root.get());
ASSERT_EQ(1U, list->GetSize());
@@ -230,11 +230,11 @@ TEST(JSONValueSerializerTest, JSONReaderComments) {
ASSERT_EQ("// ok\n /* foo */ ", value);
// You can't nest comments.
- root.reset(base::JSONReader::Read("/* /* inner */ outer */ [ 1 ]", false));
+ root.reset(base::JSONReader::Read("/* /* inner */ outer */ [ 1 ]"));
ASSERT_FALSE(root.get());
// Not a open comment token.
- root.reset(base::JSONReader::Read("/ * * / [1]", false));
+ root.reset(base::JSONReader::Read("/ * * / [1]"));
ASSERT_FALSE(root.get());
}
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher.cc b/chrome/common/net/gaia/gaia_auth_fetcher.cc
index 002c0a6..cb759ad 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher.cc
+++ b/chrome/common/net/gaia/gaia_auth_fetcher.cc
@@ -407,8 +407,7 @@ bool GaiaAuthFetcher::ParseOAuth2TokenPairResponse(const std::string& data,
int* expires_in_secs) {
DCHECK(refresh_token);
DCHECK(access_token);
- base::JSONReader reader;
- scoped_ptr<base::Value> value(reader.Read(data, false));
+ scoped_ptr<base::Value> value(base::JSONReader::Read(data));
if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY)
return false;
diff --git a/chrome/common/net/gaia/gaia_oauth_client.cc b/chrome/common/net/gaia/gaia_oauth_client.cc
index f5fac42..eb4179d 100644
--- a/chrome/common/net/gaia/gaia_oauth_client.cc
+++ b/chrome/common/net/gaia/gaia_oauth_client.cc
@@ -144,7 +144,7 @@ void GaiaOAuthClient::Core::HandleResponse(
if (source->GetResponseCode() == net::HTTP_OK) {
std::string data;
source->GetResponseAsString(&data);
- scoped_ptr<Value> message_value(base::JSONReader::Read(data, false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(data));
if (message_value.get() &&
message_value->IsType(Value::TYPE_DICTIONARY)) {
scoped_ptr<DictionaryValue> response_dict(
diff --git a/chrome/common/net/gaia/oauth2_access_token_fetcher.cc b/chrome/common/net/gaia/oauth2_access_token_fetcher.cc
index 2523ba8..43db4a7 100644
--- a/chrome/common/net/gaia/oauth2_access_token_fetcher.cc
+++ b/chrome/common/net/gaia/oauth2_access_token_fetcher.cc
@@ -205,8 +205,7 @@ bool OAuth2AccessTokenFetcher::ParseGetAccessTokenResponse(
CHECK(access_token);
std::string data;
source->GetResponseAsString(&data);
- base::JSONReader reader;
- scoped_ptr<base::Value> value(reader.Read(data, false));
+ scoped_ptr<base::Value> value(base::JSONReader::Read(data));
if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY)
return false;
diff --git a/chrome/common/net/gaia/oauth2_mint_token_fetcher.cc b/chrome/common/net/gaia/oauth2_mint_token_fetcher.cc
index 84d2e0a..e573872 100644
--- a/chrome/common/net/gaia/oauth2_mint_token_fetcher.cc
+++ b/chrome/common/net/gaia/oauth2_mint_token_fetcher.cc
@@ -180,8 +180,7 @@ bool OAuth2MintTokenFetcher::ParseMintTokenResponse(
CHECK(access_token);
std::string data;
source->GetResponseAsString(&data);
- base::JSONReader reader;
- scoped_ptr<base::Value> value(reader.Read(data, false));
+ scoped_ptr<base::Value> value(base::JSONReader::Read(data));
if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY)
return false;
diff --git a/chrome/common/web_apps.cc b/chrome/common/web_apps.cc
index 5748f21..bfcf199 100644
--- a/chrome/common/web_apps.cc
+++ b/chrome/common/web_apps.cc
@@ -217,7 +217,7 @@ bool ParseWebAppFromDefinitionFile(Value* definition_value,
base::JSONReader::ReadAndReturnError(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_WEB_APP_SCHEMA).as_string(),
- false, // disallow trailing comma
+ base::JSON_PARSE_RFC, // options
&error_code,
&error_message));
DCHECK(schema.get())
diff --git a/chrome/common/web_resource/web_resource_unpacker.cc b/chrome/common/web_resource/web_resource_unpacker.cc
index e93ea36..34ed510 100644
--- a/chrome/common/web_resource/web_resource_unpacker.cc
+++ b/chrome/common/web_resource/web_resource_unpacker.cc
@@ -26,7 +26,7 @@ WebResourceUnpacker::~WebResourceUnpacker() {
bool WebResourceUnpacker::Run() {
scoped_ptr<Value> value;
if (!resource_data_.empty()) {
- value.reset(base::JSONReader::Read(resource_data_, false));
+ value.reset(base::JSONReader::Read(resource_data_));
if (!value.get()) {
// Page information not properly read, or corrupted.
error_message_ = kInvalidDataTypeError;
diff --git a/chrome/renderer/extensions/send_request_natives.cc b/chrome/renderer/extensions/send_request_natives.cc
index f493828..e5377ce 100644
--- a/chrome/renderer/extensions/send_request_natives.cc
+++ b/chrome/renderer/extensions/send_request_natives.cc
@@ -33,9 +33,7 @@ v8::Handle<v8::Value> SendRequestNatives::GetNextRequestId(
v8::Handle<v8::Value> SendRequestNatives::StartRequest(
const v8::Arguments& args) {
std::string str_args = *v8::String::Utf8Value(args[1]);
- base::JSONReader reader;
- scoped_ptr<Value> value_args;
- value_args.reset(reader.JsonToValue(str_args, false, false));
+ scoped_ptr<Value> value_args(base::JSONReader::Read(str_args));
// Since we do the serialization in the v8 extension, we should always get
// valid JSON.
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc
index e3440c7..cbaf2cd 100644
--- a/chrome/service/cloud_print/print_system_cups.cc
+++ b/chrome/service/cloud_print/print_system_cups.cc
@@ -510,8 +510,7 @@ bool PrintSystemCUPS::IsValidPrinter(const std::string& printer_name) {
bool PrintSystemCUPS::ValidatePrintTicket(const std::string& printer_name,
const std::string& print_ticket_data) {
DCHECK(initialized_);
- scoped_ptr<Value> ticket_value(base::JSONReader::Read(print_ticket_data,
- false));
+ scoped_ptr<Value> ticket_value(base::JSONReader::Read(print_ticket_data));
return ticket_value != NULL && ticket_value->IsType(Value::TYPE_DICTIONARY);
}
@@ -520,7 +519,7 @@ bool PrintSystemCUPS::ParsePrintTicket(
const std::string& print_ticket,
std::map<std::string, std::string>* options) {
DCHECK(options);
- scoped_ptr<Value> ticket_value(base::JSONReader::Read(print_ticket, false));
+ scoped_ptr<Value> ticket_value(base::JSONReader::Read(print_ticket));
if (ticket_value == NULL || !ticket_value->IsType(Value::TYPE_DICTIONARY))
return false;
diff --git a/chrome/test/automation/automation_json_requests.cc b/chrome/test/automation/automation_json_requests.cc
index bc2fbc8..11fc25a 100644
--- a/chrome/test/automation/automation_json_requests.cc
+++ b/chrome/test/automation/automation_json_requests.cc
@@ -46,7 +46,8 @@ bool SendAutomationJSONRequest(AutomationMessageSender* sender,
LOG(INFO) << error->message();
return false;
}
- scoped_ptr<Value> value(base::JSONReader::Read(reply, true));
+ scoped_ptr<Value> value(
+ base::JSONReader::Read(reply, base::JSON_ALLOW_TRAILING_COMMAS));
if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) {
*error = Error("JSON request did not return a dictionary");
LOG(ERROR) << "JSON request did not return dict: " << command << "\n";
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index 66a4b0a..4c2dae9 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -605,9 +605,8 @@ bool BrowserProxy::GetInitialLoadTimes(int timeout_ms,
return false;
}
std::string error;
- base::JSONReader reader;
- scoped_ptr<Value> values(reader.ReadAndReturnError(json_response, true,
- NULL, &error));
+ scoped_ptr<Value> values(base::JSONReader::ReadAndReturnError(
+ json_response, base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error));
if (!error.empty() || values->GetType() != Value::TYPE_DICTIONARY)
return false;
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index 26e8df9..58f585d 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -246,7 +246,8 @@ bool ExecuteJavaScriptHelper(RenderViewHost* render_view_host,
json.insert(0, "[");
json.append("]");
- scoped_ptr<Value> root_val(base::JSONReader::Read(json, true));
+ scoped_ptr<Value> root_val(
+ base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS));
if (!root_val->IsType(Value::TYPE_LIST)) {
DLOG(ERROR) << "JSON result is not a list.";
return false;
@@ -1105,7 +1106,8 @@ class SnapshotTaker {
// Parse the JSON.
std::vector<int> dimensions;
- scoped_ptr<Value> value(base::JSONReader::Read(json, true));
+ scoped_ptr<Value> value(
+ base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS));
if (!value->IsType(Value::TYPE_LIST))
return false;
ListValue* list = static_cast<ListValue*>(value.get());
diff --git a/chrome/test/perf/rendering/throughput_tests.cc b/chrome/test/perf/rendering/throughput_tests.cc
index 65ae690..2266de9 100644
--- a/chrome/test/perf/rendering/throughput_tests.cc
+++ b/chrome/test/perf/rendering/throughput_tests.cc
@@ -68,7 +68,7 @@ class ThroughputTest : public BrowserPerfTest {
const std::string& json,
int index) {
scoped_ptr<base::Value> root;
- root.reset(base::JSONReader::Read(json, false));
+ root.reset(base::JSONReader::Read(json));
ListValue* root_list = NULL;
if (!root.get() || !root->GetAsList(&root_list)) {
diff --git a/chrome/test/webdriver/webdriver_dispatch.cc b/chrome/test/webdriver/webdriver_dispatch.cc
index 33ac629..d5a2784 100644
--- a/chrome/test/webdriver/webdriver_dispatch.cc
+++ b/chrome/test/webdriver/webdriver_dispatch.cc
@@ -320,7 +320,7 @@ bool ParseRequestInfo(const struct mg_request_info* const request_info,
if (json.length() > 0) {
std::string error_msg;
scoped_ptr<Value> params(base::JSONReader::ReadAndReturnError(
- json, true, NULL, &error_msg));
+ json, base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error_msg));
if (!params.get()) {
response->SetError(new Error(
kBadRequest,
diff --git a/chrome/test/webdriver/webdriver_dispatch_unittest.cc b/chrome/test/webdriver/webdriver_dispatch_unittest.cc
index 9c4c22a..edee103 100644
--- a/chrome/test/webdriver/webdriver_dispatch_unittest.cc
+++ b/chrome/test/webdriver/webdriver_dispatch_unittest.cc
@@ -133,7 +133,7 @@ TEST(DispatchTest, ReturnsCommandResponseAsJson) {
int error_code;
std::string error_message;
scoped_ptr<Value> parsed_response(base::JSONReader::ReadAndReturnError(
- actual_data, false, &error_code, &error_message));
+ actual_data, base::JSON_PARSE_RFC, &error_code, &error_message));
ASSERT_TRUE(parsed_response.get() != NULL) << error_message;
ASSERT_TRUE(parsed_response->IsType(Value::TYPE_DICTIONARY))
diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc
index 6faabd6..af17a5c 100644
--- a/chrome/test/webdriver/webdriver_session.cc
+++ b/chrome/test/webdriver/webdriver_session.cc
@@ -1471,7 +1471,7 @@ Error* Session::ExecuteScriptAndParseValue(const FrameId& frame_id,
return error;
scoped_ptr<Value> value(base::JSONReader::ReadAndReturnError(
- response_json, true, NULL, NULL));
+ response_json, base::JSON_ALLOW_TRAILING_COMMAS, NULL, NULL));
if (!value.get())
return new Error(kUnknownError, "Failed to parse script result");
if (value->GetType() != Value::TYPE_DICTIONARY)
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index b479b47..ade6bd7 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -357,8 +357,8 @@ bool ChromeContentUtilityClient::RenderPDFToWinMetafile(
void ChromeContentUtilityClient::OnParseJSON(const std::string& json) {
int error_code;
std::string error;
- Value* value =
- base::JSONReader::ReadAndReturnError(json, false, &error_code, &error);
+ Value* value = base::JSONReader::ReadAndReturnError(
+ json, base::JSON_PARSE_RFC, &error_code, &error);
if (value) {
ListValue wrapper;
wrapper.Append(value);