summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 16:00:32 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 16:00:32 +0000
commit4f4dc2f3fcb01bc6402cbaa83d0935194f992cb5 (patch)
tree03be2eea80b1048c588f5883247bcc776566f76f /chrome
parent07fc26a8ea76b29d6deb598664ed7b54b9ed2606 (diff)
downloadchromium_src-4f4dc2f3fcb01bc6402cbaa83d0935194f992cb5.zip
chromium_src-4f4dc2f3fcb01bc6402cbaa83d0935194f992cb5.tar.gz
chromium_src-4f4dc2f3fcb01bc6402cbaa83d0935194f992cb5.tar.bz2
Convert devtools interfaces over to using WebString.
Also converts some internal std::string usage to WebCore::String. Note: copying WebString to WebCore::String is very cheap (just increments a reference count). The ugly WebStringToString and StringToWebString calls inside the devtools implementation are temporary. Once this code moves into the WebKit API implementation, those methods will go away. I thought about changing the devtools IPCs to use string16 instead of std::string because that would avoid the UTF8 conversions. I'm not sure if that is worth it though given that UTF16 would increase the amount of data being sent over IPC. I figure this is something that could be studied later. R=pfeldman BUG=24597 TEST=none Review URL: http://codereview.chromium.org/264077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29286 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/devtools_agent.cc29
-rw-r--r--chrome/renderer/devtools_agent.h10
-rw-r--r--chrome/renderer/devtools_agent_filter.cc6
-rw-r--r--chrome/renderer/devtools_client.cc35
-rw-r--r--chrome/renderer/devtools_client.h12
5 files changed, 59 insertions, 33 deletions
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc
index aa6baad3..7d0f279 100644
--- a/chrome/renderer/devtools_agent.cc
+++ b/chrome/renderer/devtools_agent.cc
@@ -7,8 +7,11 @@
#include "chrome/common/devtools_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/render_view.h"
+#include "webkit/api/public/WebString.h"
#include "webkit/glue/webdevtoolsagent.h"
+using WebKit::WebString;
+
// static
std::map<int, DevToolsAgent*> DevToolsAgent::agent_for_routing_id_;
@@ -44,15 +47,19 @@ bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-void DevToolsAgent::SendMessageToClient(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3) {
+void DevToolsAgent::SendMessageToClient(const WebKit::WebString& class_name,
+ const WebKit::WebString& method_name,
+ const WebKit::WebString& param1,
+ const WebKit::WebString& param2,
+ const WebKit::WebString& param3) {
IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
routing_id_,
- DevToolsClientMsg_RpcMessage(class_name, method_name, param1, param2,
- param3));
+ DevToolsClientMsg_RpcMessage(
+ class_name.utf8(),
+ method_name.utf8(),
+ param1.utf8(),
+ param2.utf8(),
+ param3.utf8()));
view_->Send(m);
}
@@ -95,8 +102,12 @@ void DevToolsAgent::OnRpcMessage(const std::string& class_name,
const std::string& param3) {
WebDevToolsAgent* web_agent = GetWebAgent();
if (web_agent) {
- web_agent->DispatchMessageFromClient(class_name, method_name, param1,
- param2, param3);
+ web_agent->DispatchMessageFromClient(
+ WebString::fromUTF8(class_name),
+ WebString::fromUTF8(method_name),
+ WebString::fromUTF8(param1),
+ WebString::fromUTF8(param2),
+ WebString::fromUTF8(param3));
}
}
diff --git a/chrome/renderer/devtools_agent.h b/chrome/renderer/devtools_agent.h
index 6cd5d97..eeae60a 100644
--- a/chrome/renderer/devtools_agent.h
+++ b/chrome/renderer/devtools_agent.h
@@ -32,11 +32,11 @@ class DevToolsAgent : public WebDevToolsAgentDelegate {
virtual bool OnMessageReceived(const IPC::Message& message);
// WebDevToolsAgentDelegate implementation
- virtual void SendMessageToClient(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3);
+ virtual void SendMessageToClient(const WebKit::WebString& class_name,
+ const WebKit::WebString& method_name,
+ const WebKit::WebString& param1,
+ const WebKit::WebString& param2,
+ const WebKit::WebString& param3);
virtual int GetHostId();
virtual void ForceRepaint();
diff --git a/chrome/renderer/devtools_agent_filter.cc b/chrome/renderer/devtools_agent_filter.cc
index 7ad7e10..0c90491 100644
--- a/chrome/renderer/devtools_agent_filter.cc
+++ b/chrome/renderer/devtools_agent_filter.cc
@@ -9,8 +9,11 @@
#include "chrome/renderer/devtools_agent.h"
#include "chrome/renderer/plugin_channel_host.h"
#include "chrome/renderer/render_view.h"
+#include "webkit/api/public/WebString.h"
#include "webkit/glue/webdevtoolsagent.h"
+using WebKit::WebString;
+
// static
void DevToolsAgentFilter::DispatchMessageLoop() {
MessageLoop* current = MessageLoop::current();
@@ -45,5 +48,6 @@ bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) {
}
void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) {
- WebDevToolsAgent::ExecuteDebuggerCommand(command, current_routing_id_);
+ WebDevToolsAgent::ExecuteDebuggerCommand(
+ WebString::fromUTF8(command), current_routing_id_);
}
diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc
index 01de15f..4463b81 100644
--- a/chrome/renderer/devtools_client.cc
+++ b/chrome/renderer/devtools_client.cc
@@ -10,8 +10,11 @@
#include "chrome/common/render_messages.h"
#include "chrome/renderer/render_thread.h"
#include "chrome/renderer/render_view.h"
+#include "webkit/api/public/WebString.h"
#include "webkit/glue/webdevtoolsclient.h"
+using WebKit::WebString;
+
DevToolsClient::DevToolsClient(RenderView* view)
: render_view_(view) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
@@ -19,7 +22,7 @@ DevToolsClient::DevToolsClient(RenderView* view)
WebDevToolsClient::Create(
view->webview(),
this,
- WideToASCII(command_line.GetSwitchValue(switches::kLang))));
+ WideToUTF16Hack(command_line.GetSwitchValue(switches::kLang))));
}
DevToolsClient::~DevToolsClient() {
@@ -43,17 +46,21 @@ bool DevToolsClient::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-void DevToolsClient::SendMessageToAgent(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3) {
- Send(DevToolsAgentMsg_RpcMessage(class_name, method_name, param1, param2,
- param3));
+void DevToolsClient::SendMessageToAgent(const WebString& class_name,
+ const WebString& method_name,
+ const WebString& param1,
+ const WebString& param2,
+ const WebString& param3) {
+ Send(DevToolsAgentMsg_RpcMessage(
+ class_name.utf8(),
+ method_name.utf8(),
+ param1.utf8(),
+ param2.utf8(),
+ param3.utf8()));
}
-void DevToolsClient::SendDebuggerCommandToAgent(const std::string& command) {
- Send(DevToolsAgentMsg_DebuggerCommand(command));
+void DevToolsClient::SendDebuggerCommandToAgent(const WebString& command) {
+ Send(DevToolsAgentMsg_DebuggerCommand(command.utf8()));
}
void DevToolsClient::ActivateWindow() {
@@ -87,6 +94,10 @@ void DevToolsClient::OnRpcMessage(const std::string& class_name,
const std::string& param1,
const std::string& param2,
const std::string& param3) {
- web_tools_client_->DispatchMessageFromAgent(class_name, method_name, param1,
- param2, param3);
+ web_tools_client_->DispatchMessageFromAgent(
+ WebString::fromUTF8(class_name),
+ WebString::fromUTF8(method_name),
+ WebString::fromUTF8(param1),
+ WebString::fromUTF8(param2),
+ WebString::fromUTF8(param3));
}
diff --git a/chrome/renderer/devtools_client.h b/chrome/renderer/devtools_client.h
index 188bcea..45e926c 100644
--- a/chrome/renderer/devtools_client.h
+++ b/chrome/renderer/devtools_client.h
@@ -33,12 +33,12 @@ class DevToolsClient : public WebDevToolsClientDelegate {
bool OnMessageReceived(const IPC::Message& message);
// WebDevToolsClient::Delegate implementation
- virtual void SendMessageToAgent(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3);
- virtual void SendDebuggerCommandToAgent(const std::string& command);
+ virtual void SendMessageToAgent(const WebKit::WebString& class_name,
+ const WebKit::WebString& method_name,
+ const WebKit::WebString& param1,
+ const WebKit::WebString& param2,
+ const WebKit::WebString& param3);
+ virtual void SendDebuggerCommandToAgent(const WebKit::WebString& command);
virtual void ActivateWindow();
virtual void CloseWindow();