Skip to content

Commit

Permalink
[DevTools] Used generated Inspector.detached in DevToolsHttpHandlerImpl
Browse files Browse the repository at this point in the history
BUG=405566

Review URL: https://codereview.chromium.org/733443003

Cr-Commit-Position: refs/heads/master@{#305018}
  • Loading branch information
vkuzkokov authored and Commit bot committed Nov 20, 2014
1 parent 4c60e32 commit 9c9d7fc
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions content/browser/devtools/devtools_http_handler_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -349,23 +349,16 @@ class DevToolsAgentHostClientImpl : public DevToolsAgentHostClient {
void AgentHostClosed(DevToolsAgentHost* agent_host,
bool replaced_with_another_client) override {
DCHECK(agent_host == agent_host_.get());
agent_host_ = NULL;

base::DictionaryValue notification;
notification.SetString(
devtools::Inspector::detached::kParamReason,
replaced_with_another_client ?
"replaced_with_devtools" : "target_closed");
std::string response = DevToolsProtocol::CreateNotification(
devtools::Inspector::detached::kName,
notification.DeepCopy())->Serialize();
message_loop_->PostTask(
FROM_HERE,
base::Bind(&ServerWrapper::SendOverWebSocket,
base::Unretained(server_wrapper_),
connection_id_,
response));

base::Callback<void(const std::string&)> raw_message_callback(
base::Bind(&DevToolsAgentHostClientImpl::DispatchProtocolMessage,
base::Unretained(this), base::Unretained(agent_host)));
devtools::inspector::Client inspector(raw_message_callback);
inspector.Detached(devtools::inspector::DetachedParams::Create()
->set_reason(replaced_with_another_client ?
"replaced_with_devtools" : "target_closed"));

agent_host_ = nullptr;
message_loop_->PostTask(
FROM_HERE,
base::Bind(&ServerWrapper::Close,
Expand Down

0 comments on commit 9c9d7fc

Please sign in to comment.