summaryrefslogtreecommitdiffstats
path: root/webkit/glue
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 /webkit/glue
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 'webkit/glue')
-rw-r--r--webkit/glue/devtools/bound_object.cc2
-rw-r--r--webkit/glue/devtools/debugger_agent.h6
-rw-r--r--webkit/glue/devtools/debugger_agent_impl.cc2
-rw-r--r--webkit/glue/devtools/debugger_agent_impl.h4
-rw-r--r--webkit/glue/devtools/debugger_agent_manager.cc29
-rw-r--r--webkit/glue/devtools/debugger_agent_manager.h6
-rw-r--r--webkit/glue/devtools/devtools_rpc.h69
-rw-r--r--webkit/glue/devtools/devtools_rpc_js.h8
-rw-r--r--webkit/glue/devtools/tools_agent.h2
-rw-r--r--webkit/glue/webdevtoolsagent.h17
-rw-r--r--webkit/glue/webdevtoolsagent_delegate.h15
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc55
-rw-r--r--webkit/glue/webdevtoolsagent_impl.h20
-rw-r--r--webkit/glue/webdevtoolsclient.h17
-rw-r--r--webkit/glue/webdevtoolsclient_delegate.h17
-rw-r--r--webkit/glue/webdevtoolsclient_impl.cc87
-rw-r--r--webkit/glue/webdevtoolsclient_impl.h26
17 files changed, 199 insertions, 183 deletions
diff --git a/webkit/glue/devtools/bound_object.cc b/webkit/glue/devtools/bound_object.cc
index 4ffb2ca..051d116 100644
--- a/webkit/glue/devtools/bound_object.cc
+++ b/webkit/glue/devtools/bound_object.cc
@@ -4,8 +4,6 @@
#include "config.h"
-#include <string>
-
#include "V8Proxy.h"
#include "webkit/glue/devtools/bound_object.h"
diff --git a/webkit/glue/devtools/debugger_agent.h b/webkit/glue/devtools/debugger_agent.h
index 07c3232..356837c 100644
--- a/webkit/glue/devtools/debugger_agent.h
+++ b/webkit/glue/devtools/debugger_agent.h
@@ -5,8 +5,6 @@
#ifndef WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_H_
#define WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_H_
-#include <string>
-
#include "webkit/glue/devtools/devtools_rpc.h"
#define DEBUGGER_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
@@ -31,7 +29,7 @@
DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT)
#define DEBUGGER_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
- METHOD1(DebuggerOutput, std::string /* output text */) \
+ METHOD1(DebuggerOutput, String /* output text */) \
\
/* Pushes debugger context id into the client. */ \
METHOD1(SetContextId, int /* context id */) \
@@ -40,7 +38,7 @@ DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT)
METHOD1(DidGetActiveProfilerModules, int /* flags */) \
\
/* Response to GetNextLogLines. */ \
- METHOD1(DidGetNextLogLines, std::string /* log */)
+ METHOD1(DidGetNextLogLines, String /* log */)
DEFINE_RPC_CLASS(DebuggerAgentDelegate, DEBUGGER_AGENT_DELEGATE_STRUCT)
diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc
index d0e0460..afcfdcd 100644
--- a/webkit/glue/devtools/debugger_agent_impl.cc
+++ b/webkit/glue/devtools/debugger_agent_impl.cc
@@ -84,7 +84,7 @@ void DebuggerAgentImpl::GetNextLogLines() {
delegate_->DidGetNextLogLines(buffer);
}
-void DebuggerAgentImpl::DebuggerOutput(const std::string& command) {
+void DebuggerAgentImpl::DebuggerOutput(const String& command) {
delegate_->DebuggerOutput(command);
webdevtools_agent_->ForceRepaint();
}
diff --git a/webkit/glue/devtools/debugger_agent_impl.h b/webkit/glue/devtools/debugger_agent_impl.h
index d64bd49..1695775 100644
--- a/webkit/glue/devtools/debugger_agent_impl.h
+++ b/webkit/glue/devtools/debugger_agent_impl.h
@@ -5,8 +5,6 @@
#ifndef WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_
#define WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_
-#include <string>
-
#include <wtf/HashSet.h>
#include "v8.h"
@@ -46,7 +44,7 @@ class DebuggerAgentImpl : public DebuggerAgent {
virtual void GetNextLogLines();
- void DebuggerOutput(const std::string& out);
+ void DebuggerOutput(const WebCore::String& out);
// Executes function with the given name in the utility context. Passes node
// and json args as parameters. Note that the function called must be
diff --git a/webkit/glue/devtools/debugger_agent_manager.cc b/webkit/glue/devtools/debugger_agent_manager.cc
index b306f42..d390f12 100644
--- a/webkit/glue/devtools/debugger_agent_manager.cc
+++ b/webkit/glue/devtools/debugger_agent_manager.cc
@@ -142,12 +142,11 @@ void DebuggerAgentManager::DebugDetach(DebuggerAgentImpl* debugger_agent) {
}
} else {
// Remove all breakpoints set by the agent.
- std::wstring clear_breakpoint_group_cmd(StringPrintf(
- L"{\"seq\":1,\"type\":\"request\",\"command\":\"clearbreakpointgroup\","
- L"\"arguments\":{\"groupId\":%d}}",
- host_id));
- SendCommandToV8(WideToUTF16(clear_breakpoint_group_cmd),
- new CallerIdWrapper());
+ String clear_breakpoint_group_cmd = String::format(
+ "{\"seq\":1,\"type\":\"request\",\"command\":\"clearbreakpointgroup\","
+ "\"arguments\":{\"groupId\":%d}}",
+ host_id);
+ SendCommandToV8(clear_breakpoint_group_cmd, new CallerIdWrapper());
if (is_on_breakpoint) {
// Force continue if detach happened in nessted message loop while
@@ -174,8 +173,8 @@ void DebuggerAgentManager::DebugBreak(DebuggerAgentImpl* debugger_agent) {
// static
void DebuggerAgentManager::OnV8DebugMessage(const v8::Debug::Message& message) {
v8::HandleScope scope;
- v8::String::Utf8Value value(message.GetJSON());
- std::string out(*value, value.length());
+ v8::String::Value value(message.GetJSON());
+ String out(reinterpret_cast<const UChar*>(*value), value.length());
// If caller_data is not NULL the message is a response to a debugger command.
if (v8::Debug::ClientData* caller_data = message.GetClientData()) {
@@ -239,9 +238,9 @@ void DebuggerAgentManager::OnV8DebugMessage(const v8::Debug::Message& message) {
// static
void DebuggerAgentManager::ExecuteDebuggerCommand(
- const std::string& command,
+ const String& command,
int caller_id) {
- SendCommandToV8(UTF8ToUTF16(command), new CallerIdWrapper(caller_id));
+ SendCommandToV8(command, new CallerIdWrapper(caller_id));
}
// static
@@ -275,19 +274,19 @@ void DebuggerAgentManager::OnNavigate() {
}
// static
-void DebuggerAgentManager::SendCommandToV8(const string16& cmd,
+void DebuggerAgentManager::SendCommandToV8(const String& cmd,
v8::Debug::ClientData* data) {
#if USE(V8)
- v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.data()),
+ v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()),
cmd.length(),
data);
#endif
}
void DebuggerAgentManager::SendContinueCommandToV8() {
- std::wstring continue_cmd(
- L"{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}");
- SendCommandToV8(WideToUTF16(continue_cmd), new CallerIdWrapper());
+ String continue_cmd(
+ "{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}");
+ SendCommandToV8(continue_cmd, new CallerIdWrapper());
}
// static
diff --git a/webkit/glue/devtools/debugger_agent_manager.h b/webkit/glue/devtools/debugger_agent_manager.h
index 8ddae07..3ec5561 100644
--- a/webkit/glue/devtools/debugger_agent_manager.h
+++ b/webkit/glue/devtools/debugger_agent_manager.h
@@ -38,9 +38,9 @@ class DebuggerAgentManager {
static void DebugAttach(DebuggerAgentImpl* debugger_agent);
static void DebugDetach(DebuggerAgentImpl* debugger_agent);
static void DebugBreak(DebuggerAgentImpl* debugger_agent);
- static void DebugCommand(const std::string& command);
+ static void DebugCommand(const WebCore::String& command);
- static void ExecuteDebuggerCommand(const std::string& command,
+ static void ExecuteDebuggerCommand(const WebCore::String& command,
int caller_id);
static void SetMessageLoopDispatchHandler(
WebDevToolsAgent::MessageLoopDispatchHandler handler);
@@ -76,7 +76,7 @@ class DebuggerAgentManager {
static void V8DebugHostDispatchHandler();
static void OnV8DebugMessage(const v8::Debug::Message& message);
- static void SendCommandToV8(const string16& cmd,
+ static void SendCommandToV8(const WebCore::String& cmd,
v8::Debug::ClientData* data);
static void SendContinueCommandToV8();
diff --git a/webkit/glue/devtools/devtools_rpc.h b/webkit/glue/devtools/devtools_rpc.h
index 6656ad4..f0de3d9 100644
--- a/webkit/glue/devtools/devtools_rpc.h
+++ b/webkit/glue/devtools/devtools_rpc.h
@@ -50,15 +50,11 @@
#ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_
#define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_
-#include <string>
-
-// Do not remove this one although it is not used.
-#include <wtf/OwnPtr.h>
+#include "PlatformString.h"
+// TODO(darin): Remove these dependencies on Chromium base/.
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "base/string_util.h"
-#include "webkit/glue/glue_util.h"
namespace WebCore {
class String;
@@ -77,50 +73,39 @@ struct RpcTypeTrait {
template<>
struct RpcTypeTrait<bool> {
typedef bool ApiType;
- static bool Parse(const std::string& t) {
- int i;
- ALLOW_UNUSED bool success = StringToInt(t, &i);
+ static bool Parse(const WebCore::String& t) {
+ ALLOW_UNUSED bool success;
+ int i = t.toIntStrict(&success);
ASSERT(success);
return i;
}
- static std::string ToString(bool b) {
- return IntToString(b ? 1 : 0);
+ static WebCore::String ToString(bool b) {
+ return WebCore::String::number(b ? 1 : 0);
}
};
template<>
struct RpcTypeTrait<int> {
typedef int ApiType;
- static int Parse(const std::string& t) {
- int i;
- ALLOW_UNUSED bool success = StringToInt(t, &i);
+ static int Parse(const WebCore::String& t) {
+ ALLOW_UNUSED bool success;
+ int i = t.toIntStrict(&success);
ASSERT(success);
return i;
}
- static std::string ToString(int i) {
- return IntToString(i);
+ static WebCore::String ToString(int i) {
+ return WebCore::String::number(i);
}
};
template<>
struct RpcTypeTrait<String> {
typedef const String& ApiType;
- static String Parse(const std::string& t) {
- return webkit_glue::StdStringToString(t);
- }
- static std::string ToString(const String& t) {
- return webkit_glue::StringToStdString(t);
- }
-};
-
-template<>
-struct RpcTypeTrait<std::string> {
- typedef const std::string& ApiType;
- static std::string Parse(const std::string& s) {
- return s;
+ static String Parse(const WebCore::String& t) {
+ return t;
}
- static std::string ToString(const std::string& s) {
- return s;
+ static WebCore::String ToString(const String& t) {
+ return t;
}
};
@@ -233,7 +218,7 @@ class Class {\
TOOLS_RPC_API_METHOD1, \
TOOLS_RPC_API_METHOD2, \
TOOLS_RPC_API_METHOD3) \
- std::string class_name; \
+ WebCore::String class_name; \
private: \
DISALLOW_COPY_AND_ASSIGN(Class); \
}; \
@@ -258,11 +243,11 @@ class Class##Dispatch { \
virtual ~Class##Dispatch() {} \
\
static bool Dispatch(Class* delegate, \
- const std::string& class_name, \
- const std::string& method_name, \
- const std::string& p1, \
- const std::string& p2, \
- const std::string& p3) { \
+ const WebCore::String& class_name, \
+ const WebCore::String& method_name, \
+ const WebCore::String& p1, \
+ const WebCore::String& p2, \
+ const WebCore::String& p3) { \
if (class_name != #Class) { \
return false; \
} \
@@ -286,11 +271,11 @@ class DevToolsRpc {
public:
Delegate() {}
virtual ~Delegate() {}
- virtual void SendRpcMessage(const std::string& class_name,
- const std::string& method_name,
- const std::string& p1 = "",
- const std::string& p2 = "",
- const std::string& p3 = "") = 0;
+ virtual void SendRpcMessage(const WebCore::String& class_name,
+ const WebCore::String& method_name,
+ const WebCore::String& p1 = "",
+ const WebCore::String& p2 = "",
+ const WebCore::String& p3 = "") = 0;
private:
DISALLOW_COPY_AND_ASSIGN(Delegate);
};
diff --git a/webkit/glue/devtools/devtools_rpc_js.h b/webkit/glue/devtools/devtools_rpc_js.h
index 8830d19..a72fde9 100644
--- a/webkit/glue/devtools/devtools_rpc_js.h
+++ b/webkit/glue/devtools/devtools_rpc_js.h
@@ -7,8 +7,6 @@
#ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_JS_H_
#define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_JS_H_
-#include <string>
-
// Do not remove this one although it is not used.
#include <wtf/OwnPtr.h>
@@ -103,9 +101,9 @@ class Js##Class##BoundObj : public Class##Stub { \
self->delegate_->SendRpcMessage( \
#Class, \
method, \
- webkit_glue::StringToStdString(param1), \
- webkit_glue::StringToStdString(param2), \
- webkit_glue::StringToStdString(param3)); \
+ param1, \
+ param2, \
+ param3); \
} \
OwnPtr<BoundObject> bound_obj_; \
DISALLOW_COPY_AND_ASSIGN(Js##Class##BoundObj); \
diff --git a/webkit/glue/devtools/tools_agent.h b/webkit/glue/devtools/tools_agent.h
index 39cb9c9..8b730a8 100644
--- a/webkit/glue/devtools/tools_agent.h
+++ b/webkit/glue/devtools/tools_agent.h
@@ -30,7 +30,7 @@ DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT)
#define TOOLS_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
/* Updates focused node on the client. */ \
- METHOD1(FrameNavigate, std::string /* url */) \
+ METHOD1(FrameNavigate, String /* url */) \
\
/* Response to the DispatchOn*. */ \
METHOD3(DidDispatchOn, int /* call_id */, String /* result */, \
diff --git a/webkit/glue/webdevtoolsagent.h b/webkit/glue/webdevtoolsagent.h
index aca37ee..8186051 100644
--- a/webkit/glue/webdevtoolsagent.h
+++ b/webkit/glue/webdevtoolsagent.h
@@ -5,9 +5,12 @@
#ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_H_
#define WEBKIT_GLUE_WEBDEVTOOLSAGENT_H_
-#include <string>
#include "base/basictypes.h"
+namespace WebKit {
+class WebString;
+}
+
// WebDevToolsAgent represents DevTools agent sitting in the Glue. It provides
// direct and delegate Apis to the host.
class WebDevToolsAgent {
@@ -30,11 +33,11 @@ class WebDevToolsAgent {
virtual void OnNavigate() = 0;
- virtual void DispatchMessageFromClient(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3) = 0;
+ virtual void DispatchMessageFromClient(const WebKit::WebString& class_name,
+ const WebKit::WebString& method_name,
+ const WebKit::WebString& param1,
+ const WebKit::WebString& param2,
+ const WebKit::WebString& param3) = 0;
virtual void InspectElement(int x, int y) = 0;
@@ -42,7 +45,7 @@ class WebDevToolsAgent {
// Asynchronously executes debugger command in the render thread.
// |caller_id| will be used for sending response.
- static void ExecuteDebuggerCommand(const std::string& command,
+ static void ExecuteDebuggerCommand(const WebKit::WebString& command,
int caller_id);
typedef void (*MessageLoopDispatchHandler)();
diff --git a/webkit/glue/webdevtoolsagent_delegate.h b/webkit/glue/webdevtoolsagent_delegate.h
index 83f0091..1e34fb7 100644
--- a/webkit/glue/webdevtoolsagent_delegate.h
+++ b/webkit/glue/webdevtoolsagent_delegate.h
@@ -5,19 +5,22 @@
#ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_DELEGATE_H_
#define WEBKIT_GLUE_WEBDEVTOOLSAGENT_DELEGATE_H_
-#include <string>
#include "base/basictypes.h"
+namespace WebKit {
+class WebString;
+}
+
class WebDevToolsAgentDelegate {
public:
WebDevToolsAgentDelegate() {}
virtual ~WebDevToolsAgentDelegate() {}
- 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) = 0;
+ 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) = 0;
// Invalidates widget which leads to the repaint.
virtual void ForceRepaint() = 0;
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
index 3c37b11..e255b39 100644
--- a/webkit/glue/webdevtoolsagent_impl.cc
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -52,9 +52,10 @@ using WebCore::V8DOMWrapper;
using WebCore::V8Proxy;
using WebKit::WebDataSource;
using WebKit::WebFrame;
+using WebKit::WebString;
+using WebKit::WebURL;
using WebKit::WebURLRequest;
-
namespace {
void InspectorBackendWeakReferenceCallback(v8::Persistent<v8::Value> object,
@@ -154,13 +155,13 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame(
}
WebDataSource* ds = frame->dataSource();
const WebURLRequest& request = ds->request();
- GURL url = ds->hasUnreachableURL() ?
+ WebURL url = ds->hasUnreachableURL() ?
ds->unreachableURL() :
request.url();
if (webview->mainFrame() == frame) {
ResetInspectorFrontendProxy();
tools_agent_delegate_stub_->FrameNavigate(
- url.possibly_invalid_spec());
+ webkit_glue::WebURLToKURL(url).string());
SetApuAgentEnabledInUtilityContext(utility_context_, apu_agent_enabled_);
}
UnhideResourcesPanelIfNecessary();
@@ -251,13 +252,18 @@ void WebDevToolsAgentImpl::SetApuAgentEnabled(bool enable) {
}
void WebDevToolsAgentImpl::DispatchMessageFromClient(
- const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3) {
+ const WebString& class_name,
+ const WebString& method_name,
+ const WebString& param1,
+ const WebString& param2,
+ const WebString& param3) {
if (ToolsAgentDispatch::Dispatch(
- this, class_name, method_name, param1, param2, param3)) {
+ this,
+ webkit_glue::WebStringToString(class_name),
+ webkit_glue::WebStringToString(method_name),
+ webkit_glue::WebStringToString(param1),
+ webkit_glue::WebStringToString(param2),
+ webkit_glue::WebStringToString(param3))) {
return;
}
@@ -267,8 +273,12 @@ void WebDevToolsAgentImpl::DispatchMessageFromClient(
if (debugger_agent_impl_.get() &&
DebuggerAgentDispatch::Dispatch(
- debugger_agent_impl_.get(), class_name, method_name,
- param1, param2, param3)) {
+ debugger_agent_impl_.get(),
+ webkit_glue::WebStringToString(class_name),
+ webkit_glue::WebStringToString(method_name),
+ webkit_glue::WebStringToString(param1),
+ webkit_glue::WebStringToString(param2),
+ webkit_glue::WebStringToString(param3))) {
return;
}
}
@@ -283,13 +293,17 @@ void WebDevToolsAgentImpl::InspectElement(int x, int y) {
}
void WebDevToolsAgentImpl::SendRpcMessage(
- const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3) {
- delegate_->SendMessageToClient(class_name, method_name, param1, param2,
- param3);
+ const String& class_name,
+ const String& method_name,
+ const String& param1,
+ const String& param2,
+ const String& param3) {
+ delegate_->SendMessageToClient(
+ webkit_glue::StringToWebString(class_name),
+ webkit_glue::StringToWebString(method_name),
+ webkit_glue::StringToWebString(param1),
+ webkit_glue::StringToWebString(param2),
+ webkit_glue::StringToWebString(param3));
}
void WebDevToolsAgentImpl::InitDevToolsAgentHost() {
@@ -395,9 +409,10 @@ v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchToApu(
// static
void WebDevToolsAgent::ExecuteDebuggerCommand(
- const std::string& command,
+ const WebString& command,
int caller_id) {
- DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id);
+ DebuggerAgentManager::ExecuteDebuggerCommand(
+ webkit_glue::WebStringToString(command), caller_id);
}
// static
diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h
index b4efbe0..f0fb56e 100644
--- a/webkit/glue/webdevtoolsagent_impl.h
+++ b/webkit/glue/webdevtoolsagent_impl.h
@@ -62,19 +62,19 @@ class WebDevToolsAgentImpl
virtual void Attach();
virtual void Detach();
virtual void OnNavigate();
- virtual void DispatchMessageFromClient(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3);
+ virtual void DispatchMessageFromClient(const WebKit::WebString& class_name,
+ const WebKit::WebString& method_name,
+ const WebKit::WebString& param1,
+ const WebKit::WebString& param2,
+ const WebKit::WebString& param3);
virtual void InspectElement(int x, int y);
// DevToolsRpc::Delegate implementation.
- void SendRpcMessage(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3);
+ void SendRpcMessage(const WebCore::String& class_name,
+ const WebCore::String& method_name,
+ const WebCore::String& param1,
+ const WebCore::String& param2,
+ const WebCore::String& param3);
// Methods called by the glue.
void SetMainFrameDocumentReady(bool ready);
diff --git a/webkit/glue/webdevtoolsclient.h b/webkit/glue/webdevtoolsclient.h
index e19af39..5b1d11e 100644
--- a/webkit/glue/webdevtoolsclient.h
+++ b/webkit/glue/webdevtoolsclient.h
@@ -5,12 +5,15 @@
#ifndef WEBKIT_GLUE_WEBDEVTOOLSCLIENT_H_
#define WEBKIT_GLUE_WEBDEVTOOLSCLIENT_H_
-#include <string>
#include "base/basictypes.h"
class WebDevToolsClientDelegate;
class WebView;
+namespace WebKit {
+class WebString;
+}
+
// WebDevToolsClient represents DevTools client sitting in the Glue. It provides
// direct and delegate Apis to the host.
class WebDevToolsClient {
@@ -18,16 +21,16 @@ class WebDevToolsClient {
static WebDevToolsClient* Create(
WebView* view,
WebDevToolsClientDelegate* delegate,
- const std::string& application_locale);
+ const WebKit::WebString& application_locale);
WebDevToolsClient() {}
virtual ~WebDevToolsClient() {}
- virtual void DispatchMessageFromAgent(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3) = 0;
+ virtual void DispatchMessageFromAgent(const WebKit::WebString& class_name,
+ const WebKit::WebString& method_name,
+ const WebKit::WebString& param1,
+ const WebKit::WebString& param2,
+ const WebKit::WebString& param3) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(WebDevToolsClient);
diff --git a/webkit/glue/webdevtoolsclient_delegate.h b/webkit/glue/webdevtoolsclient_delegate.h
index 59067ca..fab7309 100644
--- a/webkit/glue/webdevtoolsclient_delegate.h
+++ b/webkit/glue/webdevtoolsclient_delegate.h
@@ -5,20 +5,23 @@
#ifndef WEBKIT_GLUE_WEBDEVTOOLSCLIENT_DELEGATE_H_
#define WEBKIT_GLUE_WEBDEVTOOLSCLIENT_DELEGATE_H_
-#include <string>
#include "base/basictypes.h"
+namespace WebKit {
+class WebString;
+}
+
class WebDevToolsClientDelegate {
public:
WebDevToolsClientDelegate() {}
virtual ~WebDevToolsClientDelegate() {}
- 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) = 0;
- virtual void SendDebuggerCommandToAgent(const std::string& command) = 0;
+ 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) = 0;
+ virtual void SendDebuggerCommandToAgent(const WebKit::WebString& command) = 0;
virtual void ActivateWindow() = 0;
virtual void CloseWindow() = 0;
diff --git a/webkit/glue/webdevtoolsclient_impl.cc b/webkit/glue/webdevtoolsclient_impl.cc
index 774e07b..c5dca05 100644
--- a/webkit/glue/webdevtoolsclient_impl.cc
+++ b/webkit/glue/webdevtoolsclient_impl.cc
@@ -41,6 +41,14 @@ using WebKit::WebFrame;
using WebKit::WebScriptSource;
using WebKit::WebString;
+static v8::Local<v8::String> ToV8String(const String& s) {
+ if (s.isNull())
+ return v8::Local<v8::String>();
+
+ return v8::String::New(reinterpret_cast<const uint16_t*>(s.characters()),
+ s.length());
+}
+
DEFINE_RPC_JS_BOUND_OBJ(DebuggerAgent, DEBUGGER_AGENT_STRUCT,
DebuggerAgentDelegate, DEBUGGER_AGENT_DELEGATE_STRUCT)
DEFINE_RPC_JS_BOUND_OBJ(ToolsAgent, TOOLS_AGENT_STRUCT,
@@ -100,19 +108,20 @@ class ToolsAgentNativeDelegateImpl : public ToolsAgentNativeDelegate {
WebDevToolsClient* WebDevToolsClient::Create(
WebView* view,
WebDevToolsClientDelegate* delegate,
- const std::string& application_locale) {
- return new WebDevToolsClientImpl(static_cast<WebViewImpl*>(view),
- delegate,
- application_locale);
+ const WebString& application_locale) {
+ return new WebDevToolsClientImpl(
+ static_cast<WebViewImpl*>(view),
+ delegate,
+ webkit_glue::WebStringToString(application_locale));
}
WebDevToolsClientImpl::WebDevToolsClientImpl(
WebViewImpl* web_view_impl,
WebDevToolsClientDelegate* delegate,
- const std::string& application_locale)
+ const String& application_locale)
: web_view_impl_(web_view_impl),
delegate_(delegate),
- application_locale_(application_locale.c_str()),
+ application_locale_(application_locale),
loaded_(false) {
WebFrameImpl* frame = web_view_impl_->main_frame();
v8::HandleScope scope;
@@ -178,27 +187,27 @@ WebDevToolsClientImpl::~WebDevToolsClientImpl() {
}
void WebDevToolsClientImpl::DispatchMessageFromAgent(
- const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3) {
+ const WebString& class_name,
+ const WebString& method_name,
+ const WebString& param1,
+ const WebString& param2,
+ const WebString& param3) {
if (ToolsAgentNativeDelegateDispatch::Dispatch(
tools_agent_native_delegate_impl_.get(),
- class_name,
- method_name,
- param1,
- param2,
- param3)) {
+ webkit_glue::WebStringToString(class_name),
+ webkit_glue::WebStringToString(method_name),
+ webkit_glue::WebStringToString(param1),
+ webkit_glue::WebStringToString(param2),
+ webkit_glue::WebStringToString(param3))) {
return;
}
- Vector<std::string> v;
- v.append(class_name);
- v.append(method_name);
- v.append(param1);
- v.append(param2);
- v.append(param3);
+ Vector<String> v;
+ v.append(webkit_glue::WebStringToString(class_name));
+ v.append(webkit_glue::WebStringToString(method_name));
+ v.append(webkit_glue::WebStringToString(param1));
+ v.append(webkit_glue::WebStringToString(param2));
+ v.append(webkit_glue::WebStringToString(param3));
if (!loaded_) {
pending_incoming_messages_.append(v);
return;
@@ -217,7 +226,7 @@ void WebDevToolsClientImpl::AddResourceSourceToFrame(int resource_id,
tools_agent_native_delegate_impl_->RequestSent(resource_id, mime_type, frame);
}
-void WebDevToolsClientImpl::ExecuteScript(const Vector<std::string>& v) {
+void WebDevToolsClientImpl::ExecuteScript(const Vector<String>& v) {
WebFrameImpl* frame = web_view_impl_->main_frame();
v8::HandleScope scope;
v8::Handle<v8::Context> frame_context = V8Proxy::context(frame->frame());
@@ -227,22 +236,26 @@ void WebDevToolsClientImpl::ExecuteScript(const Vector<std::string>& v) {
ASSERT(dispatch_function->IsFunction());
v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatch_function);
v8::Handle<v8::Value> args[] = {
- v8::String::New(v.at(0).c_str()),
- v8::String::New(v.at(1).c_str()),
- v8::String::New(v.at(2).c_str()),
- v8::String::New(v.at(3).c_str()),
- v8::String::New(v.at(4).c_str())
+ ToV8String(v.at(0)),
+ ToV8String(v.at(1)),
+ ToV8String(v.at(2)),
+ ToV8String(v.at(3)),
+ ToV8String(v.at(4)),
};
function->Call(frame_context->Global(), 5, args);
}
-void WebDevToolsClientImpl::SendRpcMessage(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3) {
- delegate_->SendMessageToAgent(class_name, method_name, param1, param2,
- param3);
+void WebDevToolsClientImpl::SendRpcMessage(const String& class_name,
+ const String& method_name,
+ const String& param1,
+ const String& param2,
+ const String& param3) {
+ delegate_->SendMessageToAgent(
+ webkit_glue::StringToWebString(class_name),
+ webkit_glue::StringToWebString(method_name),
+ webkit_glue::StringToWebString(param1),
+ webkit_glue::StringToWebString(param2),
+ webkit_glue::StringToWebString(param3));
}
// static
@@ -313,7 +326,7 @@ v8::Handle<v8::Value> WebDevToolsClientImpl::JsLoaded(
SecurityOrigin* origin = page->mainFrame()->domWindow()->securityOrigin();
origin->grantUniversalAccess();
- for (Vector<Vector<std::string> >::iterator it =
+ for (Vector<Vector<String> >::iterator it =
client->pending_incoming_messages_.begin();
it != client->pending_incoming_messages_.end();
++it) {
@@ -402,7 +415,7 @@ v8::Handle<v8::Value> WebDevToolsClientImpl::JsDebuggerCommand(
WebDevToolsClientImpl* client = static_cast<WebDevToolsClientImpl*>(
v8::External::Cast(*args.Data())->Value());
String command = WebCore::toWebCoreStringWithNullCheck(args[0]);
- std::string std_command = webkit_glue::StringToStdString(command);
+ WebString std_command = webkit_glue::StringToWebString(command);
client->delegate_->SendDebuggerCommandToAgent(std_command);
return v8::Undefined();
}
diff --git a/webkit/glue/webdevtoolsclient_impl.h b/webkit/glue/webdevtoolsclient_impl.h
index ee8d6a1..820aae8 100644
--- a/webkit/glue/webdevtoolsclient_impl.h
+++ b/webkit/glue/webdevtoolsclient_impl.h
@@ -35,29 +35,29 @@ class WebDevToolsClientImpl : public WebDevToolsClient,
WebDevToolsClientImpl(
WebViewImpl* web_view_impl,
WebDevToolsClientDelegate* delegate,
- const std::string& application_locale);
+ const String& application_locale);
virtual ~WebDevToolsClientImpl();
// DevToolsRpc::Delegate implementation.
- virtual void SendRpcMessage(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3);
+ virtual void SendRpcMessage(const String& class_name,
+ const String& method_name,
+ const String& param1,
+ const String& param2,
+ const String& param3);
// WebDevToolsClient implementation.
- virtual void DispatchMessageFromAgent(const std::string& class_name,
- const std::string& method_name,
- const std::string& param1,
- const std::string& param2,
- const std::string& param3);
+ virtual void DispatchMessageFromAgent(const WebKit::WebString& class_name,
+ const WebKit::WebString& method_name,
+ const WebKit::WebString& param1,
+ const WebKit::WebString& param2,
+ const WebKit::WebString& param3);
private:
void AddResourceSourceToFrame(int resource_id,
String mime_type,
WebCore::Node* frame);
- void ExecuteScript(const Vector<std::string>& v);
+ void ExecuteScript(const Vector<String>& v);
static v8::Handle<v8::Value> JsReset(const v8::Arguments& args);
static v8::Handle<v8::Value> JsAddSourceToFrame(const v8::Arguments& args);
static v8::Handle<v8::Value> JsAddResourceSourceToFrame(
@@ -85,7 +85,7 @@ class WebDevToolsClientImpl : public WebDevToolsClient,
OwnPtr<JsDebuggerAgentBoundObj> debugger_agent_obj_;
OwnPtr<JsToolsAgentBoundObj> tools_agent_obj_;
bool loaded_;
- Vector<Vector<std::string> > pending_incoming_messages_;
+ Vector<Vector<String> > pending_incoming_messages_;
OwnPtr<BoundObject> dev_tools_host_;
OwnPtr<ToolsAgentNativeDelegateImpl> tools_agent_native_delegate_impl_;
DISALLOW_COPY_AND_ASSIGN(WebDevToolsClientImpl);