summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 20:00:20 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 20:00:20 +0000
commit93d49d70b89b22ec46d0b00b7950297f64865d56 (patch)
tree3243e0209c738df0c18c2ba615667f757fcaec94 /chrome
parenta9f607e33a91604bc63bd8c846aefbda9bf0dfa9 (diff)
downloadchromium_src-93d49d70b89b22ec46d0b00b7950297f64865d56.zip
chromium_src-93d49d70b89b22ec46d0b00b7950297f64865d56.tar.gz
chromium_src-93d49d70b89b22ec46d0b00b7950297f64865d56.tar.bz2
Move the json-related files into a separate json directory. This hopefully also
makes the naming of string_escape more clear (it's actually JSON-specific). Move the files into the base namespace. TEST=none BUG=none Review URL: http://codereview.chromium.org/316016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_extension_function.cc10
-rw-r--r--chrome/browser/automation/automation_provider.cc4
-rw-r--r--chrome/browser/automation/extension_port_container.cc12
-rw-r--r--chrome/browser/bookmarks/bookmark_storage.cc1
-rw-r--r--chrome/browser/debugger/debugger_remote_service.cc10
-rw-r--r--chrome/browser/debugger/devtools_remote_service.cc8
-rw-r--r--chrome/browser/debugger/extension_ports_remote_service.cc12
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc9
-rw-r--r--chrome/browser/dom_ui/new_tab_page_sync_handler.cc1
-rw-r--r--chrome/browser/extensions/extension_bookmarks_module.cc12
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.cc24
-rw-r--r--chrome/browser/extensions/extension_function.cc4
-rw-r--r--chrome/browser/extensions/extension_message_service.cc4
-rw-r--r--chrome/browser/extensions/extension_toolstrip_api.cc4
-rw-r--r--chrome/browser/extensions/extension_uitest.cc17
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc4
-rw-r--r--chrome/browser/history/starred_url_database.cc4
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc4
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc12
-rw-r--r--chrome/browser/sync/sync_setup_wizard_unittest.cc4
-rw-r--r--chrome/common/json_value_serializer.cc12
-rw-r--r--chrome/common/json_value_serializer_unittest.cc14
-rw-r--r--chrome/common/sandbox_mac.mm4
-rw-r--r--chrome/common/web_resource/web_resource_unpacker.cc4
-rw-r--r--chrome/renderer/dom_ui_bindings.cc4
-rw-r--r--chrome/renderer/extensions/extension_api_client_unittest.cc4
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc8
-rw-r--r--chrome/test/ui_test_utils.cc4
28 files changed, 106 insertions, 108 deletions
diff --git a/chrome/browser/automation/automation_extension_function.cc b/chrome/browser/automation/automation_extension_function.cc
index 70e886a..98ca3c9 100644
--- a/chrome/browser/automation/automation_extension_function.cc
+++ b/chrome/browser/automation/automation_extension_function.cc
@@ -6,8 +6,8 @@
#include "chrome/browser/automation/automation_extension_function.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "chrome/browser/automation/extension_automation_constants.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -16,7 +16,7 @@
bool AutomationExtensionFunction::enabled_ = false;
void AutomationExtensionFunction::SetArgs(const Value* args) {
- JSONWriter::Write(args, false, &args_);
+ base::JSONWriter::Write(args, false, &args_);
}
const std::string AutomationExtensionFunction::GetResult() {
@@ -42,7 +42,7 @@ void AutomationExtensionFunction::Run() {
message_to_host.SetBoolean(keys::kAutomationHasCallbackKey, has_callback_);
std::string message;
- JSONWriter::Write(&message_to_host, false, &message);
+ base::JSONWriter::Write(&message_to_host, false, &message);
dispatcher()->render_view_host_->delegate()->ProcessExternalHostMessage(
message, keys::kAutomationOrigin, keys::kAutomationRequestTarget);
}
@@ -87,7 +87,7 @@ bool AutomationExtensionFunction::InterceptMessageFromExternalHost(
target == keys::kAutomationResponseTarget) {
// This is an extension API response being sent back via postMessage,
// so redirect it.
- scoped_ptr<Value> message_value(JSONReader::Read(message, false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(message, false));
DCHECK(message_value->IsType(Value::TYPE_DICTIONARY));
if (message_value->IsType(Value::TYPE_DICTIONARY)) {
DictionaryValue* message_dict =
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index c28322f..d791afb 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -9,7 +9,7 @@
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
#include "base/file_version_info.h"
-#include "base/json_reader.h"
+#include "base/json/json_reader.h"
#include "base/keyboard_codes.h"
#include "base/message_loop.h"
#include "base/path_service.h"
@@ -1662,7 +1662,7 @@ bool AutomationProvider::InterceptBrowserEventMessageFromExternalHost(
// The message is a JSON-encoded array with two elements, both strings. The
// first is the name of the event to dispatch. The second is a JSON-encoding
// of the arguments specific to that event.
- scoped_ptr<Value> message_value(JSONReader::Read(message, false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(message, false));
if (!message_value.get() || !message_value->IsType(Value::TYPE_LIST)) {
LOG(WARNING) << "Invalid browser event specified through automation";
return false;
diff --git a/chrome/browser/automation/extension_port_container.cc b/chrome/browser/automation/extension_port_container.cc
index a87bd82..246723d 100644
--- a/chrome/browser/automation/extension_port_container.cc
+++ b/chrome/browser/automation/extension_port_container.cc
@@ -5,8 +5,8 @@
#include "chrome/browser/automation/extension_port_container.h"
#include "base/logging.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/values.h"
#include "chrome/browser/automation/automation_provider.h"
#include "chrome/browser/automation/extension_automation_constants.h"
@@ -92,7 +92,7 @@ void ExtensionPortContainer::SendConnectionResponse(int connection_id,
msg_dict->SetInteger(ext::kAutomationPortIdKey, port_id);
std::string msg_json;
- JSONWriter::Write(msg_dict.get(), false, &msg_json);
+ base::JSONWriter::Write(msg_dict.get(), false, &msg_json);
PostResponseToExternalPort(msg_json);
}
@@ -141,7 +141,7 @@ void ExtensionPortContainer::OnExtensionHandleMessage(
msg_dict.SetString(ext::kAutomationMessageDataKey, message);
std::string msg_json;
- JSONWriter::Write(&msg_dict, false, &msg_json);
+ base::JSONWriter::Write(&msg_dict, false, &msg_json);
PostMessageToExternalPort(msg_json);
}
@@ -153,7 +153,7 @@ void ExtensionPortContainer::OnExtensionPortDisconnected(int source_port_id) {
msg_dict.SetInteger(ext::kAutomationPortIdKey, port_id_);
std::string msg_json;
- JSONWriter::Write(&msg_dict, false, &msg_json);
+ base::JSONWriter::Write(&msg_dict, false, &msg_json);
PostMessageToExternalPort(msg_json);
}
@@ -170,7 +170,7 @@ bool ExtensionPortContainer::InterceptMessageFromExternalHost(
LOG(WARNING) << "Wrong origin on automation port message " << origin;
}
- scoped_ptr<Value> message_value(JSONReader::Read(message, false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(message, false));
DCHECK(message_value->IsType(Value::TYPE_DICTIONARY));
if (!message_value->IsType(Value::TYPE_DICTIONARY))
return true;
diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc
index a187921..fb629a9 100644
--- a/chrome/browser/bookmarks/bookmark_storage.cc
+++ b/chrome/browser/bookmarks/bookmark_storage.cc
@@ -7,7 +7,6 @@
#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/histogram.h"
-#include "base/json_writer.h"
#include "base/message_loop.h"
#include "base/thread.h"
#include "base/time.h"
diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc
index 9a46c63..8f941ca 100644
--- a/chrome/browser/debugger/debugger_remote_service.cc
+++ b/chrome/browser/debugger/debugger_remote_service.cc
@@ -7,8 +7,8 @@
#include "chrome/browser/debugger/debugger_remote_service.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
@@ -65,7 +65,7 @@ DebuggerRemoteService::~DebuggerRemoteService() {}
void DebuggerRemoteService::HandleMessage(
const DevToolsRemoteMessage& message) {
const std::string destination = message.destination();
- scoped_ptr<Value> request(JSONReader::Read(message.content(), true));
+ scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true));
if (request.get() == NULL) {
// Bad JSON
NOTREACHED();
@@ -129,7 +129,7 @@ void DebuggerRemoteService::SendResponse(const Value& response,
const std::string& tool,
const std::string& destination) {
std::string response_content;
- JSONWriter::Write(&response, false, &response_content);
+ base::JSONWriter::Write(&response, false, &response_content);
scoped_ptr<DevToolsRemoteMessage> response_message(
DevToolsRemoteMessageBuilder::instance().Create(tool,
destination,
@@ -304,7 +304,7 @@ bool DebuggerRemoteService::DispatchDebuggerCommand(int tab_uid,
std::string v8_command;
DictionaryValue* v8_command_value;
content->GetDictionary(kDataWide, &v8_command_value);
- JSONWriter::Write(v8_command_value, false, &v8_command);
+ base::JSONWriter::Write(v8_command_value, false, &v8_command);
manager->ForwardToDevToolsAgent(
client_host, DevToolsAgentMsg_DebuggerCommand(v8_command));
// Do not send the response right now, as the JSON will be received from
diff --git a/chrome/browser/debugger/devtools_remote_service.cc b/chrome/browser/debugger/devtools_remote_service.cc
index 4308d18..3f786af9 100644
--- a/chrome/browser/debugger/devtools_remote_service.cc
+++ b/chrome/browser/debugger/devtools_remote_service.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
@@ -32,7 +32,7 @@ DevToolsRemoteService::~DevToolsRemoteService() {}
void DevToolsRemoteService::HandleMessage(
const DevToolsRemoteMessage& message) {
- scoped_ptr<Value> request(JSONReader::Read(message.content(), false));
+ scoped_ptr<Value> request(base::JSONReader::Read(message.content(), false));
if (request.get() == NULL) {
// Bad JSON
NOTREACHED();
@@ -94,7 +94,7 @@ void DevToolsRemoteService::ProcessJson(DictionaryValue* json,
response.SetInteger(kResultWide, Result::kUnknownCommand);
}
std::string response_json;
- JSONWriter::Write(&response, false, &response_json);
+ base::JSONWriter::Write(&response, false, &response_json);
scoped_ptr<DevToolsRemoteMessage> response_message(
DevToolsRemoteMessageBuilder::instance().Create(message.tool(),
message.destination(),
diff --git a/chrome/browser/debugger/extension_ports_remote_service.cc b/chrome/browser/debugger/extension_ports_remote_service.cc
index 68057bd..ed40e99 100644
--- a/chrome/browser/debugger/extension_ports_remote_service.cc
+++ b/chrome/browser/debugger/extension_ports_remote_service.cc
@@ -9,8 +9,8 @@
#include "chrome/browser/debugger/extension_ports_remote_service.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/values.h"
@@ -147,7 +147,7 @@ void ExtensionPortsRemoteService::HandleMessage(
const DevToolsRemoteMessage& message) {
DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
const std::string destinationString = message.destination();
- scoped_ptr<Value> request(JSONReader::Read(message.content(), true));
+ scoped_ptr<Value> request(base::JSONReader::Read(message.content(), true));
if (request.get() == NULL) {
// Bad JSON
NOTREACHED();
@@ -220,7 +220,7 @@ void ExtensionPortsRemoteService::SendResponse(
const Value& response, const std::string& tool,
const std::string& destination) {
std::string response_content;
- JSONWriter::Write(&response, false, &response_content);
+ base::JSONWriter::Write(&response, false, &response_content);
scoped_ptr<DevToolsRemoteMessage> response_message(
DevToolsRemoteMessageBuilder::instance().Create(
tool, destination, response_content));
@@ -271,7 +271,7 @@ void ExtensionPortsRemoteService::OnExtensionMessage(
content.SetString(kCommandWide, kOnMessage);
content.SetInteger(kResultWide, RESULT_OK);
// Turn the stringified message body back into JSON.
- Value* data = JSONReader::Read(message, false);
+ Value* data = base::JSONReader::Read(message, false);
if (!data) {
NOTREACHED();
return;
@@ -374,7 +374,7 @@ void ExtensionPortsRemoteService::PostMessageCommand(
}
std::string message;
// Stringified the JSON message body.
- JSONWriter::Write(data, false, &message);
+ base::JSONWriter::Write(data, false, &message);
LOG(INFO) << "postMessage: port " << port_id
<< ", message: <" << message << ">";
PortIdSet::iterator portEntry = openPortIds_.find(port_id);
diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc
index 7f38aef..34c5956 100644
--- a/chrome/browser/dom_ui/dom_ui.cc
+++ b/chrome/browser/dom_ui/dom_ui.cc
@@ -5,8 +5,7 @@
#include "chrome/browser/dom_ui/dom_ui.h"
#include "app/l10n_util.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/values.h"
@@ -56,7 +55,7 @@ void DOMUI::CallJavascriptFunction(const std::wstring& function_name) {
void DOMUI::CallJavascriptFunction(const std::wstring& function_name,
const Value& arg) {
std::string json;
- JSONWriter::Write(&arg, false, &json);
+ base::JSONWriter::Write(&arg, false, &json);
std::wstring javascript = function_name + L"(" + UTF8ToWide(json) + L");";
ExecuteJavascript(javascript);
@@ -66,9 +65,9 @@ void DOMUI::CallJavascriptFunction(
const std::wstring& function_name,
const Value& arg1, const Value& arg2) {
std::string json;
- JSONWriter::Write(&arg1, false, &json);
+ base::JSONWriter::Write(&arg1, false, &json);
std::wstring javascript = function_name + L"(" + UTF8ToWide(json);
- JSONWriter::Write(&arg2, false, &json);
+ base::JSONWriter::Write(&arg2, false, &json);
javascript += L"," + UTF8ToWide(json) + L");";
ExecuteJavascript(javascript);
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
index b4db8b3..ff63cf6 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
@@ -7,7 +7,6 @@
#include "chrome/browser/dom_ui/new_tab_page_sync_handler.h"
#include "app/l10n_util.h"
-#include "base/json_writer.h"
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/net/chrome_url_request_context.h"
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc
index 0724a5a..73cb032 100644
--- a/chrome/browser/extensions/extension_bookmarks_module.cc
+++ b/chrome/browser/extensions/extension_bookmarks_module.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/extensions/extension_bookmarks_module.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/string_util.h"
#include "chrome/browser/bookmarks/bookmark_codec.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -185,7 +185,7 @@ void ExtensionBookmarkEventRouter::BookmarkNodeMoved(
args.Append(object_args);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(model->profile(), keys::kOnBookmarkMoved, json_args);
}
@@ -199,7 +199,7 @@ void ExtensionBookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model,
args.Append(obj);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(model->profile(), keys::kOnBookmarkCreated, json_args);
}
@@ -216,7 +216,7 @@ void ExtensionBookmarkEventRouter::BookmarkNodeRemoved(
args.Append(object_args);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(model->profile(), keys::kOnBookmarkRemoved, json_args);
}
@@ -235,7 +235,7 @@ void ExtensionBookmarkEventRouter::BookmarkNodeChanged(
args.Append(object_args);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(model->profile(), keys::kOnBookmarkChanged, json_args);
}
@@ -260,7 +260,7 @@ void ExtensionBookmarkEventRouter::BookmarkNodeChildrenReordered(
args.Append(reorder_info);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(model->profile(),
keys::kOnBookmarkChildrenReordered,
json_args);
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index fceb610..b6bfebc 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/extensions/extension_browser_event_router.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/values.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/profile.h"
@@ -100,7 +100,7 @@ static void DispatchSimpleBrowserEvent(Profile* profile,
args.Append(Value::CreateIntegerValue(window_id));
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(profile, event_name, json_args);
}
@@ -134,7 +134,7 @@ void ExtensionBrowserEventRouter::OnBrowserWindowReady(const Browser* browser) {
args.Append(window_dictionary);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(browser->profile(), events::kOnWindowCreated, json_args);
}
@@ -164,7 +164,7 @@ void ExtensionBrowserEventRouter::TabCreatedAt(TabContents* contents,
ListValue args;
args.Append(ExtensionTabUtil::CreateTabValue(contents));
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(contents->profile(), events::kOnTabCreated, json_args);
@@ -202,7 +202,7 @@ void ExtensionBrowserEventRouter::TabInsertedAt(TabContents* contents,
args.Append(object_args);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(contents->profile(), events::kOnTabAttached, json_args);
}
@@ -226,7 +226,7 @@ void ExtensionBrowserEventRouter::TabDetachedAt(TabContents* contents,
args.Append(object_args);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(contents->profile(), events::kOnTabDetached, json_args);
}
@@ -239,7 +239,7 @@ void ExtensionBrowserEventRouter::TabClosingAt(TabContents* contents,
args.Append(Value::CreateIntegerValue(tab_id));
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(contents->profile(), events::kOnTabRemoved, json_args);
@@ -266,7 +266,7 @@ void ExtensionBrowserEventRouter::TabSelectedAt(TabContents* old_contents,
args.Append(object_args);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(new_contents->profile(), events::kOnTabSelectionChanged,
json_args);
@@ -289,7 +289,7 @@ void ExtensionBrowserEventRouter::TabMoved(TabContents* contents,
args.Append(object_args);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(contents->profile(), events::kOnTabMoved, json_args);
}
@@ -315,7 +315,7 @@ void ExtensionBrowserEventRouter::TabUpdated(TabContents* contents,
args.Append(changed_properties);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
DispatchEvent(contents->profile(), events::kOnTabUpdated, json_args);
}
@@ -368,7 +368,7 @@ void ExtensionBrowserEventRouter::PageActionExecuted(
args.Append(data);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
std::string event_name = std::string("pageAction/") + extension_id;
DispatchEvent(profile, event_name.c_str(), json_args);
@@ -384,7 +384,7 @@ void ExtensionBrowserEventRouter::BrowserActionExecuted(
ListValue args;
args.Append(ExtensionTabUtil::CreateTabValue(tab_contents));
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
std::string event_name = std::string("browserAction/") + extension_id;
DispatchEvent(profile, event_name.c_str(), json_args);
diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc
index c15c18b..b8aaae1 100644
--- a/chrome/browser/extensions/extension_function.cc
+++ b/chrome/browser/extensions/extension_function.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/extensions/extension_function.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/logging.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
@@ -17,7 +17,7 @@ const std::string AsyncExtensionFunction::GetResult() {
std::string json;
// Some functions might not need to return any results.
if (result_.get())
- JSONWriter::Write(result_.get(), false, &json);
+ base::JSONWriter::Write(result_.get(), false, &json);
return json;
}
diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc
index 66587b7..9107c4b 100644
--- a/chrome/browser/extensions/extension_message_service.cc
+++ b/chrome/browser/extensions/extension_message_service.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/extensions/extension_message_service.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/singleton.h"
#include "base/stl_util-inl.h"
#include "base/values.h"
@@ -322,7 +322,7 @@ bool ExtensionMessageService::OpenChannelOnUIThreadImpl(
if (source_contents) {
DictionaryValue* tab_value =
ExtensionTabUtil::CreateTabValue(source_contents);
- JSONWriter::Write(tab_value, false, &tab_json);
+ base::JSONWriter::Write(tab_value, false, &tab_json);
}
CHECK(receiver.sender);
diff --git a/chrome/browser/extensions/extension_toolstrip_api.cc b/chrome/browser/extensions/extension_toolstrip_api.cc
index 58950ae..3c52b16 100644
--- a/chrome/browser/extensions/extension_toolstrip_api.cc
+++ b/chrome/browser/extensions/extension_toolstrip_api.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/extensions/extension_toolstrip_api.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/string_util.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/extensions/extension_host.h"
@@ -131,7 +131,7 @@ void ToolstripEventRouter::DispatchEvent(Profile *profile,
const Value& json) {
if (profile->GetExtensionMessageService()) {
std::string json_args;
- JSONWriter::Write(&json, false, &json_args);
+ base::JSONWriter::Write(&json, false, &json_args);
std::string full_event_name = StringPrintf(event_name, routing_id);
profile->GetExtensionMessageService()->
DispatchEventToRenderers(full_event_name, json_args);
diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc
index 4a16cc8..df0b9e8b 100644
--- a/chrome/browser/extensions/extension_uitest.cc
+++ b/chrome/browser/extensions/extension_uitest.cc
@@ -4,8 +4,8 @@
#include "base/command_line.h"
#include "base/gfx/rect.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/values.h"
#include "chrome/browser/automation/extension_automation_constants.h"
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
@@ -146,7 +146,8 @@ TEST_F(SimpleApiCallExtensionTest, RunTest) {
EXPECT_TRUE(proxy->origin() == keys::kAutomationOrigin);
EXPECT_TRUE(proxy->target() == keys::kAutomationRequestTarget);
- scoped_ptr<Value> message_value(JSONReader::Read(proxy->message(), false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(proxy->message(),
+ false));
ASSERT_TRUE(message_value->IsType(Value::TYPE_DICTIONARY));
DictionaryValue* message_dict =
reinterpret_cast<DictionaryValue*>(message_value.get());
@@ -231,7 +232,7 @@ class RoundtripAutomationProxy : public MultiMessageAutomationProxy {
EXPECT_TRUE(origin_ == keys::kAutomationOrigin);
EXPECT_TRUE(target_ == keys::kAutomationRequestTarget);
- scoped_ptr<Value> message_value(JSONReader::Read(message_, false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(message_, false));
ASSERT_TRUE(message_value->IsType(Value::TYPE_DICTIONARY));
DictionaryValue* request_dict =
static_cast<DictionaryValue*>(message_value.get());
@@ -266,13 +267,13 @@ class RoundtripAutomationProxy : public MultiMessageAutomationProxy {
extension_tabs_module_constants::kUrlKey, "http://www.google.com"));
std::string tab_json;
- JSONWriter::Write(&tab_dict, false, &tab_json);
+ base::JSONWriter::Write(&tab_dict, false, &tab_json);
EXPECT_TRUE(response_dict.SetString(keys::kAutomationResponseKey,
tab_json));
std::string response_json;
- JSONWriter::Write(&response_dict, false, &response_json);
+ base::JSONWriter::Write(&response_dict, false, &response_json);
tab_->HandleMessageFromExternalHost(
response_json,
@@ -409,7 +410,7 @@ void BrowserEventAutomationProxy::HandleMessageFromChrome() {
// This should be a request for the current window. We don't need to
// respond, as this is used only as an indication that the extension
// page is now loaded.
- scoped_ptr<Value> message_value(JSONReader::Read(message, false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(message, false));
ASSERT_TRUE(message_value->IsType(Value::TYPE_DICTIONARY));
DictionaryValue* message_dict =
reinterpret_cast<DictionaryValue*>(message_value.get());
@@ -441,7 +442,7 @@ void BrowserEventAutomationProxy::HandleMessageFromChrome() {
// There is a special message "ACK" which means that the extension
// received the port connection. This is not an event response and
// should happen before all events.
- scoped_ptr<Value> message_value(JSONReader::Read(message, false));
+ scoped_ptr<Value> message_value(base::JSONReader::Read(message, false));
ASSERT_TRUE(message_value->IsType(Value::TYPE_DICTIONARY));
DictionaryValue* message_dict =
reinterpret_cast<DictionaryValue*>(message_value.get());
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index f2e357d..44c35c4 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -7,7 +7,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
-#include "base/json_reader.h"
+#include "base/json/json_reader.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
@@ -613,7 +613,7 @@ TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectoryFail) {
EXPECT_TRUE(MatchPattern(GetErrors()[0],
std::string("Could not load extension from '*'. * ") +
- JSONReader::kBadRootElementType)) << GetErrors()[0];
+ base::JSONReader::kBadRootElementType)) << GetErrors()[0];
EXPECT_TRUE(MatchPattern(GetErrors()[1],
std::string("Could not load extension from '*'. ") +
diff --git a/chrome/browser/history/starred_url_database.cc b/chrome/browser/history/starred_url_database.cc
index 31e659c..55aa0dd 100644
--- a/chrome/browser/history/starred_url_database.cc
+++ b/chrome/browser/history/starred_url_database.cc
@@ -8,7 +8,7 @@
#include "app/sql/statement.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/scoped_vector.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
@@ -620,7 +620,7 @@ bool StarredURLDatabase::MigrateBookmarksToFileImpl(const FilePath& path) {
scoped_ptr<Value> encoded_bookmarks(
encoder.Encode(&bookmark_bar_node, &other_node));
std::string content;
- JSONWriter::Write(encoded_bookmarks.get(), true, &content);
+ base::JSONWriter::Write(encoded_bookmarks.get(), true, &content);
return (file_util::WriteFile(path, content.c_str(),
static_cast<int>(content.length())) != -1);
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index b59b0ce..5d3e350 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -11,7 +11,7 @@
#include "app/gfx/native_widget_types.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "base/json_reader.h"
+#include "base/json/json_reader.h"
#include "base/string_util.h"
#include "base/time.h"
#include "base/waitable_event.h"
@@ -1220,7 +1220,7 @@ void RenderViewHost::OnMsgDOMUISend(
const bool kHasCallback = false;
scoped_ptr<Value> value;
if (!content.empty()) {
- value.reset(JSONReader::Read(content, false));
+ value.reset(base::JSONReader::Read(content, false));
if (!value.get()) {
// The page sent us something that we didn't understand.
// This probably indicates a programming error.
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index 4b5d241..50ab515 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -9,8 +9,8 @@
#include "app/gfx/font.h"
#include "app/gfx/font_util.h"
#include "base/histogram.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -59,7 +59,7 @@ void FlowHandler::RegisterMessages() {
static bool GetUsernameAndPassword(const std::string& json,
std::string* username, std::string* password) {
- scoped_ptr<Value> parsed_value(JSONReader::Read(json, false));
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY))
return false;
@@ -96,7 +96,7 @@ void FlowHandler::HandleSubmitMergeAndSync(const Value* value) {
// Called by SyncSetupFlow::Advance.
void FlowHandler::ShowGaiaLogin(const DictionaryValue& args) {
std::string json;
- JSONWriter::Write(&args, false, &json);
+ base::JSONWriter::Write(&args, false, &json);
std::wstring javascript = std::wstring(L"showGaiaLogin") +
L"(" + UTF8ToWide(json) + L");";
ExecuteJavascriptInIFrame(kLoginIFrameXPath, javascript);
@@ -120,7 +120,7 @@ void FlowHandler::ShowSetupDone(const std::wstring& user) {
StringValue synced_to_string(WideToUTF8(l10n_util::GetStringF(
IDS_SYNC_NTP_SYNCED_TO, user)));
std::string json;
- JSONWriter::Write(&synced_to_string, false, &json);
+ base::JSONWriter::Write(&synced_to_string, false, &json);
std::wstring javascript = std::wstring(L"setSyncedToUser") +
L"(" + UTF8ToWide(json) + L");";
ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript);
@@ -287,7 +287,7 @@ SyncSetupFlow* SyncSetupFlow::Run(ProfileSyncService* service,
if (start == SyncSetupWizard::GAIA_LOGIN)
SyncSetupFlow::GetArgsForGaiaLogin(service, &args);
std::string json_args;
- JSONWriter::Write(&args, false, &json_args);
+ base::JSONWriter::Write(&args, false, &json_args);
Browser* b = BrowserList::GetLastActive();
if (!b)
diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc
index b4cb572..847750f 100644
--- a/chrome/browser/sync/sync_setup_wizard_unittest.cc
+++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc
@@ -5,7 +5,7 @@
#include "testing/gtest/include/gtest/gtest.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/browser.h"
@@ -175,7 +175,7 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) {
DictionaryValue dialog_args;
SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args);
std::string json_start_args;
- JSONWriter::Write(&dialog_args, false, &json_start_args);
+ base::JSONWriter::Write(&dialog_args, false, &json_start_args);
ListValue credentials;
std::string auth = "{\"user\":\"";
auth += std::string(kTestUser) + "\",\"pass\":\"";
diff --git a/chrome/common/json_value_serializer.cc b/chrome/common/json_value_serializer.cc
index 33f94ce..1e739e6 100644
--- a/chrome/common/json_value_serializer.cc
+++ b/chrome/common/json_value_serializer.cc
@@ -5,8 +5,8 @@
#include "chrome/common/json_value_serializer.h"
#include "base/file_util.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/string_util.h"
JSONStringValueSerializer::~JSONStringValueSerializer() {}
@@ -15,8 +15,7 @@ bool JSONStringValueSerializer::Serialize(const Value& root) {
if (!json_string_ || initialized_with_const_string_)
return false;
- JSONWriter::Write(&root, pretty_print_, json_string_);
-
+ base::JSONWriter::Write(&root, pretty_print_, json_string_);
return true;
}
@@ -24,8 +23,9 @@ Value* JSONStringValueSerializer::Deserialize(std::string* error_message) {
if (!json_string_)
return NULL;
- return JSONReader::ReadAndReturnError(*json_string_, allow_trailing_comma_,
- error_message);
+ return base::JSONReader::ReadAndReturnError(*json_string_,
+ allow_trailing_comma_,
+ error_message);
}
/******* File Serializer *******/
diff --git a/chrome/common/json_value_serializer_unittest.cc b/chrome/common/json_value_serializer_unittest.cc
index e622458..d1475ec 100644
--- a/chrome/common/json_value_serializer_unittest.cc
+++ b/chrome/common/json_value_serializer_unittest.cc
@@ -4,8 +4,8 @@
#include "base/basictypes.h"
#include "base/file_util.h"
-#include "base/json_reader.h"
-#include "base/json_writer.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/values.h"
@@ -106,7 +106,7 @@ TEST(JSONValueSerializerTest, StringEscape) {
std::string output_js;
DictionaryValue valueRoot;
valueRoot.SetString(L"all_chars", all_chars);
- JSONWriter::Write(&valueRoot, false, &output_js);
+ base::JSONWriter::Write(&valueRoot, false, &output_js);
ASSERT_EQ(expected_output, output_js);
// Test JSONValueSerializer interface (uses JSONWriter).
@@ -191,7 +191,7 @@ TEST(JSONValueSerializerTest, AllowTrailingComma) {
namespace {
void ValidateJsonList(const std::string& json) {
- scoped_ptr<Value> root(JSONReader::Read(json, false));
+ scoped_ptr<Value> root(base::JSONReader::Read(json, false));
ASSERT_TRUE(root.get() && root->IsType(Value::TYPE_LIST));
ListValue* list = static_cast<ListValue*>(root.get());
ASSERT_EQ(1U, list->GetSize());
@@ -215,7 +215,7 @@ TEST(JSONValueSerializerTest, JSONReaderComments) {
scoped_ptr<Value> root;
// It's ok to have a comment in a string.
- root.reset(JSONReader::Read("[\"// ok\\n /* foo */ \"]", false));
+ root.reset(base::JSONReader::Read("[\"// ok\\n /* foo */ \"]", false));
ASSERT_TRUE(root.get() && root->IsType(Value::TYPE_LIST));
ListValue* list = static_cast<ListValue*>(root.get());
ASSERT_EQ(1U, list->GetSize());
@@ -226,11 +226,11 @@ TEST(JSONValueSerializerTest, JSONReaderComments) {
ASSERT_EQ(L"// ok\n /* foo */ ", value);
// You can't nest comments.
- root.reset(JSONReader::Read("/* /* inner */ outer */ [ 1 ]", false));
+ root.reset(base::JSONReader::Read("/* /* inner */ outer */ [ 1 ]", false));
ASSERT_FALSE(root.get());
// Not a open comment token.
- root.reset(JSONReader::Read("/ * * / [1]", false));
+ root.reset(base::JSONReader::Read("/ * * / [1]", false));
ASSERT_FALSE(root.get());
}
diff --git a/chrome/common/sandbox_mac.mm b/chrome/common/sandbox_mac.mm
index 5ffe0d4..ae55b52 100644
--- a/chrome/common/sandbox_mac.mm
+++ b/chrome/common/sandbox_mac.mm
@@ -13,11 +13,11 @@ extern "C" {
#include "base/basictypes.h"
#include "base/command_line.h"
+#include "base/json/string_escape.h"
#include "base/mac_util.h"
#include "base/scoped_cftyperef.h"
#include "base/scoped_nsautorelease_pool.h"
#include "base/string16.h"
-#include "base/string_escape.h"
#include "base/sys_info.h"
#include "base/sys_string_conversions.h"
#include "chrome/common/chrome_switches.h"
@@ -125,7 +125,7 @@ bool EnableSandbox() {
// surrounding sandbox syntax.
string16 home_dir = base::SysNSStringToUTF16(NSHomeDirectory());
std::string home_dir_escaped;
- string_escape::JsonDoubleQuote(home_dir, false, &home_dir_escaped);
+ base::JsonDoubleQuote(home_dir, false, &home_dir_escaped);
NSString* home_dir_escaped_ns = base::SysUTF8ToNSString(home_dir_escaped);
sandbox_data = [sandbox_data
stringByReplacingOccurrencesOfString:@"USER_HOMEDIR"
diff --git a/chrome/common/web_resource/web_resource_unpacker.cc b/chrome/common/web_resource/web_resource_unpacker.cc
index 7f0ced4..bbb14cf 100644
--- a/chrome/common/web_resource/web_resource_unpacker.cc
+++ b/chrome/common/web_resource/web_resource_unpacker.cc
@@ -4,7 +4,7 @@
#include "chrome/common/web_resource/web_resource_unpacker.h"
-#include "base/json_reader.h"
+#include "base/json/json_reader.h"
#include "base/values.h"
const char* WebResourceUnpacker::kInvalidDataTypeError =
@@ -19,7 +19,7 @@ const char* WebResourceUnpacker::kUnexpectedJSONFormatError =
bool WebResourceUnpacker::Run() {
scoped_ptr<Value> value;
if (!resource_data_.empty()) {
- value.reset(JSONReader::Read(resource_data_, false));
+ value.reset(base::JSONReader::Read(resource_data_, false));
if (!value.get()) {
// Page information not properly read, or corrupted.
error_message_ = kInvalidDataTypeError;
diff --git a/chrome/renderer/dom_ui_bindings.cc b/chrome/renderer/dom_ui_bindings.cc
index ff9ef18..1183ceb 100644
--- a/chrome/renderer/dom_ui_bindings.cc
+++ b/chrome/renderer/dom_ui_bindings.cc
@@ -4,7 +4,7 @@
#include "chrome/renderer/dom_ui_bindings.h"
-#include "base/json_writer.h"
+#include "base/json/json_writer.h"
#include "base/stl_util-inl.h"
#include "base/values.h"
#include "chrome/common/render_messages.h"
@@ -40,7 +40,7 @@ void DOMUIBindings::send(const CppArgumentList& args, CppVariant* result) {
for (size_t i = 0; i < strings.size(); ++i) {
value.Append(Value::CreateStringValue(strings[i]));
}
- JSONWriter::Write(&value, /* pretty_print= */ false, &content);
+ base::JSONWriter::Write(&value, /* pretty_print= */ false, &content);
}
// Send the message up to the browser.
diff --git a/chrome/renderer/extensions/extension_api_client_unittest.cc b/chrome/renderer/extensions/extension_api_client_unittest.cc
index 0900803..ac06153 100644
--- a/chrome/renderer/extensions/extension_api_client_unittest.cc
+++ b/chrome/renderer/extensions/extension_api_client_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/file_util.h"
-#include "base/json_reader.h"
+#include "base/json/json_reader.h"
#include "base/path_service.h"
#include "base/string_util.h"
#include "chrome/common/chrome_paths.h"
@@ -59,7 +59,7 @@ class ExtensionAPIClientTest : public RenderViewTest {
ASSERT_TRUE(params.b.IsType(Value::TYPE_LIST));
ASSERT_TRUE(static_cast<const ListValue*>(&params.b)->Get(0, &args));
- JSONReader reader;
+ base::JSONReader reader;
scoped_ptr<Value> arg1_value(reader.JsonToValue(arg1, false, false));
ASSERT_TRUE(args->Equals(arg1_value.get())) << js;
render_thread_.sink().ClearMessages();
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 9641c23..2e8d036 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/renderer/extensions/extension_process_bindings.h"
+
#include <map>
#include <set>
#include <string>
#include <vector>
-#include "chrome/renderer/extensions/extension_process_bindings.h"
-
-#include "base/json_reader.h"
+#include "base/json/json_reader.h"
#include "base/singleton.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_message_bundle.h"
@@ -397,7 +397,7 @@ class ExtensionImpl : public ExtensionBase {
// callback will be dispatched to EventBindings::HandleResponse.
static v8::Handle<v8::Value> StartRequest(const v8::Arguments& args) {
std::string str_args = *v8::String::Utf8Value(args[1]);
- JSONReader reader;
+ base::JSONReader reader;
Value* value_args = reader.JsonToValue(str_args, false, false);
// Since we do the serialization in the v8 extension, we should always get
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index fca8beb..4a0ef2a 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -6,7 +6,7 @@
#include <vector>
-#include "base/json_reader.h"
+#include "base/json/json_reader.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/process_util.h"
@@ -397,7 +397,7 @@ Value* ExecuteJavaScript(RenderViewHost* render_view_host,
json.insert(0, "[");
json.append("]");
- scoped_ptr<Value> root_val(JSONReader::Read(json, true));
+ scoped_ptr<Value> root_val(base::JSONReader::Read(json, true));
if (!root_val->IsType(Value::TYPE_LIST))
return NULL;