Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: content/browser/debugger/devtools_http_handler_impl.cc

Issue 11361034: DevTools: [remote debugging] emit Inspector.detached protocol message upon connectin termination. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comment addressed Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..319036c3f23ffa28ec2c828ec74d6dc714104516 100644
--- a/content/browser/debugger/devtools_http_handler_impl.cc
+++ b/content/browser/debugger/devtools_http_handler_impl.cc
@@ -42,6 +42,7 @@
#include "net/base/ip_endpoint.h"
#include "net/server/http_server_request_info.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "ui/base/layout.h"
#include "webkit/user_agent/user_agent.h"
#include "webkit/user_agent/user_agent_util.h"
@@ -96,7 +97,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 +108,17 @@ class DevToolsClientHostImpl : public DevToolsClientHost {
if (is_closed_)
return;
is_closed_ = true;
+
+ std::string response =
+ WebKit::WebDevToolsAgent::inspectorDetachedEvent(
yurys 2012/11/02 06:59:58 You need to make sure that WebKit is is initialize
+ WebKit::WebString::fromUTF8(detach_reason_)).utf8();
+ 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 +136,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
« no previous file with comments | « content/browser/debugger/devtools_frontend_host.cc ('k') | content/browser/debugger/devtools_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698