Chromium Code Reviews| Index: content/browser/debugger/devtools_http_handler_impl.cc |
| diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc |
| index 976e2e8d55ee3a769a5304ed59dd68e18c188e7a..a9211a16fdfaafe6818869c9ec319866dd604a01 100644 |
| --- a/content/browser/debugger/devtools_http_handler_impl.cc |
| +++ b/content/browser/debugger/devtools_http_handler_impl.cc |
| @@ -96,7 +96,8 @@ class DevToolsClientHostImpl : public DevToolsClientHost { |
| : message_loop_(message_loop), |
| server_(server), |
| connection_id_(connection_id), |
| - is_closed_(false) { |
| + is_closed_(false), |
| + detach_reason_("target_closed") { |
| } |
| ~DevToolsClientHostImpl() {} |
| @@ -106,6 +107,23 @@ class DevToolsClientHostImpl : public DevToolsClientHost { |
| if (is_closed_) |
| return; |
| is_closed_ = true; |
| + |
| + std::string response; |
| + DictionaryValue message; |
| + message.SetString("method", "Inspector.detached"); |
| + DictionaryValue* params = new DictionaryValue(); |
| + message.Set("params", params); |
| + params->SetString("reason", detach_reason_); |
| + base::JSONWriter::WriteWithOptions(&message, |
|
yurys
2012/11/01 15:37:11
Can you provide a method in WebKit API that would
pfeldman
2012/11/01 16:24:49
We can't delegate it to the dying renderer, but I
pfeldman
2012/11/01 16:54:32
Done.
|
| + base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| + &response); |
| + message_loop_->PostTask( |
| + FROM_HERE, |
| + base::Bind(&net::HttpServer::SendOverWebSocket, |
| + server_, |
| + connection_id_, |
| + response)); |
| + |
| message_loop_->PostTask( |
| FROM_HERE, |
| base::Bind(&net::HttpServer::Close, server_, connection_id_)); |
| @@ -123,12 +141,17 @@ class DevToolsClientHostImpl : public DevToolsClientHost { |
| virtual void ContentsReplaced(WebContents* new_contents) { |
| } |
| + virtual void ReplacedWithAnotherClient() { |
| + detach_reason_ = "replaced_with_devtools"; |
| + } |
| + |
| private: |
| virtual void FrameNavigating(const std::string& url) {} |
| MessageLoop* message_loop_; |
| net::HttpServer* server_; |
| int connection_id_; |
| bool is_closed_; |
| + std::string detach_reason_; |
| }; |
| } // namespace |