summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 15:23:27 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 15:23:27 +0000
commit7ddc59b2cc6902be588d41e07ccc2b50cd712861 (patch)
tree542dec2d06276d9af8ba77b337edc7dd4b9981d7
parent284b9593e7879e5bce6a112b139660a83ae215d9 (diff)
downloadchromium_src-7ddc59b2cc6902be588d41e07ccc2b50cd712861.zip
chromium_src-7ddc59b2cc6902be588d41e07ccc2b50cd712861.tar.gz
chromium_src-7ddc59b2cc6902be588d41e07ccc2b50cd712861.tar.bz2
DevTools: Remove resource panel-related RPC methods.
Review URL: http://codereview.chromium.org/174142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23817 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/devtools/js/devtools.js46
-rw-r--r--webkit/glue/devtools/js/inspector_controller_impl.js28
-rw-r--r--webkit/glue/devtools/tools_agent.h10
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc39
-rw-r--r--webkit/glue/webdevtoolsagent_impl.h2
5 files changed, 35 insertions, 90 deletions
diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js
index 49550e9..b5e817a 100644
--- a/webkit/glue/devtools/js/devtools.js
+++ b/webkit/glue/devtools/js/devtools.js
@@ -41,8 +41,6 @@ devtools.ToolsAgent = function() {
goog.bind(this.frameNavigate_, this);
RemoteToolsAgent.DispatchOnClient =
goog.bind(this.dispatchOnClient_, this);
- RemoteToolsAgent.SetResourcesPanelEnabled =
- goog.bind(this.setResourcesPanelEnabled_, this);
this.debuggerAgent_ = new devtools.DebuggerAgent();
};
@@ -115,39 +113,12 @@ devtools.ToolsAgent.prototype.evaluate = function(expr) {
/**
- * Enables / disables resource tracking.
- * @param {boolean} enabled Sets tracking status.
- * @param {boolean} always Determines whether tracking status should be sticky.
- */
-devtools.ToolsAgent.prototype.setResourceTrackingEnabled = function(enabled,
- always) {
- RemoteToolsAgent.SetResourceTrackingEnabled(enabled, always);
-};
-
-
-/**
* Enables / disables resources panel in the ui.
* @param {boolean} enabled New panel status.
*/
-devtools.ToolsAgent.prototype.setResourcesPanelEnabled_ = function(enabled) {
+WebInspector.setResourcesPanelEnabled = function(enabled) {
InspectorController.resourceTrackingEnabled_ = enabled;
- // TODO(pfeldman): Extract this upstream.
- var panel = WebInspector.panels.resources;
- if (enabled) {
- panel.enableToggleButton.title =
- WebInspector.UIString("Resource tracking enabled. Click to disable.");
- panel.enableToggleButton.toggled = true;
- panel.largerResourcesButton.visible = true;
- panel.sortingSelectElement.visible = false;
- panel.panelEnablerView.visible = false;
- } else {
- panel.enableToggleButton.title =
- WebInspector.UIString("Resource tracking disabled. Click to enable.");
- panel.enableToggleButton.toggled = false;
- panel.largerResourcesButton.visible = false;
- panel.sortingSelectElement.visible = false;
- panel.panelEnablerView.visible = true;
- }
+ WebInspector.panels.resources.reset();
};
@@ -671,3 +642,16 @@ WebInspector.ConsoleView.prototype._formatobject = function(object, elem) {
this.panels.heap = new WebInspector.HeapProfilerPanel();
};
})();
+
+
+WebInspector.resourceTrackingWasEnabled = function()
+{
+ InspectorController.resourceTrackingEnabled_ = true;
+ this.panels.resources.resourceTrackingWasEnabled();
+}
+
+WebInspector.resourceTrackingWasDisabled = function()
+{
+ InspectorController.resourceTrackingEnabled_ = false;
+ this.panels.resources.resourceTrackingWasDisabled();
+}
diff --git a/webkit/glue/devtools/js/inspector_controller_impl.js b/webkit/glue/devtools/js/inspector_controller_impl.js
index 3b92a5c..03b2ee2 100644
--- a/webkit/glue/devtools/js/inspector_controller_impl.js
+++ b/webkit/glue/devtools/js/inspector_controller_impl.js
@@ -21,6 +21,8 @@ devtools.InspectorControllerImpl = function() {
this.installInspectorControllerDelegate_('setAttribute');
this.installInspectorControllerDelegate_('removeAttribute');
this.installInspectorControllerDelegate_('setTextNodeValue');
+ this.installInspectorControllerDelegate_('enableResourceTracking');
+ this.installInspectorControllerDelegate_('disableResourceTracking');
this.installInjectedScriptDelegate_('getStyles');
this.installInjectedScriptDelegate_('getComputedStyle');
@@ -132,24 +134,6 @@ devtools.InspectorControllerImpl.prototype.inspectedWindow = function() {
/**
- * {@inheritDoc}.
- */
-devtools.InspectorControllerImpl.prototype.enableResourceTracking =
- function(always) {
- devtools.tools.setResourceTrackingEnabled(true, always);
-}
-
-
-/**
- * {@inheritDoc}.
- */
-devtools.InspectorControllerImpl.prototype.disableResourceTracking =
- function(always) {
- devtools.tools.setResourceTrackingEnabled(false, always);
-};
-
-
-/**
* @override
*/
devtools.InspectorControllerImpl.prototype.debuggerEnabled = function() {
@@ -237,14 +221,6 @@ devtools.InspectorControllerImpl.prototype.stopProfiling = function() {
};
-devtools.InspectorControllerImpl.prototype.storeLastActivePanel =
- function(panel) {
- RemoteToolsAgent.ExecuteUtilityFunction(
- devtools.Callback.wrap(undefined),
- 'InspectorController', JSON.stringify(['storeLastActivePanel', panel]));
-};
-
-
/**
* Installs delegating handler into the inspector controller.
* @param {string} methodName Method to install delegating handler for.
diff --git a/webkit/glue/devtools/tools_agent.h b/webkit/glue/devtools/tools_agent.h
index bddc159..fa106e6 100644
--- a/webkit/glue/devtools/tools_agent.h
+++ b/webkit/glue/devtools/tools_agent.h
@@ -16,10 +16,7 @@
\
/* Requests that the agent sends content of the resource with given id to the
delegate. */ \
- METHOD2(GetResourceContent, int /* call_id */, int /* identifier */) \
- \
- /* Turns resource tracking on / off. */ \
- METHOD2(SetResourceTrackingEnabled, bool /* enabled */, bool /* always */)
+ METHOD2(GetResourceContent, int /* call_id */, int /* identifier */)
DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT)
@@ -33,10 +30,7 @@ DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT)
String /* exception */) \
\
/* Sends InspectorFrontend message to be dispatched on client. */ \
- METHOD1(DispatchOnClient, String /* data */) \
- \
- /* Tells frontend if resources panel should be enabled in the UI. */ \
- METHOD1(SetResourcesPanelEnabled, bool /* enabled. */)
+ METHOD1(DispatchOnClient, String /* data */)
DEFINE_RPC_CLASS(ToolsAgentDelegate, TOOLS_AGENT_DELEGATE_STRUCT)
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
index 35d3d5c..41a4056 100644
--- a/webkit/glue/webdevtoolsagent_impl.cc
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -75,6 +75,14 @@ void WebDevToolsAgentImpl::DisposeUtilityContext() {
}
}
+void WebDevToolsAgentImpl::UnhideResourcesPanelIfNecessary() {
+ InspectorController* ic = web_view_impl_->page()->inspectorController();
+ ic->ensureResourceTrackingSettingsLoaded();
+ String command = String::format("[\"setResourcesPanelEnabled\", %s]",
+ ic->resourceTrackingEnabled() ? "true" : "false");
+ tools_agent_delegate_stub_->DispatchOnClient(command);
+}
+
void WebDevToolsAgentImpl::Attach() {
if (attached_) {
return;
@@ -87,16 +95,14 @@ void WebDevToolsAgentImpl::Attach() {
debugger_agent_impl_->CreateUtilityContext(page->mainFrame(), &utility_context_);
InitDevToolsAgentHost();
- InspectorController* ic = web_view_impl_->page()->inspectorController();
- // Unhide resources panel if necessary.
- tools_agent_delegate_stub_->SetResourcesPanelEnabled(
- ic->resourceTrackingEnabled());
+ UnhideResourcesPanelIfNecessary();
v8::HandleScope scope;
v8::Context::Scope context_scope(utility_context_);
ScriptState* state = scriptStateFromPage(web_view_impl_->page());
v8::Handle<v8::Object> injected_script = v8::Local<v8::Object>::Cast(
utility_context_->Global()->Get(v8::String::New("InjectedScript")));
+ InspectorController* ic = web_view_impl_->page()->inspectorController();
ic->setFrontendProxyObject(
state,
ScriptObject(state, utility_context_->Global()),
@@ -140,10 +146,7 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame(
tools_agent_delegate_stub_->FrameNavigate(
url.possibly_invalid_spec());
}
- InspectorController* ic = webview->page()->inspectorController();
- // Unhide resources panel if necessary.
- tools_agent_delegate_stub_->SetResourcesPanelEnabled(
- ic->resourceTrackingEnabled());
+ UnhideResourcesPanelIfNecessary();
}
void WebDevToolsAgentImpl::WindowObjectCleared(WebFrameImpl* webframe) {
@@ -185,20 +188,6 @@ void WebDevToolsAgentImpl::GetResourceContent(
tools_agent_native_delegate_stub_->DidGetResourceContent(call_id, content);
}
-void WebDevToolsAgentImpl::SetResourceTrackingEnabled(
- bool enabled,
- bool always) {
- // Hide / unhide resources panel if necessary.
- tools_agent_delegate_stub_->SetResourcesPanelEnabled(enabled);
-
- InspectorController* ic = web_view_impl_->page()->inspectorController();
- if (enabled) {
- ic->enableResourceTracking(always);
- } else {
- ic->disableResourceTracking(always);
- }
-}
-
void WebDevToolsAgentImpl::DispatchMessageFromClient(
const std::string& class_name,
const std::string& method_name,
@@ -223,8 +212,10 @@ void WebDevToolsAgentImpl::DispatchMessageFromClient(
}
void WebDevToolsAgentImpl::InspectElement(int x, int y) {
- // TODO(pfeldman): implement using new inspector controller API.
-
+ Node* node = web_view_impl_->GetNodeForWindowPos(x, y);
+ if (!node) {
+ return;
+ }
}
void WebDevToolsAgentImpl::SendRpcMessage(
diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h
index abc4d09..9d2ae78 100644
--- a/webkit/glue/webdevtoolsagent_impl.h
+++ b/webkit/glue/webdevtoolsagent_impl.h
@@ -49,7 +49,6 @@ class WebDevToolsAgentImpl
virtual void GetResourceContent(
int call_id,
int identifier);
- virtual void SetResourceTrackingEnabled(bool enabled, bool always);
// WebDevToolsAgent implementation.
virtual void Attach();
@@ -80,6 +79,7 @@ class WebDevToolsAgentImpl
private:
static v8::Handle<v8::Value> JsDispatchOnClient(const v8::Arguments& args);
void DisposeUtilityContext();
+ void UnhideResourcesPanelIfNecessary();
void InitDevToolsAgentHost();