summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/devtools/js/devtools.js14
-rw-r--r--webkit/glue/devtools/js/devtools_host_stub.js4
-rw-r--r--webkit/glue/devtools/tools_agent.h3
-rw-r--r--webkit/glue/webdevtoolsagent.h5
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc46
-rw-r--r--webkit/glue/webdevtoolsagent_impl.h5
6 files changed, 33 insertions, 44 deletions
diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js
index 10a5ab9..39a81fc 100644
--- a/webkit/glue/devtools/js/devtools.js
+++ b/webkit/glue/devtools/js/devtools.js
@@ -30,7 +30,6 @@ devtools.ToolsAgent = function() {
* Rests tools agent to its initial state.
*/
devtools.ToolsAgent.prototype.reset = function() {
- this.setEnabled(true);
this.domAgent_.reset();
this.domAgent_.getDocumentElementAsync();
};
@@ -91,14 +90,6 @@ devtools.ToolsAgent.prototype.frameNavigate = function(url, topLevel) {
/**
- * @see tools_agent.h
- */
-devtools.ToolsAgent.prototype.setEnabled = function(enabled) {
- RemoteToolsAgent.SetEnabled(enabled);
-};
-
-
-/**
* Evaluates js expression.
* @param {string} expr
*/
@@ -123,9 +114,6 @@ function debugPrint(text) {
}
-// Frontend global objects.
-
-
/**
* Global instance of the tools agent.
* @type {devtools.ToolsAgent}
@@ -157,7 +145,7 @@ var webkitUpdateChildren =
WebInspector.ElementsTreeElement.prototype.updateChildren = function() {
var self = this;
- devtools.tools.getDomAgent().getChildNodesAsync(this.representedObject.id,
+ devtools.tools.getDomAgent().getChildNodesAsync(this.representedObject.id,
function() {
webkitUpdateChildren.call(self);
});
diff --git a/webkit/glue/devtools/js/devtools_host_stub.js b/webkit/glue/devtools/js/devtools_host_stub.js
index ddd7609..c820d67 100644
--- a/webkit/glue/devtools/js/devtools_host_stub.js
+++ b/webkit/glue/devtools/js/devtools_host_stub.js
@@ -133,10 +133,6 @@ RemoteToolsAgentStub.prototype.HighlightDOMNode = function() {
};
-RemoteToolsAgentStub.prototype.SetEnabled = function() {
-};
-
-
RemoteToolsAgentStub.prototype.evaluate = function(expr) {
window.eval(expr);
};
diff --git a/webkit/glue/devtools/tools_agent.h b/webkit/glue/devtools/tools_agent.h
index a2e1b18..0ca14d3 100644
--- a/webkit/glue/devtools/tools_agent.h
+++ b/webkit/glue/devtools/tools_agent.h
@@ -10,9 +10,6 @@
// 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 the agent */ \
- METHOD1(SetEnabled, bool /* enabled */) \
- \
/* Highlights Dom node with given ID */ \
METHOD1(HighlightDOMNode, int /* node_id */) \
\
diff --git a/webkit/glue/webdevtoolsagent.h b/webkit/glue/webdevtoolsagent.h
index 3f4f3937..e96cfc1 100644
--- a/webkit/glue/webdevtoolsagent.h
+++ b/webkit/glue/webdevtoolsagent.h
@@ -15,7 +15,12 @@ class WebDevToolsAgent {
WebDevToolsAgent() {}
virtual ~WebDevToolsAgent() {}
+ virtual void Attach() = 0;
+
+ virtual void Detach() = 0;
+
virtual void DispatchMessageFromClient(const std::string& raw_msg) = 0;
+
virtual void InspectElement(int x, int y) = 0;
// Asynchronously executes debugger command in the render thread.
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
index a096152..b5809aa 100644
--- a/webkit/glue/webdevtoolsagent_impl.cc
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -41,7 +41,7 @@ WebDevToolsAgentImpl::WebDevToolsAgentImpl(
: delegate_(delegate),
web_view_impl_(web_view_impl),
document_(NULL),
- enabled_(false) {
+ attached_(false) {
debugger_agent_delegate_stub_.reset(new DebuggerAgentDelegateStub(this));
dom_agent_delegate_stub_.reset(new DomAgentDelegateStub(this));
net_agent_delegate_stub_.reset(new NetAgentDelegateStub(this));
@@ -51,23 +51,26 @@ WebDevToolsAgentImpl::WebDevToolsAgentImpl(
WebDevToolsAgentImpl::~WebDevToolsAgentImpl() {
}
-void WebDevToolsAgentImpl::SetEnabled(bool enabled) {
- if (enabled && !enabled_) {
- debugger_agent_impl_.reset(new DebuggerAgentImpl(
- debugger_agent_delegate_stub_.get()));
- dom_agent_impl_.reset(new DomAgentImpl(dom_agent_delegate_stub_.get()));
- net_agent_impl_.reset(new NetAgentImpl(net_agent_delegate_stub_.get()));
- if (document_) {
- dom_agent_impl_->SetDocument(document_);
- net_agent_impl_->SetDocument(document_);
- }
- enabled_ = true;
- } else if (!enabled) {
- debugger_agent_impl_.reset(NULL);
- dom_agent_impl_.reset(NULL);
- net_agent_impl_.reset(NULL);
- enabled_ = false;
+void WebDevToolsAgentImpl::Attach() {
+ if (attached_) {
+ return;
+ }
+ debugger_agent_impl_.reset(
+ new DebuggerAgentImpl(debugger_agent_delegate_stub_.get()));
+ dom_agent_impl_.reset(new DomAgentImpl(dom_agent_delegate_stub_.get()));
+ net_agent_impl_.reset(new NetAgentImpl(net_agent_delegate_stub_.get()));
+ if (document_) {
+ dom_agent_impl_->SetDocument(document_);
+ net_agent_impl_->SetDocument(document_);
}
+ attached_ = true;
+}
+
+void WebDevToolsAgentImpl::Detach() {
+ dom_agent_impl_.reset(NULL);
+ net_agent_impl_.reset(NULL);
+ debugger_agent_impl_.reset(NULL);
+ attached_ = false;
}
void WebDevToolsAgentImpl::SetMainFrameDocumentReady(bool ready) {
@@ -77,7 +80,7 @@ void WebDevToolsAgentImpl::SetMainFrameDocumentReady(bool ready) {
} else {
document_ = NULL;
}
- if (enabled_) {
+ if (attached_) {
dom_agent_impl_->SetDocument(document_);
net_agent_impl_->SetDocument(document_);
}
@@ -87,7 +90,7 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame(
WebViewImpl* webview,
WebFrame* frame,
bool is_new_navigation) {
- if (!enabled_) {
+ if (!attached_) {
return;
}
dom_agent_impl_->DiscardBindings();
@@ -102,7 +105,7 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame(
}
void WebDevToolsAgentImpl::HighlightDOMNode(int node_id) {
- if (!enabled_)
+ if (!attached_)
return;
Node* node = dom_agent_impl_->GetNodeForId(node_id);
if (!node)
@@ -136,7 +139,7 @@ void WebDevToolsAgentImpl::DispatchMessageFromClient(
if (ToolsAgentDispatch::Dispatch(this, *message.get()))
return;
- if (!enabled_)
+ if (!attached_)
return;
if (debugger_agent_impl_.get() &&
@@ -156,7 +159,6 @@ void WebDevToolsAgentImpl::InspectElement(int x, int y) {
if (!node)
return;
- SetEnabled(true);
int node_id = dom_agent_impl_->PushNodePathToClient(node);
tools_agent_delegate_stub_->UpdateFocusedNode(node_id);
}
diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h
index 500299b..15df64c 100644
--- a/webkit/glue/webdevtoolsagent_impl.h
+++ b/webkit/glue/webdevtoolsagent_impl.h
@@ -40,12 +40,13 @@ class WebDevToolsAgentImpl
virtual ~WebDevToolsAgentImpl();
// ToolsAgent implementation.
- virtual void SetEnabled(bool enabled);
virtual void HighlightDOMNode(int node_id);
virtual void HideDOMNodeHighlight();
virtual void EvaluateJavaSctipt(int call_id, const String& js);
// WebDevToolsAgent implementation.
+ virtual void Attach();
+ virtual void Detach();
virtual void DispatchMessageFromClient(const std::string& raw_msg);
virtual void InspectElement(int x, int y);
@@ -71,7 +72,7 @@ class WebDevToolsAgentImpl
scoped_ptr<DebuggerAgentImpl> debugger_agent_impl_;
scoped_ptr<DomAgentImpl> dom_agent_impl_;
scoped_ptr<NetAgentImpl> net_agent_impl_;
- bool enabled_;
+ bool attached_;
DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl);
};