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

Side by Side Diff: chrome/browser/extensions/api/debugger/debugger_api.cc

Issue 2047833002: DevTools: introduce browser domain for basic target discovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 6 months 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
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 // Implements the Chrome Extensions Debugger API. 5 // Implements the Chrome Extensions Debugger API.
6 6
7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 void ExtensionDevToolsClientHost::AgentHostClosed( 360 void ExtensionDevToolsClientHost::AgentHostClosed(
361 DevToolsAgentHost* agent_host, bool replaced_with_another_client) { 361 DevToolsAgentHost* agent_host, bool replaced_with_another_client) {
362 DCHECK(agent_host == agent_host_.get()); 362 DCHECK(agent_host == agent_host_.get());
363 if (replaced_with_another_client) 363 if (replaced_with_another_client)
364 detach_reason_ = api::debugger::DETACH_REASON_REPLACED_WITH_DEVTOOLS; 364 detach_reason_ = api::debugger::DETACH_REASON_REPLACED_WITH_DEVTOOLS;
365 SendDetachedEvent(); 365 SendDetachedEvent();
366 delete this; 366 delete this;
367 } 367 }
368 368
369 void ExtensionDevToolsClientHost::Close() { 369 void ExtensionDevToolsClientHost::Close() {
370 agent_host_->DetachClient(); 370 agent_host_->DetachClient(this);
371 delete this; 371 delete this;
372 } 372 }
373 373
374 void ExtensionDevToolsClientHost::SendMessageToBackend( 374 void ExtensionDevToolsClientHost::SendMessageToBackend(
375 DebuggerSendCommandFunction* function, 375 DebuggerSendCommandFunction* function,
376 const std::string& method, 376 const std::string& method,
377 SendCommand::Params::CommandParams* command_params) { 377 SendCommand::Params::CommandParams* command_params) {
378 base::DictionaryValue protocol_request; 378 base::DictionaryValue protocol_request;
379 int request_id = ++last_request_id_; 379 int request_id = ++last_request_id_;
380 pending_requests_[request_id] = function; 380 pending_requests_[request_id] = function;
381 protocol_request.SetInteger("id", request_id); 381 protocol_request.SetInteger("id", request_id);
382 protocol_request.SetString("method", method); 382 protocol_request.SetString("method", method);
383 if (command_params) { 383 if (command_params) {
384 protocol_request.Set("params", 384 protocol_request.Set("params",
385 command_params->additional_properties.DeepCopy()); 385 command_params->additional_properties.DeepCopy());
386 } 386 }
387 387
388 std::string json_args; 388 std::string json_args;
389 base::JSONWriter::Write(protocol_request, &json_args); 389 base::JSONWriter::Write(protocol_request, &json_args);
390 agent_host_->DispatchProtocolMessage(json_args); 390 agent_host_->DispatchProtocolMessage(this, json_args);
391 } 391 }
392 392
393 void ExtensionDevToolsClientHost::InfoBarDismissed() { 393 void ExtensionDevToolsClientHost::InfoBarDismissed() {
394 detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER; 394 detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER;
395 SendDetachedEvent(); 395 SendDetachedEvent();
396 Close(); 396 Close();
397 } 397 }
398 398
399 void ExtensionDevToolsClientHost::SendDetachedEvent() { 399 void ExtensionDevToolsClientHost::SendDetachedEvent() {
400 if (!EventRouter::Get(profile_)) 400 if (!EventRouter::Get(profile_))
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 const std::vector<DevToolsTargetImpl*>& target_list) { 727 const std::vector<DevToolsTargetImpl*>& target_list) {
728 std::unique_ptr<base::ListValue> result(new base::ListValue()); 728 std::unique_ptr<base::ListValue> result(new base::ListValue());
729 for (size_t i = 0; i < target_list.size(); ++i) 729 for (size_t i = 0; i < target_list.size(); ++i)
730 result->Append(SerializeTarget(*target_list[i])); 730 result->Append(SerializeTarget(*target_list[i]));
731 STLDeleteContainerPointers(target_list.begin(), target_list.end()); 731 STLDeleteContainerPointers(target_list.begin(), target_list.end());
732 SetResult(std::move(result)); 732 SetResult(std::move(result));
733 SendResponse(true); 733 SendResponse(true);
734 } 734 }
735 735
736 } // namespace extensions 736 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_ui_bindings.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698