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

Side by Side Diff: content/browser/devtools/devtools_http_handler_impl.cc

Issue 733443003: [DevTools] Used generated Inspector.detached in DevToolsHttpHandlerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 342 }
343 343
344 ~DevToolsAgentHostClientImpl() override { 344 ~DevToolsAgentHostClientImpl() override {
345 if (agent_host_.get()) 345 if (agent_host_.get())
346 agent_host_->DetachClient(); 346 agent_host_->DetachClient();
347 } 347 }
348 348
349 void AgentHostClosed(DevToolsAgentHost* agent_host, 349 void AgentHostClosed(DevToolsAgentHost* agent_host,
350 bool replaced_with_another_client) override { 350 bool replaced_with_another_client) override {
351 DCHECK(agent_host == agent_host_.get()); 351 DCHECK(agent_host == agent_host_.get());
352 agent_host_ = NULL;
353 352
354 base::DictionaryValue notification; 353 base::DictionaryValue notification;
dgozman 2014/11/20 14:29:14 nit: notification unused.
vkuzkokov 2014/11/20 14:47:35 Done.
355 notification.SetString( 354 devtools::inspector::Client client(
356 devtools::Inspector::detached::kParamReason, 355 base::Bind(&DevToolsAgentHostClientImpl::DispatchProtocolMessage,
dgozman 2014/11/20 14:29:14 Let's extract this bound function and call it |raw
vkuzkokov 2014/11/20 14:47:35 Done.
356 base::Unretained(this), base::Unretained(agent_host)));
357 client.Detached(devtools::inspector::DetachedParams::Create()->set_reason(
dgozman 2014/11/20 14:29:13 |inspector.Detached| would be nicer.
vkuzkokov 2014/11/20 14:47:35 Done.
357 replaced_with_another_client ? 358 replaced_with_another_client ?
358 "replaced_with_devtools" : "target_closed"); 359 "replaced_with_devtools" : "target_closed"));
359 std::string response = DevToolsProtocol::CreateNotification(
360 devtools::Inspector::detached::kName,
361 notification.DeepCopy())->Serialize();
362 message_loop_->PostTask(
363 FROM_HERE,
364 base::Bind(&ServerWrapper::SendOverWebSocket,
365 base::Unretained(server_wrapper_),
366 connection_id_,
367 response));
368 360
361 agent_host_ = nullptr;
369 message_loop_->PostTask( 362 message_loop_->PostTask(
370 FROM_HERE, 363 FROM_HERE,
371 base::Bind(&ServerWrapper::Close, 364 base::Bind(&ServerWrapper::Close,
372 base::Unretained(server_wrapper_), 365 base::Unretained(server_wrapper_),
373 connection_id_)); 366 connection_id_));
374 } 367 }
375 368
376 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, 369 void DispatchProtocolMessage(DevToolsAgentHost* agent_host,
377 const std::string& message) override { 370 const std::string& message) override {
378 DCHECK(agent_host == agent_host_.get()); 371 DCHECK(agent_host == agent_host_.get());
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 id.c_str(), 1125 id.c_str(),
1133 host); 1126 host);
1134 dictionary->SetString( 1127 dictionary->SetString(
1135 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); 1128 kTargetDevtoolsFrontendUrlField, devtools_frontend_url);
1136 } 1129 }
1137 1130
1138 return dictionary; 1131 return dictionary;
1139 } 1132 }
1140 1133
1141 } // namespace content 1134 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698