diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-08 10:17:58 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-08 10:17:58 +0000 |
commit | 991b310449356ca26912506c582b4219dc8cc13f (patch) | |
tree | 3c22bcf7c8408459ed10fee5b7fc2b6e40fc2970 | |
parent | 6e005e2d4021df269de3cb53651d129454c1d2b3 (diff) | |
download | chromium_src-991b310449356ca26912506c582b4219dc8cc13f.zip chromium_src-991b310449356ca26912506c582b4219dc8cc13f.tar.gz chromium_src-991b310449356ca26912506c582b4219dc8cc13f.tar.bz2 |
DevTools: Activate inspector window on break / exception.
Review URL: http://codereview.chromium.org/113100
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15632 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/devtools_client.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/devtools_client.h | 1 | ||||
-rw-r--r-- | webkit/glue/devtools/js/debugger_agent.js | 1 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsclient_delegate.h | 1 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsclient_impl.cc | 53 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsclient_impl.h | 6 |
6 files changed, 45 insertions, 21 deletions
diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc index 852b9988..27e3954 100644 --- a/chrome/renderer/devtools_client.cc +++ b/chrome/renderer/devtools_client.cc @@ -45,6 +45,10 @@ void DevToolsClient::SendDebuggerCommandToAgent(const std::string& command) { Send(DevToolsAgentMsg_DebuggerCommand(command)); } +void DevToolsClient::ActivateWindow() { + render_view_->TakeFocus(render_view_->webview(), false); +} + void DevToolsClient::OnRpcMessage(const std::string& raw_msg) { web_tools_client_->DispatchMessageFromAgent(raw_msg); } diff --git a/chrome/renderer/devtools_client.h b/chrome/renderer/devtools_client.h index cbd687b..1964968 100644 --- a/chrome/renderer/devtools_client.h +++ b/chrome/renderer/devtools_client.h @@ -35,6 +35,7 @@ class DevToolsClient : public WebDevToolsClientDelegate { // WebDevToolsClient::Delegate implementation virtual void SendMessageToAgent(const std::string& raw_msg); virtual void SendDebuggerCommandToAgent(const std::string& command); + virtual void ActivateWindow(); private: void OnRpcMessage(const std::string& raw_msg); diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js index c403a0b..4454b83 100644 --- a/webkit/glue/devtools/js/debugger_agent.js +++ b/webkit/glue/devtools/js/debugger_agent.js @@ -494,6 +494,7 @@ devtools.DebuggerAgent.prototype.handleBacktraceResponse_ = function(msg) { this.currentCallFrame_ = f; WebInspector.pausedScript(); + DevToolsHost.activateWindow(); }; diff --git a/webkit/glue/webdevtoolsclient_delegate.h b/webkit/glue/webdevtoolsclient_delegate.h index 77ca962..720bff2 100644 --- a/webkit/glue/webdevtoolsclient_delegate.h +++ b/webkit/glue/webdevtoolsclient_delegate.h @@ -15,6 +15,7 @@ class WebDevToolsClientDelegate { virtual void SendMessageToAgent(const std::string& raw_msg) = 0; virtual void SendDebuggerCommandToAgent(const std::string& command) = 0; + virtual void ActivateWindow() = 0; private: DISALLOW_COPY_AND_ASSIGN(WebDevToolsClientDelegate); diff --git a/webkit/glue/webdevtoolsclient_impl.cc b/webkit/glue/webdevtoolsclient_impl.cc index 62c5f6a..4f654f4 100644 --- a/webkit/glue/webdevtoolsclient_impl.cc +++ b/webkit/glue/webdevtoolsclient_impl.cc @@ -99,28 +99,38 @@ void WebDevToolsClientImpl::InitBoundObject() { v8::Local<v8::Signature> default_signature = v8::Signature::New(host_template_); v8::Local<v8::ObjectTemplate> proto = host_template_->PrototypeTemplate(); + InitProtoFunction(proto, + "addSourceToFrame", + WebDevToolsClientImpl::JsAddSourceToFrame, + default_signature); + InitProtoFunction(proto, + "loaded", + WebDevToolsClientImpl::JsLoaded, + default_signature); + InitProtoFunction(proto, + "search", + WebCore::V8Custom::v8InspectorControllerSearchCallback, + default_signature); + InitProtoFunction(proto, + "activateWindow", + WebDevToolsClientImpl::JsActivateWindow, + default_signature); + host_template_->SetClassName(v8::String::New("DevToolsHost")); +} + +// static +void WebDevToolsClientImpl::InitProtoFunction( + v8::Handle<v8::ObjectTemplate> proto, + const char* name, + v8::InvocationCallback callback, + v8::Handle<v8::Signature> signature) { proto->Set( - v8::String::New("addSourceToFrame"), - v8::FunctionTemplate::New( - WebDevToolsClientImpl::JsAddSourceToFrame, - v8::Handle<v8::Value>(), - default_signature), - static_cast<v8::PropertyAttribute>(v8::DontDelete)); - proto->Set( - v8::String::New("loaded"), - v8::FunctionTemplate::New( - WebDevToolsClientImpl::JsLoaded, - v8::Handle<v8::Value>(), - default_signature), - static_cast<v8::PropertyAttribute>(v8::DontDelete)); - proto->Set( - v8::String::New("search"), + v8::String::New(name), v8::FunctionTemplate::New( - WebDevToolsClientImpl::JsSearch, + callback, v8::Handle<v8::Value>(), - default_signature), + signature), static_cast<v8::PropertyAttribute>(v8::DontDelete)); - host_template_->SetClassName(v8::String::New("DevToolsHost")); } // static @@ -240,7 +250,10 @@ v8::Handle<v8::Value> WebDevToolsClientImpl::JsLoaded( } // static -v8::Handle<v8::Value> WebDevToolsClientImpl::JsSearch( +v8::Handle<v8::Value> WebDevToolsClientImpl::JsActivateWindow( const v8::Arguments& args) { - return WebCore::V8Custom::v8InspectorControllerSearchCallback(args); + Page* page = V8Proxy::retrieveActiveFrame()->page(); + WebDevToolsClientImpl* client = page_to_client_.get(page); + client->delegate_->ActivateWindow(); + return v8::Undefined(); } diff --git a/webkit/glue/webdevtoolsclient_impl.h b/webkit/glue/webdevtoolsclient_impl.h index e6127f4..8e250cb 100644 --- a/webkit/glue/webdevtoolsclient_impl.h +++ b/webkit/glue/webdevtoolsclient_impl.h @@ -43,9 +43,13 @@ class WebDevToolsClientImpl : public WebDevToolsClient, virtual void DispatchMessageFromAgent(const std::string& raw_msg); private: + static void InitProtoFunction(v8::Handle<v8::ObjectTemplate> proto, + const char* name, + v8::InvocationCallback callback, + v8::Handle<v8::Signature> signature); static v8::Handle<v8::Value> JsAddSourceToFrame(const v8::Arguments& args); static v8::Handle<v8::Value> JsLoaded(const v8::Arguments& args); - static v8::Handle<v8::Value> JsSearch(const v8::Arguments& args); + static v8::Handle<v8::Value> JsActivateWindow(const v8::Arguments& args); static v8::Persistent<v8::FunctionTemplate> host_template_; static HashMap<WebCore::Page*, WebDevToolsClientImpl*> page_to_client_; |