summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-12 13:03:51 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-12 13:03:51 +0000
commit097e38421957bcdf84a79fbed193570fbb2e647e (patch)
tree088062f435d940d67b06a1b7a35a5b0850cb9243
parent31d58b18c3ae0bc157eab12371f5777f3340cabc (diff)
downloadchromium_src-097e38421957bcdf84a79fbed193570fbb2e647e.zip
chromium_src-097e38421957bcdf84a79fbed193570fbb2e647e.tar.gz
chromium_src-097e38421957bcdf84a79fbed193570fbb2e647e.tar.bz2
Initial WebDevToolsAgent implementation contains two agent objects: Dom agent
and Net agent. Dom agent provides API for querying for DOM nodes and receiving notifications on Dom updates. It has some logic in and this logic is covered with the unit tests. Net agent pushes an initial set of request/response-related events to the client. It is to be filled with more data later on. It currently caches loaders for all the requests which is Ok for the case when this agent is turned ON (at least for now). Note that this code is not yet wired to the dev tools agent (this is by design). The plan is to start enrolling the dev tools agent glue that connects these sub-agents with the IPC transport once this CL is in. Original CL: http://codereview.chromium.org/41008/show Review URL: http://codereview.chromium.org/43128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11531 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/SConscript17
-rw-r--r--webkit/glue/devtools/devtools_mock_rpc.h52
-rw-r--r--webkit/glue/devtools/devtools_rpc.cc86
-rw-r--r--webkit/glue/devtools/devtools_rpc.h324
-rw-r--r--webkit/glue/devtools/dom_agent.h60
-rw-r--r--webkit/glue/devtools/dom_agent_impl.cc406
-rw-r--r--webkit/glue/devtools/dom_agent_impl.h119
-rw-r--r--webkit/glue/devtools/dom_agent_unittest.cc421
-rw-r--r--webkit/glue/devtools/net_agent.h40
-rw-r--r--webkit/glue/devtools/net_agent_impl.cc204
-rw-r--r--webkit/glue/devtools/net_agent_impl.h80
-rw-r--r--webkit/glue/devtools/tools_agent.h32
-rw-r--r--webkit/glue/glue.vcproj1758
-rw-r--r--webkit/glue/webdevtoolsagent.h23
-rw-r--r--webkit/glue/webdevtoolsagent_delegate.h22
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc113
-rw-r--r--webkit/glue/webdevtoolsagent_impl.h72
-rw-r--r--webkit/glue/webdevtoolsclient.h31
-rw-r--r--webkit/glue/webdevtoolsclient_delegate.h22
-rw-r--r--webkit/glue/webdevtoolsclient_impl.cc225
-rw-r--r--webkit/glue/webdevtoolsclient_impl.h141
-rw-r--r--webkit/tools/test_shell/SConscript1
-rw-r--r--webkit/tools/test_shell/test_shell.gyp2
-rw-r--r--webkit/tools/test_shell/test_shell_tests.vcproj8
-rw-r--r--webkit/webkit.gyp17
25 files changed, 3433 insertions, 843 deletions
diff --git a/webkit/glue/SConscript b/webkit/glue/SConscript
index a06bfe1..f59d7aa 100644
--- a/webkit/glue/SConscript
+++ b/webkit/glue/SConscript
@@ -48,6 +48,15 @@ input_files = [
'cpp_bound_class.cc',
'cpp_variant.cc',
'debugger_bridge.cc',
+ 'devtools/devtools_rpc.cc',
+ 'devtools/devtools_rpc.h',
+ 'devtools/dom_agent.h',
+ 'devtools/dom_agent_impl.cc',
+ 'devtools/dom_agent_impl.h',
+ 'devtools/net_agent.h',
+ 'devtools/net_agent_impl.cc',
+ 'devtools/net_agent_impl.h',
+ 'devtools/tools_agent.h',
'dom_operations.cc',
'dom_serializer.cc',
'dragclient_impl.cc',
@@ -82,6 +91,14 @@ input_files = [
'webclipboard_impl.cc',
'webcursor.cc',
'webdatasource_impl.cc',
+ 'webdevtoolsagent.h',
+ 'webdevtoolsagent_delegate.h',
+ 'webdevtoolsagent_impl.cc',
+ 'webdevtoolsagent_impl.h',
+ 'webdevtoolsclient.h',
+ 'webdevtoolsclient_delegate.h',
+ 'webdevtoolsclient_impl.cc',
+ 'webdevtoolsclient_impl.h',
'webdocumentloader_impl.cc',
'weberror_impl.cc',
'webframe_impl.cc',
diff --git a/webkit/glue/devtools/devtools_mock_rpc.h b/webkit/glue/devtools/devtools_mock_rpc.h
new file mode 100644
index 0000000..1a56b2f
--- /dev/null
+++ b/webkit/glue/devtools/devtools_mock_rpc.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_MOCK_RPC_H_
+#define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_MOCK_RPC_H_
+
+#include <string>
+
+#include "base/string_util.h"
+#include "PlatformString.h"
+
+#include "webkit/glue/devtools/devtools_rpc.h"
+#include "webkit/glue/glue_util.h"
+
+using WebCore::String;
+
+// Universal mock delegate for DevToolsRpc. Typical usage of the mock is:
+// mock->Method1(); // Set expectation.
+// mock->Replay();
+// // Do Something here;
+// mock->Verify(); // Verify.
+class DevToolsMockRpc : public DevToolsRpc::Delegate {
+ public:
+ DevToolsMockRpc() {}
+ ~DevToolsMockRpc() {}
+
+ virtual void SendRpcMessage(const std::string& msg) {
+ log_ = StringPrintf("%s\n%s", log_.c_str(), msg.c_str());
+ }
+
+ void Replay() {
+ ref_log_ = log_;
+ log_ = "";
+ }
+
+ void Verify() {
+ EXPECT_EQ(ref_log_, log_);
+ }
+
+ void Reset() {
+ ref_log_ = "";
+ log_ = "";
+ }
+
+ private:
+ std::string log_;
+ std::string ref_log_;
+ DISALLOW_COPY_AND_ASSIGN(DevToolsMockRpc);
+};
+
+#endif // WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_MOCK_RPC_H_
diff --git a/webkit/glue/devtools/devtools_rpc.cc b/webkit/glue/devtools/devtools_rpc.cc
new file mode 100644
index 0000000..29cbd78
--- /dev/null
+++ b/webkit/glue/devtools/devtools_rpc.cc
@@ -0,0 +1,86 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/glue/devtools/devtools_rpc.h"
+
+#include "PlatformString.h"
+
+// TODO(pfeldman): Remove these once JSON is available in
+// WebCore namespace.
+#include "base/json_reader.h"
+#include "base/json_writer.h"
+#include "base/values.h"
+#include "webkit/glue/glue_util.h"
+
+DevToolsRpc::DevToolsRpc(Delegate* delegate) : delegate_(delegate) {
+}
+
+DevToolsRpc::~DevToolsRpc() {
+}
+
+void DevToolsRpc::SendValueMessage(const Value* value) {
+ std::string json;
+ JSONWriter::Write(value, false, &json);
+ delegate_->SendRpcMessage(json);
+}
+
+// static
+Value* DevToolsRpc::ParseMessage(const std::string& raw_msg) {
+ return JSONReader::Read(raw_msg, false);
+}
+
+// static
+void DevToolsRpc::GetListValue(
+ const ListValue& message,
+ int index,
+ bool* value) {
+ message.GetBoolean(index, value);
+}
+
+// static
+void DevToolsRpc::GetListValue(
+ const ListValue& message,
+ int index,
+ int* value) {
+ message.GetInteger(index, value);
+}
+
+// static
+void DevToolsRpc::GetListValue(
+ const ListValue& message,
+ int index,
+ String* value) {
+ std::string tmp;
+ message.GetString(index, &tmp);
+ *value = webkit_glue::StdStringToString(tmp);
+}
+
+// static
+void DevToolsRpc::GetListValue(
+ const ListValue& message,
+ int index,
+ Value** value) {
+ message.Get(index, value);
+}
+
+// static
+Value* DevToolsRpc::CreateValue(const String* value) {
+ return Value::CreateStringValue(
+ webkit_glue::StringToStdString(*value));
+}
+
+// static
+Value* DevToolsRpc::CreateValue(int* value) {
+ return Value::CreateIntegerValue(*value);
+}
+
+// static
+Value* DevToolsRpc::CreateValue(bool* value) {
+ return Value::CreateBooleanValue(*value);
+}
+
+// static
+Value* DevToolsRpc::CreateValue(const Value* value) {
+ return value->DeepCopy();
+}
diff --git a/webkit/glue/devtools/devtools_rpc.h b/webkit/glue/devtools/devtools_rpc.h
new file mode 100644
index 0000000..3fbcc7d
--- /dev/null
+++ b/webkit/glue/devtools/devtools_rpc.h
@@ -0,0 +1,324 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// DevTools RPC subsystem is a simple string serialization-based rpc
+// implementation. The client is responsible for defining the Rpc-enabled
+// interface in terms of its macros:
+//
+// #define MYAPI_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3)
+// METHOD0(Method1)
+// METHOD3(Method2, int, String, Value)
+// METHOD1(Method3, int)
+// (snippet above should be multiline macro, add trailing backslashes)
+//
+// DEFINE_RPC_CLASS(MyApi, MYAPI_STRUCT)
+//
+// The snippet above will generate three classes: MyApi, MyApiStub and
+// MyApiDispatch.
+//
+// 1. For each method defined in the marco MyApi will have a
+// pure virtual function generated, so that MyApi would look like:
+//
+// class MyApi {
+// private:
+// MyApi() {}
+// ~MyApi() {}
+// virtual void Method1() = 0;
+// virtual void Method2(
+// int param1,
+// const String& param2,
+// const Value& param3) = 0;
+// virtual void Method3(int param1) = 0;
+// };
+//
+// 2. MyApiStub will implement MyApi interface and would serialize all calls
+// into the string-based calls of the underlying transport:
+//
+// DevToolsRpc::Delegate* transport;
+// my_api = new MyApiStub(transport);
+// my_api->Method1();
+// my_api->Method3(2);
+//
+// 3. MyApiDelegate is capable of dispatching the calls and convert them to the
+// calls to the underlying MyApi methods:
+//
+// MyApi* real_object;
+// MyApiDispatch dispatch;
+// dispatch.Dispatch(real_object, raw_string_call_generated_by_stub);
+//
+// will make corresponding calls to the real object.
+
+#ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_
+#define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_
+
+#include <string>
+
+#include "PlatformString.h"
+#include <wtf/OwnPtr.h>
+
+#include "base/basictypes.h"
+#include "base/values.h"
+
+using WebCore::String;
+
+///////////////////////////////////////////////////////
+// RPC dispatch macro
+
+template<typename T>
+struct RpcTypeTrait {
+ typedef T ApiType;
+ typedef T DispatchType;
+ static const DispatchType& Pass(const DispatchType& t) {
+ return t;
+ }
+};
+
+template<>
+struct RpcTypeTrait<Value> {
+ typedef const Value& ApiType;
+ typedef Value* DispatchType;
+ static const Value& Pass(Value* t) {
+ return *t;
+ }
+};
+
+template<>
+struct RpcTypeTrait<String> {
+ typedef const String& ApiType;
+ typedef String DispatchType;
+ static const DispatchType& Pass(const DispatchType& t) {
+ return t;
+ }
+};
+
+///////////////////////////////////////////////////////
+// RPC Api method declarations
+
+#define TOOLS_RPC_API_METHOD0(Method) \
+ virtual void Method() = 0;
+
+#define TOOLS_RPC_API_METHOD1(Method, T1) \
+ virtual void Method(RpcTypeTrait<T1>::ApiType t1) = 0;
+
+#define TOOLS_RPC_API_METHOD2(Method, T1, T2) \
+ virtual void Method(RpcTypeTrait<T1>::ApiType t1, \
+ RpcTypeTrait<T2>::ApiType t2) = 0;
+
+#define TOOLS_RPC_API_METHOD3(Method, T1, T2, T3) \
+ virtual void Method(RpcTypeTrait<T1>::ApiType t1, \
+ RpcTypeTrait<T2>::ApiType t2, \
+ RpcTypeTrait<T3>::ApiType t3) = 0;
+
+#define TOOLS_RPC_ENUM_LITERAL0(Method) METHOD_##Method,
+#define TOOLS_RPC_ENUM_LITERAL1(Method, T1) METHOD_##Method,
+#define TOOLS_RPC_ENUM_LITERAL2(Method, T1, T2) METHOD_##Method,
+#define TOOLS_RPC_ENUM_LITERAL3(Method, T1, T2, T3) METHOD_##Method,
+
+///////////////////////////////////////////////////////
+// RPC stub method implementations
+
+#define TOOLS_RPC_STUB_METHOD0(Method) \
+ virtual void Method() { \
+ InvokeAsync(METHOD_##Method); \
+ }
+
+#define TOOLS_RPC_STUB_METHOD1(Method, T1) \
+ virtual void Method(RpcTypeTrait<T1>::ApiType t1) { \
+ InvokeAsync(METHOD_##Method, &t1); \
+ }
+
+#define TOOLS_RPC_STUB_METHOD2(Method, T1, T2) \
+ virtual void Method(RpcTypeTrait<T1>::ApiType t1, \
+ RpcTypeTrait<T2>::ApiType t2) { \
+ InvokeAsync(METHOD_##Method, &t1, &t2); \
+ }
+
+#define TOOLS_RPC_STUB_METHOD3(Method, T1, T2, T3) \
+ virtual void Method(RpcTypeTrait<T1>::ApiType t1, \
+ RpcTypeTrait<T2>::ApiType t2, \
+ RpcTypeTrait<T3>::ApiType t3) { \
+ InvokeAsync(METHOD_##Method, &t1, &t2, &t3); \
+ }
+
+///////////////////////////////////////////////////////
+// RPC dispatch method implementations
+
+#define TOOLS_RPC_DISPATCH0(Method) \
+case CLASS::METHOD_##Method: { \
+ delegate->Method(); \
+ return true; \
+}
+
+#define TOOLS_RPC_DISPATCH1(Method, T1) \
+case CLASS::METHOD_##Method: { \
+ RpcTypeTrait<T1>::DispatchType t1; \
+ DevToolsRpc::GetListValue(*message.get(), 1, &t1); \
+ delegate->Method( \
+ RpcTypeTrait<T1>::Pass(t1)); \
+}
+
+#define TOOLS_RPC_DISPATCH2(Method, T1, T2) \
+case CLASS::METHOD_##Method: { \
+ RpcTypeTrait<T1>::DispatchType t1; \
+ RpcTypeTrait<T2>::DispatchType t2; \
+ DevToolsRpc::GetListValue(*message.get(), 1, &t1); \
+ DevToolsRpc::GetListValue(*message.get(), 2, &t2); \
+ delegate->Method( \
+ RpcTypeTrait<T1>::Pass(t1), \
+ RpcTypeTrait<T2>::Pass(t2) \
+ ); \
+ return true; \
+}
+
+#define TOOLS_RPC_DISPATCH3(Method, T1, T2, T3) \
+case CLASS::METHOD_##Method: { \
+ RpcTypeTrait<T1>::DispatchType t1; \
+ RpcTypeTrait<T2>::DispatchType t2; \
+ RpcTypeTrait<T3>::DispatchType t3; \
+ DevToolsRpc::GetListValue(*message.get(), 1, &t1); \
+ DevToolsRpc::GetListValue(*message.get(), 2, &t2); \
+ DevToolsRpc::GetListValue(*message.get(), 3, &t3); \
+ delegate->Method( \
+ RpcTypeTrait<T1>::Pass(t1), \
+ RpcTypeTrait<T2>::Pass(t2), \
+ RpcTypeTrait<T3>::Pass(t3) \
+ ); \
+ return true; \
+}
+
+#define TOOLS_END_RPC_DISPATCH() \
+}
+
+// This macro defines three classes: Class with the Api, ClassStub that is
+// serializing method calls and ClassDispatch that is capable of dispatching
+// the serialized message into its delegate.
+#define DEFINE_RPC_CLASS(Class, STRUCT) \
+class Class {\
+ public: \
+ Class() {} \
+ ~Class() {} \
+ \
+ enum MethodNames { \
+ STRUCT(TOOLS_RPC_ENUM_LITERAL0, TOOLS_RPC_ENUM_LITERAL1, \
+ TOOLS_RPC_ENUM_LITERAL2, TOOLS_RPC_ENUM_LITERAL3) \
+ }; \
+ \
+ STRUCT( \
+ TOOLS_RPC_API_METHOD0, \
+ TOOLS_RPC_API_METHOD1, \
+ TOOLS_RPC_API_METHOD2, \
+ TOOLS_RPC_API_METHOD3) \
+ private: \
+ DISALLOW_COPY_AND_ASSIGN(Class); \
+}; \
+\
+class Class##Stub : public Class, public DevToolsRpc { \
+ public: \
+ explicit Class##Stub(Delegate* delegate) : DevToolsRpc(delegate) {} \
+ virtual ~Class##Stub() {} \
+ STRUCT( \
+ TOOLS_RPC_STUB_METHOD0, \
+ TOOLS_RPC_STUB_METHOD1, \
+ TOOLS_RPC_STUB_METHOD2, \
+ TOOLS_RPC_STUB_METHOD3) \
+ private: \
+ DISALLOW_COPY_AND_ASSIGN(Class##Stub); \
+}; \
+\
+class Class##Dispatch { \
+ public: \
+ Class##Dispatch() {} \
+ virtual ~Class##Dispatch() {} \
+ bool Dispatch(Class* delegate, const std::string& raw_msg) { \
+ OwnPtr<ListValue> message( \
+ static_cast<ListValue*>(DevToolsRpc::ParseMessage(raw_msg))); \
+ int method; \
+ message->GetInteger(0, &method); \
+ typedef Class CLASS; \
+ switch (method) { \
+ STRUCT( \
+ TOOLS_RPC_DISPATCH0, \
+ TOOLS_RPC_DISPATCH1, \
+ TOOLS_RPC_DISPATCH2, \
+ TOOLS_RPC_DISPATCH3) \
+ default: return false; \
+ } \
+ } \
+ private: \
+ DISALLOW_COPY_AND_ASSIGN(Class##Dispatch); \
+};
+
+///////////////////////////////////////////////////////
+// RPC base class
+class DevToolsRpc {
+ public:
+ class Delegate {
+ public:
+ Delegate() {}
+ virtual ~Delegate() {}
+ virtual void SendRpcMessage(const std::string& msg) = 0;
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Delegate);
+ };
+
+ explicit DevToolsRpc(Delegate* delegate);
+ virtual ~DevToolsRpc();
+
+ void InvokeAsync(int method) {
+ ListValue message;
+ message.Append(CreateValue(&method));
+ SendValueMessage(&message);
+ }
+ template<class T1>
+ void InvokeAsync(int method, T1 t1) {
+ ListValue message;
+ message.Append(CreateValue(&method));
+ message.Append(CreateValue(t1));
+ SendValueMessage(&message);
+ }
+ template<class T1, class T2>
+ void InvokeAsync(int method, T1 t1, T2 t2) {
+ ListValue message;
+ message.Append(CreateValue(&method));
+ message.Append(CreateValue(t1));
+ message.Append(CreateValue(t2));
+ SendValueMessage(&message);
+ }
+ template<class T1, class T2, class T3>
+ void InvokeAsync(int method, T1 t1, T2 t2, T3 t3) {
+ ListValue message;
+ message.Append(CreateValue(&method));
+ message.Append(CreateValue(t1));
+ message.Append(CreateValue(t2));
+ message.Append(CreateValue(t3));
+ SendValueMessage(&message);
+ }
+
+ static Value* ParseMessage(const std::string& raw_msg);
+ static void GetListValue(const ListValue& message, int index, bool* value);
+ static void GetListValue(const ListValue& message, int index, int* value);
+ static void GetListValue(
+ const ListValue& message,
+ int index,
+ String* value);
+ static void GetListValue(const ListValue& message, int index, Value** value);
+
+ protected:
+ // Primarily for unit testing.
+ void set_delegate(Delegate* delegate) { this->delegate_ = delegate; }
+
+ private:
+ // Value adapters for supported Rpc types.
+ static Value* CreateValue(const String* value);
+ static Value* CreateValue(int* value);
+ static Value* CreateValue(bool* value);
+ static Value* CreateValue(const Value* value);
+
+ void SendValueMessage(const Value* value);
+
+ Delegate* delegate_;
+ DISALLOW_COPY_AND_ASSIGN(DevToolsRpc);
+};
+
+#endif // WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_
diff --git a/webkit/glue/devtools/dom_agent.h b/webkit/glue/devtools/dom_agent.h
new file mode 100644
index 0000000..a2d8818
--- /dev/null
+++ b/webkit/glue/devtools/dom_agent.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_DEVTOOLS_DOM_AGENT_H_
+#define WEBKIT_GLUE_DEVTOOLS_DOM_AGENT_H_
+
+#include "webkit/glue/devtools/devtools_rpc.h"
+
+// DomAgent is a utility object that covers DOM-related functionality of the
+// WebDevToolsAgent. It is capable of sending DOM tree to the client as well
+// as providing DOM notifications for the nodes known to the client.
+// DomAgent's environment is represented with the DomAgentDelegate interface.
+#define DOM_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
+ /* Requests that the document root element is sent to the delegate. */ \
+ METHOD0(GetDocumentElement) \
+ \
+ /* Requests that the element's children are sent to the client. */ \
+ METHOD1(GetChildNodes, int /* id */) \
+ \
+ /* Sets attribute value in the element with given id. */ \
+ METHOD3(SetAttribute, int /* id */, String /* name */, String /* value */) \
+ \
+ /* Removes attribute from the element with given id. */ \
+ METHOD2(RemoveAttribute, int /* id */, String /* name */) \
+ \
+ /* Sets text node value in the node with given id. */ \
+ METHOD2(SetTextNodeValue, int /* id */, String /* text */) \
+ \
+ /* Tells dom agent that the client has lost all of the dom-related
+ information and is no longer interested in the notifications related to the
+ nodes issued earlier. */ \
+ METHOD0(DiscardBindings)
+
+DEFINE_RPC_CLASS(DomAgent, DOM_AGENT_STRUCT)
+
+#define DOM_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
+ /* Notifies the delegate that document element is available. */ \
+ METHOD1(DocumentElementUpdated, Value /* node */) \
+ \
+ /* Notifies the delegate that element's attributes are updated. */ \
+ METHOD2(AttributesUpdated, int /* id */, Value /* attributes */) \
+ \
+ /* Notifies the delegate that element's child nodes have been updated. */ \
+ METHOD2(ChildNodesUpdated, int /* id */, Value /* node */) \
+ \
+ /* Notifies the delegate that element's 'has children' state has been
+ updated */ \
+ METHOD2(HasChildrenUpdated, int /* id */, bool /* new_value */) \
+ \
+ /* Notifies the delegate that child node has been inserted. */ \
+ METHOD3(ChildNodeInserted, int /* parent_id */ , int /* prev_id */, \
+ Value /* node */) \
+ \
+ /* Notifies the delegate that child node has been deleted. */ \
+ METHOD2(ChildNodeRemoved, int /* parent_id */, int /* id */)
+
+DEFINE_RPC_CLASS(DomAgentDelegate, DOM_AGENT_DELEGATE_STRUCT)
+
+#endif // WEBKIT_GLUE_DEVTOOLS_DOM_AGENT_H_
diff --git a/webkit/glue/devtools/dom_agent_impl.cc b/webkit/glue/devtools/dom_agent_impl.cc
new file mode 100644
index 0000000..5f7a66a
--- /dev/null
+++ b/webkit/glue/devtools/dom_agent_impl.cc
@@ -0,0 +1,406 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+
+#include "webkit/glue/devtools/dom_agent_impl.h"
+
+#include "AtomicString.h"
+#include "Document.h"
+#include "Event.h"
+#include "EventListener.h"
+#include "EventNames.h"
+#include "EventTarget.h"
+#include "HTMLFrameOwnerElement.h"
+#include "markup.h"
+#include "MutationEvent.h"
+#include "Node.h"
+#include "Text.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/Vector.h>
+#undef LOG
+
+#include "base/values.h"
+#include "webkit/glue/glue_util.h"
+
+using namespace WebCore;
+
+// static
+PassRefPtr<DomAgentImpl::EventListenerWrapper>
+ DomAgentImpl::EventListenerWrapper::Create(
+ DomAgentImpl* dom_agent_impl) {
+ return adoptRef(new EventListenerWrapper(dom_agent_impl));
+}
+
+DomAgentImpl::EventListenerWrapper::EventListenerWrapper(
+ DomAgentImpl* dom_agent_impl) : dom_agent_impl_(dom_agent_impl) {
+}
+
+void DomAgentImpl::EventListenerWrapper::handleEvent(
+ Event* event,
+ bool isWindowEvent) {
+ dom_agent_impl_->handleEvent(event, isWindowEvent);
+}
+
+DomAgentImpl::DomAgentImpl(DomAgentDelegate* delegate)
+ : delegate_(delegate),
+ last_node_id_(1),
+ document_element_requested_(false) {
+ event_listener_ = EventListenerWrapper::Create(this);
+}
+
+DomAgentImpl::~DomAgentImpl() {
+ SetDocument(NULL);
+}
+
+void DomAgentImpl::SetDocument(Document* doc) {
+ DiscardBindings();
+
+ ListHashSet<RefPtr<Document> > copy = documents_;
+ for (ListHashSet<RefPtr<Document> >::iterator it = copy.begin();
+ it != copy.end(); ++it) {
+ StopListening((*it).get());
+ }
+ ASSERT(documents_.size() == 0);
+
+ if (doc) {
+ StartListening(doc);
+ if (document_element_requested_) {
+ GetDocumentElement();
+ document_element_requested_ = false;
+ }
+ }
+}
+
+void DomAgentImpl::StartListening(Document* doc) {
+ if (documents_.find(doc) != documents_.end())
+ return;
+ doc->addEventListener(eventNames().DOMContentLoadedEvent, event_listener_,
+ false);
+ doc->addEventListener(eventNames().DOMNodeInsertedEvent, event_listener_,
+ false);
+ doc->addEventListener(eventNames().DOMNodeRemovedEvent, event_listener_,
+ false);
+ doc->addEventListener(eventNames().DOMNodeRemovedFromDocumentEvent,
+ event_listener_, false);
+ doc->addEventListener(eventNames().DOMAttrModifiedEvent, event_listener_,
+ false);
+ documents_.add(doc);
+}
+
+void DomAgentImpl::StopListening(Document* doc) {
+ doc->removeEventListener(eventNames().DOMContentLoadedEvent,
+ event_listener_.get(), false);
+ doc->removeEventListener(eventNames().DOMNodeInsertedEvent,
+ event_listener_.get(), false);
+ doc->removeEventListener(eventNames().DOMNodeRemovedEvent,
+ event_listener_.get(), false);
+ doc->removeEventListener(eventNames().DOMNodeRemovedFromDocumentEvent,
+ event_listener_.get(), false);
+ doc->removeEventListener(eventNames().DOMAttrModifiedEvent,
+ event_listener_.get(), false);
+ documents_.remove(doc);
+}
+
+int DomAgentImpl::Bind(Node* node) {
+ HashMap<Node*, int>::iterator it = node_to_id_.find(node);
+ if (it != node_to_id_.end())
+ return it->second;
+ int id = last_node_id_++;
+ node_to_id_.set(node, id);
+ id_to_node_.set(id, node);
+ return id;
+}
+
+void DomAgentImpl::Unbind(Node* node) {
+ if (node->isFrameOwnerElement()) {
+ const HTMLFrameOwnerElement* frame_owner =
+ static_cast<const HTMLFrameOwnerElement*>(node);
+ StopListening(frame_owner->contentDocument());
+ }
+
+ HashMap<Node*, int>::iterator it = node_to_id_.find(node);
+ if (it != node_to_id_.end()) {
+ id_to_node_.remove(id_to_node_.find(it->second));
+ children_requested_.remove(children_requested_.find(it->second));
+ node_to_id_.remove(it);
+ }
+}
+
+void DomAgentImpl::DiscardBindings() {
+ node_to_id_.clear();
+ id_to_node_.clear();
+ children_requested_.clear();
+}
+
+Node* DomAgentImpl::GetNodeForId(int id) {
+ HashMap<int, Node*>::iterator it = id_to_node_.find(id);
+ if (it != id_to_node_.end()) {
+ return it->second;
+ }
+ return NULL;
+}
+
+int DomAgentImpl::GetIdForNode(Node* node) {
+ if (node == NULL) {
+ return 0;
+ }
+ HashMap<Node*, int>::iterator it = node_to_id_.find(node);
+ if (it != node_to_id_.end()) {
+ return it->second;
+ }
+ return 0;
+}
+
+void DomAgentImpl::handleEvent(Event* event, bool isWindowEvent) {
+ AtomicString type = event->type();
+ Node* node = event->target()->toNode();
+
+ // Remove mapping entry if necessary.
+ if (type == eventNames().DOMNodeRemovedFromDocumentEvent) {
+ Unbind(node);
+ return;
+ }
+
+ if (type == eventNames().DOMAttrModifiedEvent) {
+ int id = GetIdForNode(node);
+ if (!id) {
+ // Node is not mapped yet -> ignore the event.
+ return;
+ }
+ Element* element = static_cast<Element*>(node);
+ OwnPtr<Value> attributesValue(BuildValueForElementAttributes(element));
+ delegate_->AttributesUpdated(id, *attributesValue.get());
+ } else if (type == eventNames().DOMNodeInsertedEvent) {
+ Node* parent = static_cast<MutationEvent*>(event)->relatedNode();
+ int parent_id = GetIdForNode(parent);
+ if (!parent_id) {
+ // Parent is not mapped yet -> ignore the event.
+ return;
+ }
+ HashSet<int>::iterator cit = children_requested_.find(parent_id);
+ if (cit == children_requested_.end()) {
+ // No children are mapped yet -> only notify on changes of hasChildren.
+ delegate_->HasChildrenUpdated(parent_id, true);
+ } else {
+ // Children have been requested -> return value of a new child.
+ int prev_id = GetIdForNode(node->previousSibling());
+ OwnPtr<Value> value(BuildValueForNode(node, 0));
+ delegate_->ChildNodeInserted(parent_id, prev_id, *value.get());
+ }
+ } else if (type == eventNames().DOMNodeRemovedEvent) {
+ Node* parent = static_cast<MutationEvent*>(event)->relatedNode();
+ int parent_id = GetIdForNode(parent);
+ if (!parent_id) {
+ // Parent is not mapped yet -> ignore the event.
+ return;
+ }
+ HashSet<int>::iterator cit = children_requested_.find(parent_id);
+ if (cit == children_requested_.end()) {
+ // No children are mapped yet -> only notify on changes of hasChildren.
+ if (parent->childNodeCount() == 1)
+ delegate_->HasChildrenUpdated(parent_id, false);
+ } else {
+ int id = GetIdForNode(node);
+ delegate_->ChildNodeRemoved(parent_id, id);
+ }
+ } else if (type == eventNames().DOMContentLoadedEvent) {
+ //TODO(pfeldman): handle content load event.
+ }
+}
+
+void DomAgentImpl::GetDocumentElement() {
+ if (documents_.size() > 0) {
+ OwnPtr<Value> value(
+ BuildValueForNode((*documents_.begin())->documentElement(), 0));
+ delegate_->DocumentElementUpdated(*value.get());
+ } else {
+ document_element_requested_ = true;
+ }
+}
+
+void DomAgentImpl::GetChildNodes(int element_id) {
+ Node* node = GetNodeForId(element_id);
+ if (!node || (node->nodeType() != Node::ELEMENT_NODE))
+ return;
+
+ Element* element = static_cast<Element*>(node);
+ OwnPtr<Value> children(BuildValueForElementChildren(element, 1));
+ children_requested_.add(element_id);
+ delegate_->ChildNodesUpdated(element_id, *children.get());
+}
+
+int DomAgentImpl::GetPathToNode(Node* node_to_select) {
+ ASSERT(node_to_select); // Invalid input
+
+ // Return id in case the node is known.
+ int result = GetIdForNode(node_to_select);
+ if (result)
+ return result;
+
+ Element* element = InnerParentElement(node_to_select);
+ ASSERT(element); // Node is detached or is a document itself
+
+ Vector<Element*> path;
+ while (element && !GetIdForNode(element)) {
+ path.append(element);
+ element = InnerParentElement(element);
+ }
+ // element is known to the client
+ ASSERT(element);
+ path.append(element);
+
+ for (int i = path.size() - 1; i >= 0; --i) {
+ element = path.at(i);
+ OwnPtr<Value> children(BuildValueForElementChildren(element, 1));
+ delegate_->ChildNodesUpdated(GetIdForNode(element), *children.get());
+ }
+ return GetIdForNode(node_to_select);
+}
+
+void DomAgentImpl::SetAttribute(
+ int element_id,
+ const String& name,
+ const String& value) {
+ Node* node = GetNodeForId(element_id);
+ if (node && (node->nodeType() == Node::ELEMENT_NODE)) {
+ Element* element = static_cast<Element*>(node);
+ ExceptionCode ec = 0;
+ element->setAttribute(name, value, ec);
+ }
+}
+
+void DomAgentImpl::RemoveAttribute(int element_id, const String& name) {
+ Node* node = GetNodeForId(element_id);
+ if (node && (node->nodeType() == Node::ELEMENT_NODE)) {
+ Element* element = static_cast<Element*>(node);
+ ExceptionCode ec = 0;
+ element->removeAttribute(name, ec);
+ }
+}
+
+void DomAgentImpl::SetTextNodeValue(int element_id, const String& value) {
+ Node* node = GetNodeForId(element_id);
+ if (node && (node->nodeType() == Node::TEXT_NODE)) {
+ Text* text_node = static_cast<Text*>(node);
+ ExceptionCode ec = 0;
+ // TODO(pfeldman): Add error handling
+ text_node->replaceWholeText(value, ec);
+ }
+}
+
+ListValue* DomAgentImpl::BuildValueForNode(Node* node, int depth) {
+ OwnPtr<ListValue> value(new ListValue());
+ int id = Bind(node);
+ String nodeName;
+ String nodeValue;
+
+ switch (node->nodeType()) {
+ case Node::TEXT_NODE:
+ case Node::COMMENT_NODE:
+ nodeValue = node->nodeValue();
+ break;
+ case Node::ATTRIBUTE_NODE:
+ case Node::DOCUMENT_NODE:
+ case Node::DOCUMENT_FRAGMENT_NODE:
+ break;
+ case Node::ELEMENT_NODE:
+ default: {
+ nodeName = node->nodeName();
+ break;
+ }
+ }
+
+ value->Append(Value::CreateIntegerValue(id));
+ value->Append(Value::CreateIntegerValue(node->nodeType()));
+ value->Append(Value::CreateStringValue(
+ webkit_glue::StringToStdWString(nodeName)));
+ value->Append(Value::CreateStringValue(
+ webkit_glue::StringToStdWString(nodeValue)));
+
+ if (node->nodeType() == Node::ELEMENT_NODE) {
+ Element* element = static_cast<Element*>(node);
+ value->Append(BuildValueForElementAttributes(element));
+ int nodeCount = InnerChildNodeCount(element);
+ value->Append(Value::CreateIntegerValue(nodeCount));
+ OwnPtr<ListValue> children(BuildValueForElementChildren(element, depth));
+ if (children->GetSize() > 0) {
+ value->Append(children.release());
+ }
+ }
+ return value.release();
+}
+
+ListValue* DomAgentImpl::BuildValueForElementAttributes(Element* element) {
+ OwnPtr<ListValue> attributesValue(new ListValue());
+ // Go through all attributes and serialize them.
+ const NamedAttrMap *attrMap = element->attributes(true);
+ if (!attrMap) {
+ return attributesValue.release();
+ }
+ unsigned numAttrs = attrMap->length();
+ for (unsigned i = 0; i < numAttrs; i++) {
+ // Add attribute pair
+ const Attribute *attribute = attrMap->attributeItem(i);
+ OwnPtr<Value> name(Value::CreateStringValue(
+ webkit_glue::StringToStdWString(attribute->name().toString())));
+ OwnPtr<Value> value(Value::CreateStringValue(
+ webkit_glue::StringToStdWString(attribute->value())));
+ attributesValue->Append(name.release());
+ attributesValue->Append(value.release());
+ }
+ return attributesValue.release();
+}
+
+ListValue* DomAgentImpl::BuildValueForElementChildren(
+ Element* element,
+ int depth) {
+ OwnPtr<ListValue> children(new ListValue());
+ if (depth == 0) {
+ // Special case the_only text child.
+ if (element->childNodeCount() == 1) {
+ Node *child = element->firstChild();
+ if (child->nodeType() == Node::TEXT_NODE) {
+ children->Append(BuildValueForNode(child, 0));
+ }
+ }
+ return children.release();
+ } else if (depth > 0) {
+ depth--;
+ }
+
+ for (Node *child = InnerFirstChild(element); child != NULL;
+ child = child->nextSibling()) {
+ children->Append(BuildValueForNode(child, depth));
+ }
+ return children.release();
+}
+
+Node* DomAgentImpl::InnerFirstChild(Node* node) {
+ if (node->isFrameOwnerElement()) {
+ HTMLFrameOwnerElement* frame_owner =
+ static_cast<HTMLFrameOwnerElement*>(node);
+ Document* doc = frame_owner->contentDocument();
+ StartListening(doc);
+ return doc->firstChild();
+ } else {
+ return node->firstChild();
+ }
+}
+
+int DomAgentImpl::InnerChildNodeCount(Node* node) {
+ if (node->isFrameOwnerElement()) {
+ return 1;
+ } else {
+ return node->childNodeCount();
+ }
+}
+
+Element* DomAgentImpl::InnerParentElement(Node* node) {
+ Element* element = node->parentElement();
+ if (!element) {
+ return node->ownerDocument()->ownerElement();
+ }
+ return element;
+}
diff --git a/webkit/glue/devtools/dom_agent_impl.h b/webkit/glue/devtools/dom_agent_impl.h
new file mode 100644
index 0000000..12d7540
--- /dev/null
+++ b/webkit/glue/devtools/dom_agent_impl.h
@@ -0,0 +1,119 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_DEVTOOLS_DOM_AGENT_IMPL_H_
+#define WEBKIT_GLUE_DEVTOOLS_DOM_AGENT_IMPL_H_
+
+#include "config.h"
+
+#include "EventListener.h"
+#include <wtf/ListHashSet.h>
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+#include "webkit/glue/devtools/dom_agent.h"
+
+namespace WebCore {
+class Document;
+class Element;
+class Event;
+class Node;
+}
+
+class ListValue;
+class Value;
+
+// DomAgent implementation.
+class DomAgentImpl : public DomAgent {
+ public:
+ explicit DomAgentImpl(DomAgentDelegate* delegate);
+ virtual ~DomAgentImpl();
+
+ // DomAgent implementation.
+ void GetDocumentElement();
+ void GetChildNodes(int element_id);
+ void SetAttribute(
+ int element_id,
+ const WebCore::String& name,
+ const WebCore::String& value);
+ void RemoveAttribute(int element_id, const WebCore::String& name);
+ void SetTextNodeValue(int element_id, const WebCore::String& value);
+ void DiscardBindings();
+
+ // Initializes dom agent with the given document.
+ void SetDocument(WebCore::Document* document);
+
+ // Returns node for given id according to the present binding.
+ WebCore::Node* GetNodeForId(int id);
+
+ // Returns id for given node according to the present binding.
+ int GetIdForNode(WebCore::Node* node);
+
+ // Sends path to a given node to the client. Returns node's id according to
+ // the resulting binding.
+ int GetPathToNode(WebCore::Node* node);
+
+ private:
+ // Convenience EventListner wrapper for cleaner Ref management.
+ class EventListenerWrapper : public WebCore::EventListener {
+ public:
+ static PassRefPtr<EventListenerWrapper> Create(
+ DomAgentImpl* dom_agent_impl);
+ virtual ~EventListenerWrapper() {}
+ virtual void handleEvent(WebCore::Event* event, bool isWindowEvent);
+ private:
+ explicit EventListenerWrapper(DomAgentImpl* dom_agent_impl);
+ DomAgentImpl* dom_agent_impl_;
+ DISALLOW_COPY_AND_ASSIGN(EventListenerWrapper);
+ };
+
+ void StartListening(WebCore::Document* document);
+
+ void StopListening(WebCore::Document* document);
+
+ // EventListener implementation
+ friend class EventListenerWrapper;
+ virtual void handleEvent(WebCore::Event* event, bool isWindowEvent);
+
+ // Binds given node and returns its generated id.
+ int Bind(WebCore::Node* node);
+
+ // Releases Node to int binding.
+ void Unbind(WebCore::Node* node);
+
+ // Serializes given node into the list value.
+ ListValue* BuildValueForNode(
+ WebCore::Node* node,
+ int depth);
+
+ // Serializes given element's attributes into the list value.
+ ListValue* BuildValueForElementAttributes(WebCore::Element* elemen);
+
+ // Serializes given elements's children into the list value.
+ ListValue* BuildValueForElementChildren(
+ WebCore::Element* element,
+ int depth);
+
+ // We represent embedded doms as a part of the same hierarchy. Hence we
+ // treat children of frame owners differently. Following two methods
+ // encapsulate frame owner specifics.
+ WebCore::Node* InnerFirstChild(WebCore::Node* node);
+ int InnerChildNodeCount(WebCore::Node* node);
+ WebCore::Element* InnerParentElement(WebCore::Node* node);
+
+ DomAgentDelegate* delegate_;
+ HashMap<WebCore::Node*, int> node_to_id_;
+ HashMap<int, WebCore::Node*> id_to_node_;
+ HashSet<int> children_requested_;
+ int last_node_id_;
+ ListHashSet<RefPtr<WebCore::Document> > documents_;
+ RefPtr<WebCore::EventListener> event_listener_;
+ bool document_element_requested_;
+
+ DISALLOW_COPY_AND_ASSIGN(DomAgentImpl);
+};
+
+#endif // WEBKIT_GLUE_DEVTOOLS_DOM_AGENT_IMPL_H_
diff --git a/webkit/glue/devtools/dom_agent_unittest.cc b/webkit/glue/devtools/dom_agent_unittest.cc
new file mode 100644
index 0000000..8c01e04
--- /dev/null
+++ b/webkit/glue/devtools/dom_agent_unittest.cc
@@ -0,0 +1,421 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+
+#include <wtf/OwnPtr.h>
+
+#include "CString.h"
+#include "Document.h"
+#include "HTMLFrameOwnerElement.h"
+#include "PlatformString.h"
+#undef LOG
+
+#include "base/file_path.h"
+#include "base/string_util.h"
+#include "base/values.h"
+#include "net/base/net_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "webkit/glue/devtools/devtools_mock_rpc.h"
+#include "webkit/glue/devtools/devtools_rpc.h"
+#include "webkit/glue/devtools/dom_agent.h"
+#include "webkit/glue/devtools/dom_agent_impl.h"
+#include "webkit/glue/dom_operations.h"
+#include "webkit/glue/glue_util.h"
+#include "webkit/glue/webframe.h"
+#include "webkit/glue/webframe_impl.h"
+#include "webkit/glue/webview.h"
+#include "webkit/tools/test_shell/test_shell_test.h"
+
+using WebCore::Document;
+using WebCore::Element;
+using WebCore::ExceptionCode;
+using WebCore::HTMLFrameOwnerElement;
+using WebCore::Node;
+using WebCore::String;
+
+namespace {
+
+class MockDomAgentDelegate : public DomAgentDelegateStub,
+ public DevToolsMockRpc {
+ public:
+ MockDomAgentDelegate() : DomAgentDelegateStub(NULL) {
+ set_delegate(this);
+ }
+ ~MockDomAgentDelegate() {}
+};
+
+class DomAgentTests : public TestShellTest {
+ public:
+ DomAgentTests() : ec_(0) {}
+
+ protected:
+ // testing::Test
+ virtual void SetUp() {
+ TestShellTest::SetUp();
+ test_shell_->ResetTestController();
+ GURL file_url = net::FilePathToFileURL(data_dir_);
+ WebFrame* main_frame = test_shell_->webView()->GetMainFrame();
+ main_frame->LoadHTMLString("<html><body/></html>",
+ file_url);
+ WebFrameImpl* main_frame_impl = static_cast<WebFrameImpl*>(main_frame);
+
+ document_ = main_frame_impl->frame()->document();
+ Node* html = document_->documentElement();
+ body_ = static_cast<Element*>(html->firstChild());
+
+ mock_delegate_.set(new MockDomAgentDelegate());
+ dom_agent_.set(new DomAgentImpl(mock_delegate_.get()));
+ dom_agent_->SetDocument(document_.get());
+ }
+
+ virtual void TearDown() {
+ TestShellTest::TearDown();
+ dom_agent_.set(NULL);
+ body_ = NULL;
+ document_ = NULL;
+ }
+
+ static const int kHtmlElemId = 1;
+ static const int kBodyElemId = 2;
+
+ RefPtr<Document> document_;
+ RefPtr<Element> body_;
+ OwnPtr<DomAgentImpl> dom_agent_;
+ ExceptionCode ec_;
+ OwnPtr<MockDomAgentDelegate> mock_delegate_;
+};
+
+// Requests document node and tests that the callback with the serialized
+// version is called.
+TEST_F(DomAgentTests, DocumentElementUpdated) {
+ OwnPtr<Value> v(DevToolsRpc::ParseMessage("[1,1,\"HTML\",\"\",[],1]"));
+ mock_delegate_->DocumentElementUpdated(*v.get());
+ mock_delegate_->Replay();
+
+ dom_agent_->GetDocumentElement();
+ mock_delegate_->Verify();
+}
+
+// Requests element's children and tests that the callback with the serialized
+// version is called.
+TEST_F(DomAgentTests, ChildNodesUpdated) {
+ dom_agent_->GetDocumentElement();
+ mock_delegate_->Reset();
+
+ OwnPtr<Value> v(DevToolsRpc::ParseMessage("[[2,1,\"BODY\",\"\",[],0]]"));
+ mock_delegate_->ChildNodesUpdated(1, *v.get());
+ mock_delegate_->Replay();
+
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeInsertedUnknownParent) {
+ dom_agent_->GetDocumentElement();
+ mock_delegate_->Reset();
+
+ // There should be no events fired until parent node is known to client.
+ RefPtr<Element> div = document_->createElement("DIV", ec_);
+ body_->appendChild(div, ec_);
+ mock_delegate_->Replay();
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeInsertedKnownParent) {
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ mock_delegate_->Reset();
+
+ // There should be an event fired in case parent node is known to client,
+ // but the event should not be specific.
+ mock_delegate_->HasChildrenUpdated(kBodyElemId, true);
+ mock_delegate_->Replay();
+
+ RefPtr<Element> div = document_->createElement("DIV", ec_);
+ body_->appendChild(div, ec_);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeInsertedKnownChildren) {
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ dom_agent_->GetChildNodes(kBodyElemId);
+ mock_delegate_->Reset();
+
+ // There should be an event fired in case parent node is known to client,
+ // Since children were already requested, event should have all the
+ // new child data.
+ OwnPtr<Value> v(DevToolsRpc::ParseMessage("[3,1,\"DIV\",\"\",[],0]"));
+ mock_delegate_->ChildNodeInserted(kBodyElemId, 0, *v.get());
+ mock_delegate_->Replay();
+
+ RefPtr<Element> div = document_->createElement("DIV", ec_);
+ body_->appendChild(div, ec_);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodePrepend) {
+ RefPtr<Element> div = document_->createElement("DIV", ec_);
+ body_->appendChild(div, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ dom_agent_->GetChildNodes(kBodyElemId);
+ mock_delegate_->Reset();
+
+ // There should be an event fired in case parent node is known to client,
+ // Since children were already requested, event should have all the
+ // new child data.
+ OwnPtr<Value> v(DevToolsRpc::ParseMessage("[4,1,\"DIV\",\"\",[],0]"));
+ mock_delegate_->ChildNodeInserted(kBodyElemId, 0, *v.get());
+ mock_delegate_->Replay();
+
+ RefPtr<Element> new_div = document_->createElement("DIV", ec_);
+ body_->insertBefore(new_div, div.get(), ec_, false);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeAppend) {
+ RefPtr<Element> div = document_->createElement("DIV", ec_);
+ body_->appendChild(div, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ dom_agent_->GetChildNodes(kBodyElemId);
+ mock_delegate_->Reset();
+
+ // There should be an event fired in case parent node is known to client,
+ // Since children were already requested, event should have all the
+ // new child data.
+ OwnPtr<Value> v(DevToolsRpc::ParseMessage("[4,1,\"DIV\",\"\",[],0]"));
+ mock_delegate_->ChildNodeInserted(kBodyElemId, 3, *v.get());
+ mock_delegate_->Replay();
+
+ RefPtr<Element> new_div = document_->createElement("DIV", ec_);
+ body_->appendChild(new_div, ec_, false);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeInsert) {
+ RefPtr<Element> div1 = document_->createElement("DIV", ec_);
+ body_->appendChild(div1, ec_);
+ RefPtr<Element> div2 = document_->createElement("DIV", ec_);
+ body_->appendChild(div2, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ dom_agent_->GetChildNodes(kBodyElemId);
+ mock_delegate_->Reset();
+
+ // There should be an event fired in case parent node is known to client,
+ // Since children were already requested, event should have all the
+ // new child data.
+ OwnPtr<Value> v(DevToolsRpc::ParseMessage("[5,1,\"DIV\",\"\",[],0]"));
+ mock_delegate_->ChildNodeInserted(kBodyElemId, 3, *v.get());
+ mock_delegate_->Replay();
+
+ RefPtr<Element> new_div = document_->createElement("DIV", ec_);
+ body_->insertBefore(new_div, div2.get(), ec_, false);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeRemovedUnknownParent) {
+ RefPtr<Element> div = document_->createElement("DIV", ec_);
+ body_->appendChild(div, ec_);
+
+ dom_agent_->GetDocumentElement();
+ mock_delegate_->Reset();
+
+ // There should be no events fired until parent node is known to client.
+ mock_delegate_->Replay();
+ body_->removeChild(div.get(), ec_);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeRemovedKnownParent) {
+ RefPtr<Element> div = document_->createElement("DIV", ec_);
+ body_->appendChild(div, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ mock_delegate_->Reset();
+
+ // There should be an event fired in case parent node is known to client,
+ // but the event should not be specific.
+ mock_delegate_->HasChildrenUpdated(kBodyElemId, false);
+ mock_delegate_->Replay();
+
+ body_->removeChild(div.get(), ec_);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeRemovedKnownChildren) {
+ RefPtr<Element> div = document_->createElement("DIV", ec_);
+ body_->appendChild(div, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ dom_agent_->GetChildNodes(kBodyElemId);
+ mock_delegate_->Reset();
+
+ // There should be an event fired in case parent node is known to client,
+ // Since children were already requested, event should have removed child id.
+ mock_delegate_->ChildNodeRemoved(kBodyElemId, 3);
+ mock_delegate_->Replay();
+
+ body_->removeChild(div.get(), ec_);
+ mock_delegate_->Verify();
+}
+
+// Tests that "GetPathToNode" sends all missing events in path.
+TEST_F(DomAgentTests, GetPathToKnownNode) {
+ RefPtr<Element> div1 = document_->createElement("DIV", ec_);
+ body_->appendChild(div1, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ dom_agent_->GetChildNodes(kBodyElemId);
+ mock_delegate_->Reset();
+
+ // We expect no messages - node is already known.
+ mock_delegate_->Replay();
+
+ int id = dom_agent_->GetPathToNode(div1.get());
+ mock_delegate_->Verify();
+ EXPECT_EQ(3, id);
+}
+
+// Tests that "GetPathToNode" sends all missing events in path.
+TEST_F(DomAgentTests, GetPathToKnownParent) {
+ RefPtr<Element> div1 = document_->createElement("DIV", ec_);
+ body_->appendChild(div1, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ mock_delegate_->Reset();
+
+ OwnPtr<Value> v1(DevToolsRpc::ParseMessage("[[3,1,\"DIV\",\"\",[],0]]"));
+ mock_delegate_->ChildNodesUpdated(kBodyElemId, *v1.get());
+ mock_delegate_->Replay();
+
+ int id = dom_agent_->GetPathToNode(div1.get());
+ mock_delegate_->Verify();
+ EXPECT_EQ(3, id);
+}
+
+// Tests that "GetPathToNode" sends all missing events in path.
+TEST_F(DomAgentTests, GetPathToUnknownNode) {
+ RefPtr<Element> div1 = document_->createElement("DIV", ec_);
+ RefPtr<Element> div2 = document_->createElement("DIV", ec_);
+ RefPtr<Element> div3 = document_->createElement("DIV", ec_);
+ RefPtr<Element> div4 = document_->createElement("DIV", ec_);
+ body_->appendChild(div1, ec_);
+ div1->appendChild(div2, ec_);
+ div2->appendChild(div3, ec_);
+ div3->appendChild(div4, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ mock_delegate_->Reset();
+
+ OwnPtr<Value> v1(DevToolsRpc::ParseMessage("[[3,1,\"DIV\",\"\",[],1]]"));
+ OwnPtr<Value> v2(DevToolsRpc::ParseMessage("[[4,1,\"DIV\",\"\",[],1]]"));
+ OwnPtr<Value> v3(DevToolsRpc::ParseMessage("[[5,1,\"DIV\",\"\",[],1]]"));
+ OwnPtr<Value> v4(DevToolsRpc::ParseMessage("[[6,1,\"DIV\",\"\",[],0]]"));
+ mock_delegate_->ChildNodesUpdated(kBodyElemId, *v1.get());
+ mock_delegate_->ChildNodesUpdated(3, *v2.get());
+ mock_delegate_->ChildNodesUpdated(4, *v3.get());
+ mock_delegate_->ChildNodesUpdated(5, *v4.get());
+ mock_delegate_->Replay();
+
+ int id = dom_agent_->GetPathToNode(div4.get());
+ mock_delegate_->Verify();
+ EXPECT_EQ(6, id);
+}
+
+// Tests that "GetChildNodes" crosses frame owner boundaries.
+TEST_F(DomAgentTests, GetChildNodesOfFrameOwner) {
+ RefPtr<Element> iframe = document_->createElement("IFRAME", ec_);
+ body_->appendChild(iframe, ec_);
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ dom_agent_->GetChildNodes(kBodyElemId);
+ mock_delegate_->Reset();
+
+ // Expecting HTML child with single (body) child.
+ OwnPtr<Value> v(DevToolsRpc::ParseMessage("[[4,1,\"HTML\",\"\",[],1]]"));
+ mock_delegate_->ChildNodesUpdated(3, *v.get());
+ mock_delegate_->Replay();
+
+ dom_agent_->GetChildNodes(3);
+ mock_delegate_->Verify();
+}
+
+// Tests that "GetPathToNode" crosses frame owner boundaries.
+TEST_F(DomAgentTests, GetPathToNodeOverFrameOwner) {
+ RefPtr<Element> iframe = document_->createElement("IFRAME", ec_);
+ body_->appendChild(iframe, ec_);
+ HTMLFrameOwnerElement* frame_owner =
+ static_cast<HTMLFrameOwnerElement*>(iframe.get());
+ Node* inner_body = frame_owner->contentDocument()->firstChild()->
+ firstChild();
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ mock_delegate_->Reset();
+
+ OwnPtr<Value> v1(DevToolsRpc::ParseMessage("[[3,1,\"IFRAME\",\"\",[],1]]"));
+ OwnPtr<Value> v2(DevToolsRpc::ParseMessage("[[4,1,\"HTML\",\"\",[],1]]"));
+ OwnPtr<Value> v3(DevToolsRpc::ParseMessage("[[5,1,\"BODY\",\"\",[],0]]"));
+ mock_delegate_->ChildNodesUpdated(2, *v1.get());
+ mock_delegate_->ChildNodesUpdated(3, *v2.get());
+ mock_delegate_->ChildNodesUpdated(4, *v3.get());
+
+ mock_delegate_->Replay();
+
+ dom_agent_->GetPathToNode(inner_body);
+ mock_delegate_->Verify();
+}
+
+// Tests that "child node inserted" event is being fired.
+TEST_F(DomAgentTests, ChildNodeInsertUnderFrameOwner) {
+ RefPtr<Element> iframe = document_->createElement("IFRAME", ec_);
+ body_->appendChild(iframe, ec_);
+ HTMLFrameOwnerElement* frame_owner =
+ static_cast<HTMLFrameOwnerElement*>(iframe.get());
+ Node* inner_body = frame_owner->contentDocument()->firstChild()->
+ firstChild();
+
+ dom_agent_->GetDocumentElement();
+ dom_agent_->GetChildNodes(kHtmlElemId);
+ dom_agent_->GetChildNodes(kBodyElemId);
+ dom_agent_->GetChildNodes(3); // IFrame children
+ dom_agent_->GetChildNodes(4); // IFrame html's children
+ dom_agent_->GetChildNodes(5); // IFrame body's children
+ mock_delegate_->Reset();
+
+ // There should be an event fired in case parent node is known to client,
+ // Since children were already requested, event should have all the
+ // new child data.
+ OwnPtr<Value> v(DevToolsRpc::ParseMessage("[6,1,\"DIV\",\"\",[],0]"));
+ mock_delegate_->ChildNodeInserted(5, 0, *v.get());
+ mock_delegate_->Replay();
+
+ RefPtr<Element> new_div = document_->createElement("DIV", ec_);
+ inner_body->appendChild(new_div.get(), ec_, false);
+ mock_delegate_->Verify();
+}
+
+} // namespace
diff --git a/webkit/glue/devtools/net_agent.h b/webkit/glue/devtools/net_agent.h
new file mode 100644
index 0000000..00db4af0
--- /dev/null
+++ b/webkit/glue/devtools/net_agent.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_DEVTOOLS_NET_AGENT_H_
+#define WEBKIT_GLUE_DEVTOOLS_NET_AGENT_H_
+
+#include "webkit/glue/devtools/devtools_rpc.h"
+
+// NetAgent is a utility object that covers network-related functionality of the
+// WebDevToolsAgent. It is capable of sniffing network calls and passing the
+// HTTPRequest-related data to the client.
+// NetAgent's environment is represented with the NetAgentDelegate interface.
+#define NET_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
+ /* Requests that the agent sends content of the resource with given id to the
+ delegate. */ \
+ METHOD2(GetResourceContent, int /* identifier */, String /* url */)
+
+DEFINE_RPC_CLASS(NetAgent, NET_AGENT_STRUCT)
+
+#define NET_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
+ /* Notifies the delegate that a request is about to be sent out. */ \
+ METHOD2(WillSendRequest, int, Value) \
+ \
+ /* Notifies the delegate that response has been received. */ \
+ METHOD2(DidReceiveResponse, int /* identifier */, Value /* request */) \
+ \
+ /* Notifies the delegate that resource loading has been finished with no
+ errors */ \
+ METHOD2(DidFinishLoading, int /* identifier */, Value /* response */) \
+ \
+ /* Notifies the delegate that resource loading has failed. */ \
+ METHOD2(DidFailLoading, int /* identifier */, Value /* response */) \
+ \
+ /* Calls delegate back with requested resource content. */ \
+ METHOD2(SetResourceContent, int /* identifier */, String /* content */)
+
+DEFINE_RPC_CLASS(NetAgentDelegate, NET_AGENT_DELEGATE_STRUCT)
+
+#endif // WEBKIT_GLUE_DEVTOOLS_NET_AGENT_H_
diff --git a/webkit/glue/devtools/net_agent_impl.cc b/webkit/glue/devtools/net_agent_impl.cc
new file mode 100644
index 0000000..67fe1b8
--- /dev/null
+++ b/webkit/glue/devtools/net_agent_impl.cc
@@ -0,0 +1,204 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+
+#include "webkit/glue/devtools/net_agent_impl.h"
+
+#include "CachedCSSStyleSheet.h"
+#include "CachedResource.h"
+#include "CachedScript.h"
+#include "CachedXSLStyleSheet.h"
+#include "DocLoader.h"
+#include "Document.h"
+#include "DocumentLoader.h"
+#include "FrameLoader.h"
+#include "HTTPHeaderMap.h"
+#include "KURL.h"
+#include "PlatformString.h"
+#include "ResourceError.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include "TextEncoding.h"
+#include <wtf/CurrentTime.h>
+#undef LOG
+
+#include "base/basictypes.h"
+#include "base/values.h"
+#include "googleurl/src/gurl.h"
+#include "webkit/glue/glue_util.h"
+
+using namespace WebCore;
+
+NetAgentImpl::NetAgentImpl(NetAgentDelegate* delegate)
+ : delegate_(delegate),
+ document_(NULL),
+ last_cached_identifier_(-2) {
+}
+
+NetAgentImpl::~NetAgentImpl() {
+ SetDocument(NULL);
+}
+
+void NetAgentImpl::SetDocument(Document* doc) {
+// loaders_.clear();
+ document_ = doc;
+}
+
+void NetAgentImpl::AssignIdentifierToRequest(
+ DocumentLoader* loader,
+ int identifier,
+ const ResourceRequest& request) {
+ loaders_.set(identifier, loader);
+}
+
+void NetAgentImpl::WillSendRequest(
+ DocumentLoader* loader,
+ int identifier,
+ const ResourceRequest& request) {
+ KURL url = request.url();
+ DictionaryValue value;
+ value.SetReal(L"startTime", WTF::currentTime());
+ value.SetString(L"url", webkit_glue::StringToStdString(url.string()));
+ value.SetString(L"domain", webkit_glue::StringToStdString(url.host()));
+ value.SetString(L"path", webkit_glue::StringToStdString(url.path()));
+ value.SetString(L"lastPathComponent",
+ webkit_glue::StringToStdString(url.lastPathComponent()));
+ value.Set(L"requestHeaders",
+ BuildValueForHeaders(request.httpHeaderFields()));
+ delegate_->WillSendRequest(identifier, value);
+}
+
+void NetAgentImpl::DidReceiveResponse(
+ DocumentLoader* loader,
+ int identifier,
+ const ResourceResponse &response) {
+ if (!document_) {
+ return;
+ }
+ KURL url = response.url();
+
+ DictionaryValue value;
+ value.SetReal(L"responseReceivedTime", WTF::currentTime());
+ value.SetString(L"url",
+ webkit_glue::StringToStdWString(url.string()));
+ value.SetInteger(L"expectedContentLength",
+ static_cast<int>(response.expectedContentLength()));
+ value.SetInteger(L"responseStatusCode", response.httpStatusCode());
+ value.SetString(L"mimeType",
+ webkit_glue::StringToStdWString(response.mimeType()));
+ value.SetString(L"suggestedFilename",
+ webkit_glue::StringToStdWString(response.suggestedFilename()));
+ value.Set(L"responseHeaders",
+ BuildValueForHeaders(response.httpHeaderFields()));
+
+ delegate_->DidReceiveResponse(identifier, value);
+}
+
+void NetAgentImpl::DidReceiveContentLength(
+ DocumentLoader* loader,
+ int identifier,
+ int length) {
+}
+
+void NetAgentImpl::DidFinishLoading(
+ DocumentLoader* loader,
+ int identifier) {
+ DictionaryValue value;
+ value.SetReal(L"endTime", WTF::currentTime());
+ delegate_->DidFinishLoading(identifier, value);
+}
+
+void NetAgentImpl::DidFailLoading(
+ DocumentLoader* loader,
+ int identifier,
+ const ResourceError& error) {
+ DictionaryValue value;
+ value.SetReal(L"endTime", WTF::currentTime());
+ value.SetInteger(L"errorCode", error.errorCode());
+ value.SetString(L"localizedDescription",
+ webkit_glue::StringToStdString(error.localizedDescription()));
+ delegate_->DidFailLoading(identifier, value);
+}
+
+void NetAgentImpl::DidLoadResourceFromMemoryCache(
+ DocumentLoader* loader,
+ const ResourceRequest& request,
+ const ResourceResponse& response,
+ int length) {
+ int identifier = last_cached_identifier_--;
+ loaders_.set(identifier, loader);
+}
+
+void NetAgentImpl::GetResourceContent(
+ int identifier,
+ const String& url) {
+ if (!document_) {
+ return;
+ }
+ HashMap<int, RefPtr<DocumentLoader> >::iterator it =
+ loaders_.find(identifier);
+ if (it == loaders_.end() || !it->second) {
+ return;
+ }
+
+ RefPtr<DocumentLoader> loader = it->second;
+ String source;
+
+ if (url == loader->requestURL()) {
+ RefPtr<SharedBuffer> buffer = loader->mainResourceData();
+ String text_encoding_name = document_->inputEncoding();
+ if (buffer) {
+ WebCore::TextEncoding encoding(text_encoding_name);
+ if (!encoding.isValid())
+ encoding = WindowsLatin1Encoding();
+ source = encoding.decode(buffer->data(), buffer->size());
+ }
+ } else {
+ CachedResource* cachedResource = document_->
+ docLoader()->cachedResource(url);
+ if (!cachedResource->isPurgeable()) {
+ // TODO(pfeldman): Try making unpurgeable.
+ return;
+ }
+
+ // Try to get the decoded source. Only applies to some CachedResource
+ // types.
+ switch (cachedResource->type()) {
+ case CachedResource::CSSStyleSheet: {
+ CachedCSSStyleSheet *sheet =
+ reinterpret_cast<CachedCSSStyleSheet*>(cachedResource);
+ source = sheet->sheetText();
+ break;
+ }
+ case CachedResource::Script: {
+ CachedScript *script =
+ reinterpret_cast<CachedScript*>(cachedResource);
+ source = script->script();
+ break;
+ }
+#if ENABLE(XSLT)
+ case CachedResource::XSLStyleSheet: {
+ CachedXSLStyleSheet *sheet =
+ reinterpret_cast<CachedXSLStyleSheet*>(cachedResource);
+ source = sheet->sheet();
+ break;
+ }
+#endif
+ default:
+ break;
+ }
+ }
+ delegate_->SetResourceContent(identifier, source);
+}
+
+Value* NetAgentImpl::BuildValueForHeaders(const HTTPHeaderMap& headers) {
+ OwnPtr<DictionaryValue> value(new DictionaryValue());
+ HTTPHeaderMap::const_iterator end = headers.end();
+ for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it) {
+ value->SetString(webkit_glue::StringToStdWString(it->first),
+ webkit_glue::StringToStdString(it->second));
+ }
+ return value.release();
+}
diff --git a/webkit/glue/devtools/net_agent_impl.h b/webkit/glue/devtools/net_agent_impl.h
new file mode 100644
index 0000000..b9d56fc
--- /dev/null
+++ b/webkit/glue/devtools/net_agent_impl.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_DEVTOOLS_NET_AGENT_IMPL_H_
+#define WEBKIT_GLUE_DEVTOOLS_NET_AGENT_IMPL_H_
+
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+#include "webkit/glue/devtools/net_agent.h"
+
+namespace WebCore {
+class Document;
+class DocumentLoader;
+class HTTPHeaderMap;
+class ResourceError;
+class ResourceResponse;
+class String;
+struct ResourceRequest;
+}
+
+class Value;
+
+// NetAgent is a utility object that covers network-related functionality of the
+// WebDevToolsAgent. It is capable of sniffing network calls and passing the
+// HttpRequest-related data to the client.
+// NetAgent's environment is represented with the NetAgentDelegate interface.
+class NetAgentImpl : public NetAgent {
+ public:
+ explicit NetAgentImpl(NetAgentDelegate* delegate);
+ virtual ~NetAgentImpl();
+
+ // Initializes net agent with the given document.
+ void SetDocument(WebCore::Document* document);
+
+ // NetAgent implementation.
+ void GetResourceContent(int identifier, const WebCore::String& request_url);
+ void AssignIdentifierToRequest(
+ WebCore::DocumentLoader* loader,
+ int identifier,
+ const WebCore::ResourceRequest& request);
+ void WillSendRequest(
+ WebCore::DocumentLoader* loader,
+ int identifier,
+ const WebCore::ResourceRequest& request);
+ void DidReceiveResponse(
+ WebCore::DocumentLoader* loader,
+ int identifier,
+ const WebCore::ResourceResponse &response);
+ void DidReceiveContentLength(
+ WebCore::DocumentLoader* loader,
+ int identifier,
+ int length);
+ void DidFinishLoading(
+ WebCore::DocumentLoader* loader,
+ int identifier);
+ void DidFailLoading(
+ WebCore::DocumentLoader* loader,
+ int identifier,
+ const WebCore::ResourceError& error);
+ void DidLoadResourceFromMemoryCache(
+ WebCore::DocumentLoader* loader,
+ const WebCore::ResourceRequest& request,
+ const WebCore::ResourceResponse& response,
+ int length);
+
+ private:
+ // Serializes headers map into a value.
+ Value* BuildValueForHeaders(const WebCore::HTTPHeaderMap& headers);
+
+ NetAgentDelegate* delegate_;
+ WebCore::Document* document_;
+ HashMap<int, RefPtr<WebCore::DocumentLoader> > loaders_;
+ int last_cached_identifier_;
+ DISALLOW_COPY_AND_ASSIGN(NetAgentImpl);
+};
+
+#endif // WEBKIT_GLUE_DEVTOOLS_NET_AGENT_IMPL_H_
diff --git a/webkit/glue/devtools/tools_agent.h b/webkit/glue/devtools/tools_agent.h
new file mode 100644
index 0000000..0d1bde9
--- /dev/null
+++ b/webkit/glue/devtools/tools_agent.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_DEVTOOLS_TOOLS_AGENT_H_
+#define WEBKIT_GLUE_DEVTOOLS_TOOLS_AGENT_H_
+
+#include "webkit/glue/devtools/devtools_rpc.h"
+
+// Tools agent provides API for enabling / disabling other agents as well as
+// API for auxiliary UI functions such as dom elements highlighting.
+#define TOOLS_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
+ /* Enables / disables Dom agent. */ \
+ METHOD1(SetDomAgentEnabled, bool /* enabled */) \
+ \
+ /* Enables / disables Net agent */ \
+ METHOD1(SetNetAgentEnabled, bool /* enabled */) \
+ \
+ /* Highlights Dom node with given ID */ \
+ METHOD1(HighlightDOMNode, int /* node_id */) \
+ \
+ /* Clears Dom Node highlight. */ \
+ METHOD0(HideDOMNodeHighlight)
+
+DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT)
+
+#define TOOLS_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
+ METHOD1(UpdateFocusedNode, int /* node_id */) \
+
+DEFINE_RPC_CLASS(ToolsAgentDelegate, TOOLS_AGENT_DELEGATE_STRUCT)
+
+#endif // WEBKIT_GLUE_DEVTOOLS_TOOLS_AGENT_H_
diff --git a/webkit/glue/glue.vcproj b/webkit/glue/glue.vcproj
index f88923e..332bb54 100644
--- a/webkit/glue/glue.vcproj
+++ b/webkit/glue/glue.vcproj
@@ -1,843 +1,915 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="Glue"
- ProjectGUID="{C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}"
- RootNamespace="glue"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(SolutionDir)..\build\debug.vsprops;.\glue.vsprops;..\build\WebKit\using_WebKit.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(SolutionDir)..\build\release.vsprops;.\glue.vsprops;..\build\WebKit\using_WebKit.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="API"
- >
- <File
- RelativePath=".\autofill_form.cc"
- >
- </File>
- <File
- RelativePath=".\autofill_form.h"
- >
- </File>
- <File
- RelativePath=".\cache_manager.h"
- >
- </File>
- <File
- RelativePath=".\console_message_level.h"
- >
- </File>
- <File
- RelativePath=".\context_menu.h"
- >
- </File>
- <File
- RelativePath=".\cpp_bound_class.h"
- >
- </File>
- <File
- RelativePath=".\cpp_variant.h"
- >
- </File>
- <File
- RelativePath=".\dom_operations.h"
- >
- </File>
- <File
- RelativePath=".\form_data.h"
- >
- </File>
- <File
- RelativePath=".\image_decoder.h"
- >
- </File>
- <File
- RelativePath=".\password_form.h"
- >
- </File>
- <File
- RelativePath=".\resource_type.h"
- >
- </File>
- <File
- RelativePath=".\screen_info.h"
- >
- </File>
- <File
- RelativePath=".\webdatasource.h"
- >
- </File>
- <File
- RelativePath=".\weberror.h"
- >
- </File>
- <File
- RelativePath=".\webframe.h"
- >
- </File>
- <File
- RelativePath=".\webhistoryitem.h"
- >
- </File>
- <File
- RelativePath=".\webinputevent.h"
- >
- </File>
- <File
- RelativePath=".\webinputevent_win.cc"
- >
- </File>
- <File
- RelativePath=".\webmediaplayer.h"
- >
- </File>
- <File
- RelativePath=".\webmediaplayer_delegate.h"
- >
- </File>
- <File
- RelativePath=".\webplugin.h"
- >
- </File>
- <File
- RelativePath=".\webplugin_delegate.h"
- >
- </File>
- <File
- RelativePath=".\webpreferences.h"
- >
- </File>
- <File
- RelativePath=".\webresponse.h"
- >
- </File>
- <File
- RelativePath=".\webtextinput.h"
- >
- </File>
- <File
- RelativePath=".\weburlrequest.h"
- >
- </File>
- <File
- RelativePath=".\webview.h"
- >
- </File>
- <File
- RelativePath=".\webview_delegate.h"
- >
- </File>
- <File
- RelativePath=".\webwidget.h"
- >
- </File>
- <File
- RelativePath=".\webwidget_delegate.h"
- >
- </File>
- <File
- RelativePath=".\webworker.h"
- >
- </File>
- <File
- RelativePath=".\webworkerclient.h"
- >
- </File>
- <File
- RelativePath=".\window_open_disposition.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Library"
- >
- <File
- RelativePath="..\pending\AccessibleBase.cpp"
- >
- </File>
- <File
- RelativePath="..\pending\AccessibleBase.h"
- >
- </File>
- <File
- RelativePath="..\pending\AccessibleDocument.cpp"
- >
- </File>
- <File
- RelativePath="..\pending\AccessibleDocument.h"
- >
- </File>
- <File
- RelativePath=".\alt_404_page_resource_fetcher.cc"
- >
- </File>
- <File
- RelativePath=".\alt_404_page_resource_fetcher.h"
- >
- </File>
- <File
- RelativePath=".\alt_error_page_resource_fetcher.cc"
- >
- </File>
- <File
- RelativePath=".\alt_error_page_resource_fetcher.h"
- >
- </File>
- <File
- RelativePath=".\back_forward_list_client_impl.cc"
- >
- </File>
- <File
- RelativePath=".\back_forward_list_client_impl.h"
- >
- </File>
- <File
- RelativePath=".\cache_manager.cc"
- >
- </File>
- <File
- RelativePath=".\chrome_client_impl.cc"
- >
- </File>
- <File
- RelativePath=".\chrome_client_impl.h"
- >
- </File>
- <File
- RelativePath=".\chromium_bridge_impl.cc"
- >
- </File>
- <File
- RelativePath=".\clipboard_conversion.cc"
- >
- </File>
- <File
- RelativePath=".\clipboard_conversion.h"
- >
- </File>
- <File
- RelativePath=".\context_menu_client_impl.cc"
- >
- </File>
- <File
- RelativePath=".\context_menu_client_impl.h"
- >
- </File>
- <File
- RelativePath=".\cpp_binding_example.cc"
- >
- </File>
- <File
- RelativePath=".\cpp_bound_class.cc"
- >
- </File>
- <File
- RelativePath=".\cpp_variant.cc"
- >
- </File>
- <File
- RelativePath=".\debugger_bridge.cc"
- >
- </File>
- <File
- RelativePath=".\debugger_bridge.h"
- >
- </File>
- <File
- RelativePath=".\dom_operations.cc"
- >
- </File>
- <File
- RelativePath=".\dom_operations_private.h"
- >
- </File>
- <File
- RelativePath=".\dom_serializer.cc"
- >
- </File>
- <File
- RelativePath=".\dom_serializer.h"
- >
- </File>
- <File
- RelativePath=".\dom_serializer_delegate.h"
- >
- </File>
- <File
- RelativePath=".\dragclient_impl.cc"
- >
- </File>
- <File
- RelativePath=".\dragclient_impl.h"
- >
- </File>
- <File
- RelativePath=".\editor_client_impl.cc"
- >
- </File>
- <File
- RelativePath=".\editor_client_impl.h"
- >
- </File>
- <File
- RelativePath=".\entity_map.cc"
- >
- </File>
- <File
- RelativePath=".\entity_map.h"
- >
- </File>
- <File
- RelativePath=".\event_conversion.cc"
- >
- </File>
- <File
- RelativePath=".\event_conversion.h"
- >
- </File>
- <File
- RelativePath=".\feed_preview.cc"
- >
- </File>
- <File
- RelativePath=".\feed_preview.h"
- >
- </File>
- <File
- RelativePath=".\glue_accessibility.cc"
- >
- </File>
- <File
- RelativePath=".\glue_accessibility.h"
- >
- </File>
- <File
- RelativePath=".\glue_serialize.cc"
- >
- </File>
- <File
- RelativePath=".\glue_serialize.h"
- >
- </File>
- <File
- RelativePath=".\glue_util.cc"
- >
- </File>
- <File
- RelativePath=".\glue_util.h"
- >
- </File>
- <File
- RelativePath=".\image_decoder.cc"
- >
- </File>
- <File
- RelativePath=".\image_resource_fetcher.cc"
- >
- </File>
- <File
- RelativePath=".\image_resource_fetcher.h"
- >
- </File>
- <File
- RelativePath=".\inspector_client_impl.cc"
- >
- </File>
- <File
- RelativePath=".\inspector_client_impl.h"
- >
- </File>
- <File
- RelativePath=".\localized_strings.cc"
- >
- </File>
- <File
- RelativePath=".\media_player_private_impl.cc"
- >
- </File>
- <File
- RelativePath=".\multipart_response_delegate.cc"
- >
- </File>
- <File
- RelativePath=".\multipart_response_delegate.h"
- >
- </File>
- <File
- RelativePath=".\npruntime_util.cc"
- >
- </File>
- <File
- RelativePath=".\npruntime_util.h"
- >
- </File>
- <File
- RelativePath=".\password_autocomplete_listener.cc"
- >
- </File>
- <File
- RelativePath=".\password_autocomplete_listener.h"
- >
- </File>
- <File
- RelativePath=".\password_form_dom_manager.cc"
- >
- </File>
- <File
- RelativePath=".\password_form_dom_manager.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- <File
- RelativePath=".\resource_fetcher.cc"
- >
- </File>
- <File
- RelativePath=".\resource_fetcher.h"
- >
- </File>
- <File
- RelativePath=".\resource_handle_impl.cc"
- >
- </File>
- <File
- RelativePath=".\resource_loader_bridge.cc"
- >
- </File>
- <File
- RelativePath=".\resource_loader_bridge.h"
- >
- </File>
- <File
- RelativePath=".\scoped_clipboard_writer_glue.h"
- >
- </File>
- <File
- RelativePath=".\searchable_form_data.cc"
- >
- </File>
- <File
- RelativePath=".\searchable_form_data.h"
- >
- </File>
- <File
- RelativePath=".\simple_webmimeregistry_impl.cc"
- >
- </File>
- <File
- RelativePath=".\simple_webmimeregistry_impl.h"
- >
- </File>
- <File
- RelativePath=".\stacking_order_iterator.cc"
- >
- </File>
- <File
- RelativePath=".\stacking_order_iterator.h"
- >
- </File>
- <File
- RelativePath=".\webclipboard_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webclipboard_impl.h"
- >
- </File>
- <File
- RelativePath=".\webcursor.cc"
- >
- </File>
- <File
- RelativePath=".\webcursor.h"
- >
- </File>
- <File
- RelativePath=".\webcursor_win.cc"
- >
- </File>
- <File
- RelativePath=".\webdatasource_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webdatasource_impl.h"
- >
- </File>
- <File
- RelativePath=".\webdocumentloader_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webdocumentloader_impl.h"
- >
- </File>
- <File
- RelativePath=".\webdropdata.cc"
- >
- </File>
- <File
- RelativePath=".\webdropdata.h"
- >
- </File>
- <File
- RelativePath=".\weberror_impl.cc"
- >
- </File>
- <File
- RelativePath=".\weberror_impl.h"
- >
- </File>
- <File
- RelativePath=".\webframe_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webframe_impl.h"
- >
- </File>
- <File
- RelativePath=".\webframeloaderclient_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webframeloaderclient_impl.h"
- >
- </File>
- <File
- RelativePath=".\webhistoryitem_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webhistoryitem_impl.h"
- >
- </File>
- <File
- RelativePath=".\webinputevent_util.cc"
- >
- </File>
- <File
- RelativePath=".\webinputevent_util.h"
- >
- </File>
- <File
- RelativePath=".\webkit_glue.cc"
- >
- </File>
- <File
- RelativePath=".\webkit_glue.h"
- >
- </File>
- <File
- RelativePath=".\webkit_glue_win.cc"
- >
- </File>
- <File
- RelativePath=".\webkitclient_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webkitclient_impl.h"
- >
- </File>
- <File
- RelativePath=".\webmediaplayer_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webmediaplayer_impl.h"
- >
- </File>
- <File
- RelativePath=".\webplugin_delegate.cc"
- >
- </File>
- <File
- RelativePath=".\webplugin_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webplugin_impl.h"
- >
- </File>
- <File
- RelativePath=".\webresponse_impl.h"
- >
- </File>
- <File
- RelativePath=".\webtextinput_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webtextinput_impl.h"
- >
- </File>
- <File
- RelativePath=".\webthemeengine_impl_win.cc"
- >
- </File>
- <File
- RelativePath=".\webthemeengine_impl_win.h"
- >
- </File>
- <File
- RelativePath=".\weburlrequest_impl.cc"
- >
- </File>
- <File
- RelativePath=".\weburlrequest_impl.h"
- >
- </File>
- <File
- RelativePath=".\webview_delegate.cc"
- >
- </File>
- <File
- RelativePath=".\webview_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webview_impl.h"
- >
- </File>
- <File
- RelativePath=".\webwidget_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webwidget_impl.h"
- >
- </File>
- <File
- RelativePath=".\webworker_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webworker_impl.h"
- >
- </File>
- <File
- RelativePath=".\webworkerclient_impl.cc"
- >
- </File>
- <File
- RelativePath=".\webworkerclient_impl.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Plugins"
- >
- <File
- RelativePath=".\plugins\mozilla_extensions.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\mozilla_extensions.h"
- >
- </File>
- <File
- RelativePath=".\plugins\nphostapi.h"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_constants_win.h"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_host.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_host.h"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_instance.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_instance.h"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_lib.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_lib.h"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_lib_win.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_list.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_list.h"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_list_win.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_stream.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_stream.h"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_stream_url.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_stream_url.h"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_stream_win.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_string_stream.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\plugin_string_stream.h"
- >
- </File>
- <File
- RelativePath=".\plugins\webplugin_delegate_impl.cc"
- >
- </File>
- <File
- RelativePath=".\plugins\webplugin_delegate_impl.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="Glue"
+ ProjectGUID="{C66B126D-0ECE-4CA2-B6DC-FA780AFBBF09}"
+ RootNamespace="glue"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(SolutionDir)..\build\debug.vsprops;.\glue.vsprops;..\build\WebKit\using_WebKit.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(SolutionDir)..\build\release.vsprops;.\glue.vsprops;..\build\WebKit\using_WebKit.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="API"
+ >
+ <File
+ RelativePath=".\autofill_form.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\autofill_form.h"
+ >
+ </File>
+ <File
+ RelativePath=".\cache_manager.h"
+ >
+ </File>
+ <File
+ RelativePath=".\console_message_level.h"
+ >
+ </File>
+ <File
+ RelativePath=".\context_menu.h"
+ >
+ </File>
+ <File
+ RelativePath=".\cpp_bound_class.h"
+ >
+ </File>
+ <File
+ RelativePath=".\cpp_variant.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dom_operations.h"
+ >
+ </File>
+ <File
+ RelativePath=".\form_data.h"
+ >
+ </File>
+ <File
+ RelativePath=".\image_decoder.h"
+ >
+ </File>
+ <File
+ RelativePath=".\password_form.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource_type.h"
+ >
+ </File>
+ <File
+ RelativePath=".\screen_info.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdatasource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\weberror.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webframe.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webhistoryitem.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webinputevent.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webinputevent_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webmediaplayer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webmediaplayer_delegate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webplugin.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webplugin_delegate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webpreferences.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webresponse.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webtextinput.h"
+ >
+ </File>
+ <File
+ RelativePath=".\weburlrequest.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webview.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webview_delegate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webwidget.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webwidget_delegate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webworker.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webworkerclient.h"
+ >
+ </File>
+ <File
+ RelativePath=".\window_open_disposition.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Library"
+ >
+ <File
+ RelativePath="..\pending\AccessibleBase.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\pending\AccessibleBase.h"
+ >
+ </File>
+ <File
+ RelativePath="..\pending\AccessibleDocument.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\pending\AccessibleDocument.h"
+ >
+ </File>
+ <File
+ RelativePath=".\alt_404_page_resource_fetcher.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\alt_404_page_resource_fetcher.h"
+ >
+ </File>
+ <File
+ RelativePath=".\alt_error_page_resource_fetcher.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\alt_error_page_resource_fetcher.h"
+ >
+ </File>
+ <File
+ RelativePath=".\back_forward_list_client_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\back_forward_list_client_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\cache_manager.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\chrome_client_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\chrome_client_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\chromium_bridge_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\clipboard_conversion.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\clipboard_conversion.h"
+ >
+ </File>
+ <File
+ RelativePath=".\context_menu_client_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\context_menu_client_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\cpp_binding_example.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\cpp_bound_class.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\cpp_variant.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\debugger_bridge.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\debugger_bridge.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dom_operations.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\dom_operations_private.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dom_serializer.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\dom_serializer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dom_serializer_delegate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dragclient_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\dragclient_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\editor_client_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\editor_client_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\entity_map.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\entity_map.h"
+ >
+ </File>
+ <File
+ RelativePath=".\event_conversion.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\event_conversion.h"
+ >
+ </File>
+ <File
+ RelativePath=".\feed_preview.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\feed_preview.h"
+ >
+ </File>
+ <File
+ RelativePath=".\glue_accessibility.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\glue_accessibility.h"
+ >
+ </File>
+ <File
+ RelativePath=".\glue_serialize.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\glue_serialize.h"
+ >
+ </File>
+ <File
+ RelativePath=".\glue_util.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\glue_util.h"
+ >
+ </File>
+ <File
+ RelativePath=".\image_decoder.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\image_resource_fetcher.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\image_resource_fetcher.h"
+ >
+ </File>
+ <File
+ RelativePath=".\inspector_client_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\inspector_client_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\localized_strings.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\media_player_private_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\multipart_response_delegate.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\multipart_response_delegate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\npruntime_util.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\npruntime_util.h"
+ >
+ </File>
+ <File
+ RelativePath=".\password_autocomplete_listener.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\password_autocomplete_listener.h"
+ >
+ </File>
+ <File
+ RelativePath=".\password_form_dom_manager.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\password_form_dom_manager.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource_fetcher.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\resource_fetcher.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource_handle_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\resource_loader_bridge.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\resource_loader_bridge.h"
+ >
+ </File>
+ <File
+ RelativePath=".\scoped_clipboard_writer_glue.h"
+ >
+ </File>
+ <File
+ RelativePath=".\searchable_form_data.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\searchable_form_data.h"
+ >
+ </File>
+ <File
+ RelativePath=".\simple_webmimeregistry_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\simple_webmimeregistry_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\stacking_order_iterator.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\stacking_order_iterator.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webclipboard_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webclipboard_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webcursor.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webcursor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webcursor_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webdatasource_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webdatasource_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdevtoolsagent.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdevtoolsagent_delegate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdevtoolsagent_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webdevtoolsagent_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdevtoolsclient.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdevtoolsclient_delegate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdevtoolsclient_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webdevtoolsclient_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdocumentloader_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webdocumentloader_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webdropdata.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webdropdata.h"
+ >
+ </File>
+ <File
+ RelativePath=".\weberror_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\weberror_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webframe_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webframe_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webframeloaderclient_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webframeloaderclient_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webhistoryitem_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webhistoryitem_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webinputevent_util.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webinputevent_util.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webkit_glue.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webkit_glue.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webkit_glue_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webkitclient_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webkitclient_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webmediaplayer_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webmediaplayer_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webplugin_delegate.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webplugin_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webplugin_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webresponse_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webtextinput_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webtextinput_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webthemeengine_impl_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webthemeengine_impl_win.h"
+ >
+ </File>
+ <File
+ RelativePath=".\weburlrequest_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\weburlrequest_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webview_delegate.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webview_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webview_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webwidget_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webwidget_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webworker_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webworker_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\webworkerclient_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\webworkerclient_impl.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Plugins"
+ >
+ <File
+ RelativePath=".\plugins\mozilla_extensions.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\mozilla_extensions.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\nphostapi.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_constants_win.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_host.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_host.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_instance.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_instance.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_lib.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_lib.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_lib_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_list.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_list.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_list_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_stream.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_stream.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_stream_url.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_stream_url.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_stream_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_string_stream.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\plugin_string_stream.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\webplugin_delegate_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\plugins\webplugin_delegate_impl.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="DevTools"
+ >
+ <File
+ RelativePath=".\devtools\devtools_rpc.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\devtools\devtools_rpc.h"
+ >
+ </File>
+ <File
+ RelativePath=".\devtools\dom_agent.h"
+ >
+ </File>
+ <File
+ RelativePath=".\devtools\dom_agent_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\devtools\dom_agent_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\devtools\net_agent.h"
+ >
+ </File>
+ <File
+ RelativePath=".\devtools\net_agent_impl.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\devtools\net_agent_impl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\devtools\tools_agent.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/webkit/glue/webdevtoolsagent.h b/webkit/glue/webdevtoolsagent.h
new file mode 100644
index 0000000..c6b7650
--- /dev/null
+++ b/webkit/glue/webdevtoolsagent.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_H_
+#define WEBKIT_GLUE_WEBDEVTOOLSAGENT_H_
+
+#include <string>
+#include "base/basictypes.h"
+
+// WebDevToolsAgent represents DevTools agent sitting in the Glue. It provides
+// direct and delegate Apis to the host.
+class WebDevToolsAgent {
+ public:
+ WebDevToolsAgent() {}
+ virtual ~WebDevToolsAgent() {}
+
+ virtual void DispatchMessageFromClient(const std::string& raw_msg) = 0;
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgent);
+};
+
+#endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_H_
diff --git a/webkit/glue/webdevtoolsagent_delegate.h b/webkit/glue/webdevtoolsagent_delegate.h
new file mode 100644
index 0000000..d1305a3
--- /dev/null
+++ b/webkit/glue/webdevtoolsagent_delegate.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_DELEGATE_H_
+#define WEBKIT_GLUE_WEBDEVTOOLSAGENT_DELEGATE_H_
+
+#include <string>
+#include "base/basictypes.h"
+
+class WebDevToolsAgentDelegate {
+ public:
+ WebDevToolsAgentDelegate() {}
+ virtual ~WebDevToolsAgentDelegate() {}
+
+ virtual void SendMessageToClient(const std::string& raw_msg) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentDelegate);
+};
+
+#endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_DELEGATE_H_
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
new file mode 100644
index 0000000..ecf199c
--- /dev/null
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -0,0 +1,113 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "webkit/glue/webdevtoolsagent_impl.h"
+
+#include <string>
+
+#include "Document.h"
+#include "InspectorController.h"
+#include "Node.h"
+#include "Page.h"
+#include "PlatformString.h"
+#undef LOG
+
+#include "base/values.h"
+#include "webkit/glue/devtools/dom_agent_impl.h"
+#include "webkit/glue/devtools/net_agent_impl.h"
+#include "webkit/glue/glue_util.h"
+#include "webkit/glue/webdevtoolsagent_delegate.h"
+#include "webkit/glue/webview_impl.h"
+
+using WebCore::Document;
+using WebCore::InspectorController;
+using WebCore::Node;
+using WebCore::Page;
+using WebCore::String;
+
+WebDevToolsAgentImpl::WebDevToolsAgentImpl(
+ WebViewImpl* web_view_impl,
+ WebDevToolsAgentDelegate* delegate)
+ : delegate_(delegate),
+ web_view_impl_(web_view_impl),
+ document_(NULL) {
+ dom_agent_delegate_stub_.reset(new DomAgentDelegateStub(this));
+ net_agent_delegate_stub_.reset(new NetAgentDelegateStub(this));
+ tools_agent_delegate_stub_.reset(new ToolsAgentDelegateStub(this));
+}
+
+WebDevToolsAgentImpl::~WebDevToolsAgentImpl() {
+}
+
+void WebDevToolsAgentImpl::SetDomAgentEnabled(bool enabled) {
+ if (enabled && !dom_agent_impl_.get()) {
+ dom_agent_impl_.reset(new DomAgentImpl(dom_agent_delegate_stub_.get()));
+ if (document_)
+ dom_agent_impl_->SetDocument(document_);
+ } else if (!enabled && dom_agent_impl_.get()) {
+ dom_agent_impl_.reset(NULL);
+ }
+}
+
+void WebDevToolsAgentImpl::SetNetAgentEnabled(bool enabled) {
+ if (enabled && !net_agent_impl_.get()) {
+ net_agent_impl_.reset(new NetAgentImpl(net_agent_delegate_stub_.get()));
+ if (document_)
+ net_agent_impl_->SetDocument(document_);
+ } else if (!enabled && net_agent_impl_.get()) {
+ net_agent_impl_.reset(NULL);
+ }
+}
+
+void WebDevToolsAgentImpl::SetMainFrameDocumentReady(bool ready) {
+ if (ready) {
+ Page* page = web_view_impl_->page();
+ document_ = page->mainFrame()->document();
+ } else {
+ document_ = NULL;
+ }
+ if (dom_agent_impl_.get())
+ dom_agent_impl_->SetDocument(document_);
+ if (net_agent_impl_.get())
+ net_agent_impl_->SetDocument(document_);
+}
+
+void WebDevToolsAgentImpl::HighlightDOMNode(int node_id) {
+ if (!dom_agent_impl_.get())
+ return;
+ Node* node = dom_agent_impl_->GetNodeForId(node_id);
+ if (!node)
+ return;
+ Page* page = web_view_impl_->page();
+ page->inspectorController()->highlight(node);
+}
+
+void WebDevToolsAgentImpl::HideDOMNodeHighlight() {
+ Page* page = web_view_impl_->page();
+ page->inspectorController()->hideHighlight();
+}
+
+void WebDevToolsAgentImpl::Inspect(Node* node) {
+ if (!dom_agent_impl_.get())
+ return;
+
+ int node_id = dom_agent_impl_->GetPathToNode(node);
+ tools_agent_delegate_stub_->UpdateFocusedNode(node_id);
+}
+
+void WebDevToolsAgentImpl::DispatchMessageFromClient(
+ const std::string& raw_msg) {
+ if (dom_agent_impl_.get() &&
+ dom_agent_dispatch_.Dispatch(dom_agent_impl_.get(), raw_msg))
+ return;
+ if (net_agent_impl_.get() &&
+ net_agent_dispatch_.Dispatch(net_agent_impl_.get(), raw_msg))
+ return;
+ tools_agent_dispatch_.Dispatch(this, raw_msg);
+}
+
+void WebDevToolsAgentImpl::SendRpcMessage(const std::string& raw_msg) {
+ delegate_->SendMessageToClient(raw_msg);
+}
diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h
new file mode 100644
index 0000000..a3f2620
--- /dev/null
+++ b/webkit/glue/webdevtoolsagent_impl.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_
+#define WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_
+
+#include <string>
+
+#include "base/scoped_ptr.h"
+#include "webkit/glue/devtools/devtools_rpc.h"
+#include "webkit/glue/devtools/dom_agent.h"
+#include "webkit/glue/devtools/net_agent.h"
+#include "webkit/glue/devtools/tools_agent.h"
+#include "webkit/glue/webdevtoolsagent.h"
+
+namespace WebCore {
+class Document;
+class Node;
+}
+
+class DomAgentImpl;
+class NetAgentImpl;
+class Value;
+class WebDevToolsAgentDelegate;
+class WebViewImpl;
+
+class WebDevToolsAgentImpl
+ : public WebDevToolsAgent,
+ public ToolsAgent,
+ public DevToolsRpc::Delegate {
+ public:
+ WebDevToolsAgentImpl(WebViewImpl* web_view_impl,
+ WebDevToolsAgentDelegate* delegate);
+ virtual ~WebDevToolsAgentImpl();
+
+ // ToolsAgent implementation.
+ virtual void SetDomAgentEnabled(bool enabled);
+ virtual void SetNetAgentEnabled(bool enabled);
+ virtual void HighlightDOMNode(int node_id);
+ virtual void HideDOMNodeHighlight();
+
+ // WebDevToolsAgent implementation.
+ virtual void DispatchMessageFromClient(const std::string& raw_msg);
+
+ // DevToolsRpc::Delegate implementation.
+ void SendRpcMessage(const std::string& raw_msg);
+
+ // Methods called by the glue.
+ void SetMainFrameDocumentReady(bool ready);
+ void Inspect(WebCore::Node* node);
+
+ DomAgentImpl* dom_agent_impl() { return dom_agent_impl_.get(); }
+ NetAgentImpl* net_agent_impl() { return net_agent_impl_.get(); }
+ WebViewImpl* web_view_impl() { return web_view_impl_; }
+
+ private:
+ WebDevToolsAgentDelegate* delegate_;
+ WebViewImpl* web_view_impl_;
+ WebCore::Document* document_;
+ scoped_ptr<DomAgentImpl> dom_agent_impl_;
+ scoped_ptr<NetAgentImpl> net_agent_impl_;
+ scoped_ptr<DomAgentDelegateStub> dom_agent_delegate_stub_;
+ scoped_ptr<NetAgentDelegateStub> net_agent_delegate_stub_;
+ scoped_ptr<ToolsAgentDelegateStub> tools_agent_delegate_stub_;
+ DomAgentDispatch dom_agent_dispatch_;
+ NetAgentDispatch net_agent_dispatch_;
+ ToolsAgentDispatch tools_agent_dispatch_;
+ DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl);
+};
+
+#endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_
diff --git a/webkit/glue/webdevtoolsclient.h b/webkit/glue/webdevtoolsclient.h
new file mode 100644
index 0000000..23529c6
--- /dev/null
+++ b/webkit/glue/webdevtoolsclient.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_WEBDEVTOOLSCLIENT_H_
+#define WEBKIT_GLUE_WEBDEVTOOLSCLIENT_H_
+
+#include <string>
+#include "base/basictypes.h"
+
+class WebDevToolsClientDelegate;
+class WebView;
+
+// WebDevToolsClient represents DevTools client sitting in the Glue. It provides
+// direct and delegate Apis to the host.
+class WebDevToolsClient {
+ public:
+ static WebDevToolsClient* Create(
+ WebView* view,
+ WebDevToolsClientDelegate* delegate);
+
+ WebDevToolsClient() {}
+ virtual ~WebDevToolsClient() {}
+
+ virtual void DispatchMessageFromAgent(const std::string& raw_msg) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WebDevToolsClient);
+};
+
+#endif // WEBKIT_GLUE_WEBDEVTOOLSCLIENT_H_
diff --git a/webkit/glue/webdevtoolsclient_delegate.h b/webkit/glue/webdevtoolsclient_delegate.h
new file mode 100644
index 0000000..fc1b1d6
--- /dev/null
+++ b/webkit/glue/webdevtoolsclient_delegate.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_WEBDEVTOOLSCLIENT_DELEGATE_H_
+#define WEBKIT_GLUE_WEBDEVTOOLSCLIENT_DELEGATE_H_
+
+#include <string>
+#include "base/basictypes.h"
+
+class WebDevToolsClientDelegate {
+ public:
+ WebDevToolsClientDelegate() {}
+ virtual ~WebDevToolsClientDelegate() {}
+
+ virtual void SendMessageToAgent(const std::string& raw_msg) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WebDevToolsClientDelegate);
+};
+
+#endif // WEBKIT_GLUE_WEBDEVTOOLSAGENT_DELEGATE_H_
diff --git a/webkit/glue/webdevtoolsclient_impl.cc b/webkit/glue/webdevtoolsclient_impl.cc
new file mode 100644
index 0000000..07f0055
--- /dev/null
+++ b/webkit/glue/webdevtoolsclient_impl.cc
@@ -0,0 +1,225 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "webkit/glue/webdevtoolsclient_impl.h"
+
+#include <string>
+
+#include "CString.h"
+#include "Document.h"
+#include "InspectorController.h"
+#include "Node.h"
+#include "Page.h"
+#include "PlatformString.h"
+
+#include "base/json_reader.h"
+#include "base/json_writer.h"
+#include "base/string_util.h"
+#include "base/values.h"
+
+#include "webkit/glue/glue_util.h"
+#include "webkit/glue/webdevtoolsclient_delegate.h"
+#include "webkit/glue/webframe.h"
+#include "webkit/glue/webview_impl.h"
+
+using WebCore::CString;
+using WebCore::Document;
+using WebCore::InspectorController;
+using WebCore::Node;
+using WebCore::Page;
+using WebCore::String;
+
+/*static*/
+WebDevToolsClient* WebDevToolsClient::Create(
+ WebView* view,
+ WebDevToolsClientDelegate* delegate) {
+ return new WebDevToolsClientImpl(static_cast<WebViewImpl*>(view), delegate);
+}
+
+WebDevToolsClientImpl::WebDevToolsClientImpl(
+ WebViewImpl* web_view_impl,
+ WebDevToolsClientDelegate* delegate)
+ : web_view_impl_(web_view_impl),
+ delegate_(delegate) {
+ dom_agent_stub_.reset(new DomAgentStub(this));
+ net_agent_stub_.reset(new NetAgentStub(this));
+ tools_agent_stub_.reset(new ToolsAgentStub(this));
+
+ BindToJavascript(web_view_impl_->GetMainFrame(), L"DevToolsHost");
+ BindMethod("getDocumentElement",
+ &WebDevToolsClientImpl::JsGetDocumentElement);
+ BindMethod("getChildNodes", &WebDevToolsClientImpl::JsGetChildNodes);
+ BindMethod("setAttribute", &WebDevToolsClientImpl::JsSetAttribute);
+ BindMethod("removeAttribute", &WebDevToolsClientImpl::JsRemoveAttribute);
+ BindMethod("setTextNodeValue", &WebDevToolsClientImpl::JsSetTextNodeValue);
+ BindMethod("highlightDOMNode", &WebDevToolsClientImpl::JsHighlightDOMNode);
+ BindMethod("hideDOMNodeHighlight",
+ &WebDevToolsClientImpl::JsHideDOMNodeHighlight);
+}
+
+WebDevToolsClientImpl::~WebDevToolsClientImpl() {
+}
+
+// DomAgent::DomAgentDelegate implementation.
+void WebDevToolsClientImpl::DocumentElementUpdated(const Value& value) {
+ MakeJsCall("dom.setDocumentElement", &value);
+}
+
+void WebDevToolsClientImpl::AttributesUpdated(int id, const Value& attributes) {
+ MakeJsCall("dom.setAttributes", id, &attributes);
+}
+
+void WebDevToolsClientImpl::ChildNodesUpdated(int id, const Value& children) {
+ MakeJsCall("dom.setChildren", id, &children);
+}
+
+void WebDevToolsClientImpl::ChildNodeInserted(
+ int parent_id,
+ int prev_id,
+ const Value& value) {
+ MakeJsCall("dom.nodeInserted", parent_id, prev_id, &value);
+}
+
+void WebDevToolsClientImpl::ChildNodeRemoved(int parent_id, int id) {
+ MakeJsCall("dom.nodeRemoved", parent_id, id);
+}
+
+void WebDevToolsClientImpl::HasChildrenUpdated(int id, bool new_value) {
+ MakeJsCall("dom.setHasChildren", id, true);
+}
+
+// NetAgent::NetAgentDelegate implementation.
+void WebDevToolsClientImpl::WillSendRequest(
+ int identifier,
+ const Value& request) {
+ MakeJsCall("net.willSendRequest", identifier, &request);
+}
+
+void WebDevToolsClientImpl::DidReceiveResponse(
+ int identifier,
+ const Value& response) {
+ MakeJsCall("net.didReceiveResponse", identifier, &response);
+}
+
+void WebDevToolsClientImpl::DidFinishLoading(int identifier,
+ const Value& response) {
+ MakeJsCall("net.didFinishLoading", identifier, &response);
+}
+
+void WebDevToolsClientImpl::DidFailLoading(int identifier,
+ const Value& response) {
+ MakeJsCall("net.didFailLoading", identifier, &response);
+}
+
+void WebDevToolsClientImpl::SetResourceContent(
+ int identifier,
+ const String& content) {
+ MakeJsCall("net.setResourceContent", identifier, content);
+}
+
+void WebDevToolsClientImpl::UpdateFocusedNode(int node_id) {
+ MakeJsCall("tools.updateFocusedNode", node_id);
+}
+
+void WebDevToolsClientImpl::JsGetResourceSource(
+ const CppArgumentList& args,
+ CppVariant* result) {
+ net_agent_stub_->GetResourceContent(args[0].ToInt32(),
+ webkit_glue::StdStringToString(args[1].ToString()));
+}
+
+void WebDevToolsClientImpl::JsGetDocumentElement(
+ const CppArgumentList& args,
+ CppVariant* result) {
+ tools_agent_stub_->SetDomAgentEnabled(true);
+ tools_agent_stub_->SetNetAgentEnabled(true);
+ dom_agent_stub_->GetDocumentElement();
+ result->SetNull();
+}
+
+void WebDevToolsClientImpl::JsGetChildNodes(
+ const CppArgumentList& args,
+ CppVariant* result) {
+ dom_agent_stub_->GetChildNodes(args[0].ToInt32());
+ result->SetNull();
+}
+
+void WebDevToolsClientImpl::JsSetAttribute(
+ const CppArgumentList& args,
+ CppVariant* result) {
+ dom_agent_stub_->SetAttribute(args[0].ToInt32(),
+ webkit_glue::StdStringToString(args[1].ToString()),
+ webkit_glue::StdStringToString(args[2].ToString()));
+ result->SetNull();
+}
+
+void WebDevToolsClientImpl::JsRemoveAttribute(
+ const CppArgumentList& args,
+ CppVariant* result) {
+ dom_agent_stub_->RemoveAttribute(args[0].ToInt32(),
+ webkit_glue::StdStringToString(args[1].ToString()));
+ result->SetNull();
+}
+
+void WebDevToolsClientImpl::JsSetTextNodeValue(
+ const CppArgumentList& args,
+ CppVariant* result) {
+ dom_agent_stub_->SetTextNodeValue(args[0].ToInt32(),
+ webkit_glue::StdStringToString(args[1].ToString()));
+ result->SetNull();
+}
+
+void WebDevToolsClientImpl::JsHighlightDOMNode(
+ const CppArgumentList& args,
+ CppVariant* result) {
+ tools_agent_stub_->HighlightDOMNode(args[0].ToInt32());
+ result->SetNull();
+}
+
+void WebDevToolsClientImpl::JsHideDOMNodeHighlight(const CppArgumentList& args,
+ CppVariant* result) {
+ tools_agent_stub_->HideDOMNodeHighlight();
+ result->SetNull();
+}
+
+void WebDevToolsClientImpl::EvaluateJs(const String& expr) {
+ web_view_impl_->GetMainFrame()->ExecuteJavaScript(
+ webkit_glue::StringToStdString(expr),
+ GURL(), // script url
+ 1); // base line number
+}
+
+void WebDevToolsClientImpl::DispatchMessageFromAgent(
+ const std::string& raw_msg) {
+ if (dom_agent_delegate_dispatch_.Dispatch(this, raw_msg))
+ return;
+ if (net_agent_delegate_dispatch_.Dispatch(this, raw_msg))
+ return;
+ if (tools_agent_delegate_dispatch_.Dispatch(this, raw_msg))
+ return;
+}
+
+void WebDevToolsClientImpl::SendRpcMessage(const std::string& raw_msg) {
+ delegate_->SendMessageToAgent(raw_msg);
+}
+
+// static
+CString WebDevToolsClientImpl::ToJSON(const String& value) {
+ StringValue str(webkit_glue::StringToStdString(value));
+ return ToJSON(&str);
+}
+
+// static
+CString WebDevToolsClientImpl::ToJSON(int value) {
+ FundamentalValue fund(value);
+ return ToJSON(&fund);
+}
+
+// static
+CString WebDevToolsClientImpl::ToJSON(const Value* value) {
+ std::string json;
+ JSONWriter::Write(value, false, &json);
+ return webkit_glue::StdStringToString(json).utf8();
+}
diff --git a/webkit/glue/webdevtoolsclient_impl.h b/webkit/glue/webdevtoolsclient_impl.h
new file mode 100644
index 0000000..fb1daea
--- /dev/null
+++ b/webkit/glue/webdevtoolsclient_impl.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_WEBDEVTOOLSCLIENT_IMPL_H_
+#define WEBKIT_GLUE_WEBDEVTOOLSCLIENT_IMPL_H_
+
+#include <string>
+
+#include "CString.h"
+#include "PlatformString.h"
+#undef LOG
+
+#include "webkit/glue/cpp_bound_class.h"
+#include "webkit/glue/devtools/devtools_rpc.h"
+#include "webkit/glue/devtools/dom_agent.h"
+#include "webkit/glue/devtools/net_agent.h"
+#include "webkit/glue/devtools/tools_agent.h"
+#include "webkit/glue/webdevtoolsclient.h"
+
+class DomAgentStub;
+class NetAgentStub;
+class ToolsAgentStub;
+class WebDevToolsClientDelegate;
+class WebViewImpl;
+
+class WebDevToolsClientImpl : public WebDevToolsClient,
+ public CppBoundClass,
+ public DevToolsRpc::Delegate,
+ public DomAgentDelegate,
+ public NetAgentDelegate,
+ public ToolsAgentDelegate {
+ public:
+ WebDevToolsClientImpl(
+ WebViewImpl* web_view_impl,
+ WebDevToolsClientDelegate* delegate);
+ virtual ~WebDevToolsClientImpl();
+
+ // DomAgentDelegate implementation.
+ virtual void DocumentElementUpdated(const Value& value);
+ virtual void AttributesUpdated(int id, const Value& attributes);
+ virtual void ChildNodesUpdated(int id, const Value& value);
+ virtual void ChildNodeInserted(
+ int parent_id,
+ int prev_id,
+ const Value& value);
+ virtual void ChildNodeRemoved(int parent_id, int id);
+ virtual void HasChildrenUpdated(int id, bool new_value);
+
+ // NetAgentDelegate implementation.
+ virtual void WillSendRequest(
+ int identifier,
+ const Value& request);
+ virtual void DidReceiveResponse(
+ int identifier,
+ const Value& response);
+ virtual void DidFinishLoading(int identifier, const Value& response);
+ virtual void DidFailLoading(int identifier, const Value& response);
+ virtual void SetResourceContent(
+ int identifier,
+ const WebCore::String& content);
+
+ // ToolsAgentDelegate implementation.
+ virtual void UpdateFocusedNode(int node_id);
+
+ // DevToolsRpc::Delegate implementation.
+ virtual void SendRpcMessage(const std::string& raw_msg);
+
+ // WebDevToolsClient implementation.
+ virtual void DispatchMessageFromAgent(const std::string& raw_msg);
+
+ private:
+ // MakeJsCall templates.
+ void MakeJsCall(const WebCore::String& func) {
+ EvaluateJs(WebCore::String::format("%s()", func.utf8().data()));
+ }
+ template<class T1>
+ void MakeJsCall(const WebCore::String& func, T1 t1) {
+ EvaluateJs(WebCore::String::format("%s(%s)", func.utf8().data(),
+ ToJSON(t1).data()));
+ }
+ template<class T1, class T2>
+ void MakeJsCall(const WebCore::String& func, T1 t1, T2 t2) {
+ EvaluateJs(WebCore::String::format("%s(%s, %s)", func.utf8().data(),
+ ToJSON(t1).data(), ToJSON(t2).data()));
+ }
+ template<class T1, class T2, class T3>
+ void MakeJsCall(const WebCore::String& func, T1 t1, T2 t2, T3 t3) {
+ EvaluateJs(WebCore::String::format("%s(%s, %s, %s)", func.utf8().data(),
+ ToJSON(t1).data(), ToJSON(t2).data(), ToJSON(t3).data()));
+ }
+ template<class T1, class T2, class T3, class T4>
+ void MakeJsCall(const WebCore::String& func, T1 t1, T2 t2, T3 t3, T4 t4) {
+ EvaluateJs(WebCore::String::format("%s(%s, %s, %s, %s)", func.utf8().data(),
+ ToJSON(t1).data(), ToJSON(t2).data(), ToJSON(t3).data(),
+ ToJSON(t4).data()));
+ }
+ template<class T1, class T2, class T3, class T4, class T5>
+ void MakeJsCall(const WebCore::String& func, T1 t1, T2 t2, T3 t3, T4 t4,
+ T5 t5) {
+ EvaluateJs(WebCore::String::format("%s(%s, %s, %s, %s, %s)",
+ func.utf8().data(), ToJSON(t1).data(), ToJSON(t2).data(),
+ ToJSON(t3).data(), ToJSON(t4).data(), ToJSON(t5).data()));
+ }
+
+ void EvaluateJs(const WebCore::String& expr);
+
+ void JsGetResourceSource(const CppArgumentList& args, CppVariant* result);
+
+ void JsGetDocumentElement(const CppArgumentList& args, CppVariant* result);
+
+ void JsGetChildNodes(const CppArgumentList& args, CppVariant* result);
+
+ void JsSetAttribute(const CppArgumentList& args, CppVariant* result);
+
+ void JsRemoveAttribute(const CppArgumentList& args, CppVariant* result);
+
+ void JsSetTextNodeValue(const CppArgumentList& args, CppVariant* result);
+
+ void JsHighlightDOMNode(const CppArgumentList& args, CppVariant* result);
+
+ void JsHideDOMNodeHighlight(const CppArgumentList& args, CppVariant* result);
+
+ private:
+ // Serializers
+ static WebCore::CString ToJSON(const WebCore::String& value);
+ static WebCore::CString ToJSON(int value);
+ static WebCore::CString ToJSON(const Value* value);
+
+ WebViewImpl* web_view_impl_;
+ WebDevToolsClientDelegate* delegate_;
+ scoped_ptr<DomAgentStub> dom_agent_stub_;
+ scoped_ptr<NetAgentStub> net_agent_stub_;
+ scoped_ptr<ToolsAgentStub> tools_agent_stub_;
+ DomAgentDelegateDispatch dom_agent_delegate_dispatch_;
+ NetAgentDelegateDispatch net_agent_delegate_dispatch_;
+ ToolsAgentDelegateDispatch tools_agent_delegate_dispatch_;
+ DISALLOW_COPY_AND_ASSIGN(WebDevToolsClientImpl);
+};
+
+#endif // WEBKIT_GLUE_WEBDEVTOOLSCLIENT_IMPL_H_
diff --git a/webkit/tools/test_shell/SConscript b/webkit/tools/test_shell/SConscript
index e5a28fb..c620de0 100644
--- a/webkit/tools/test_shell/SConscript
+++ b/webkit/tools/test_shell/SConscript
@@ -256,6 +256,7 @@ test_files = [
'$WEBKIT_DIR/glue/context_menu_unittest.cc',
'$WEBKIT_DIR/glue/cpp_bound_class_unittest.cc',
'$WEBKIT_DIR/glue/cpp_variant_unittest.cc',
+ '$WEBKIT_DIR/glue/devtools/dom_agent_unittest.cc',
'$WEBKIT_DIR/glue/dom_operations_unittest.cc',
'$WEBKIT_DIR/glue/dom_serializer_unittest.cc',
'$WEBKIT_DIR/glue/glue_serialize_unittest.cc',
diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp
index a9ac5aa..2950e4b 100644
--- a/webkit/tools/test_shell/test_shell.gyp
+++ b/webkit/tools/test_shell/test_shell.gyp
@@ -228,6 +228,8 @@
'../../glue/context_menu_unittest.cc',
'../../glue/cpp_bound_class_unittest.cc',
'../../glue/cpp_variant_unittest.cc',
+ '../../glue/devtools/dom_agent_unittest.cc',
+ '../../glue/devtools/devtools_mock_rpc.h',
'../../glue/dom_operations_unittest.cc',
'../../glue/dom_serializer_unittest.cc',
'../../glue/glue_serialize_unittest.cc',
diff --git a/webkit/tools/test_shell/test_shell_tests.vcproj b/webkit/tools/test_shell/test_shell_tests.vcproj
index 032e4da..524aee8 100644
--- a/webkit/tools/test_shell/test_shell_tests.vcproj
+++ b/webkit/tools/test_shell/test_shell_tests.vcproj
@@ -331,6 +331,14 @@
>
</File>
<File
+ RelativePath="..\..\glue\devtools\devtools_mock_rpc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\glue\devtools\dom_agent_unittest.cc"
+ >
+ </File>
+ <File
RelativePath="..\..\glue\dom_operations_unittest.cc"
>
</File>
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 4bf64c3..31c0cfd 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -4189,6 +4189,15 @@
# This list contains all .h, .cc, and .mm files in glue except for
# those in the test subdirectory and those with unittest in in their
# names.
+ 'glue/devtools/devtools_rpc.cc',
+ 'glue/devtools/devtools_rpc.h',
+ 'glue/devtools/dom_agent.h',
+ 'glue/devtools/dom_agent_impl.cc',
+ 'glue/devtools/dom_agent_impl.h',
+ 'glue/devtools/net_agent.h',
+ 'glue/devtools/net_agent_impl.cc',
+ 'glue/devtools/net_agent_impl.h',
+ 'glue/devtools/tools_agent.h',
'glue/plugins/mozilla_extensions.cc',
'glue/plugins/mozilla_extensions.h',
'glue/plugins/nphostapi.h',
@@ -4316,6 +4325,14 @@
'glue/webdatasource.h',
'glue/webdatasource_impl.cc',
'glue/webdatasource_impl.h',
+ 'glue/webdevtoolsagent.h',
+ 'glue/webdevtoolsagent_delegate.h',
+ 'glue/webdevtoolsagent_impl.cc',
+ 'glue/webdevtoolsagent_impl.h',
+ 'glue/webdevtoolsclient.h',
+ 'glue/webdevtoolsclient_delegate.h',
+ 'glue/webdevtoolsclient_impl.cc',
+ 'glue/webdevtoolsclient_impl.h',
'glue/webdocumentloader_impl.cc',
'glue/webdocumentloader_impl.h',
'glue/webdropdata.cc',