| OLD | NEW |
| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 SendDetachedEvent(); | 405 SendDetachedEvent(); |
| 406 Close(); | 406 Close(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void ExtensionDevToolsClientHost::SendDetachedEvent() { | 409 void ExtensionDevToolsClientHost::SendDetachedEvent() { |
| 410 if (!EventRouter::Get(profile_)) | 410 if (!EventRouter::Get(profile_)) |
| 411 return; | 411 return; |
| 412 | 412 |
| 413 std::unique_ptr<base::ListValue> args( | 413 std::unique_ptr<base::ListValue> args( |
| 414 OnDetach::Create(debuggee_, detach_reason_)); | 414 OnDetach::Create(debuggee_, detach_reason_)); |
| 415 std::unique_ptr<Event> event(new Event( | 415 auto event = |
| 416 events::DEBUGGER_ON_DETACH, OnDetach::kEventName, std::move(args))); | 416 base::MakeUnique<Event>(events::DEBUGGER_ON_DETACH, OnDetach::kEventName, |
| 417 event->restrict_to_browser_context = profile_; | 417 std::move(args), profile_); |
| 418 EventRouter::Get(profile_) | 418 EventRouter::Get(profile_) |
| 419 ->DispatchEventToExtension(extension_id_, std::move(event)); | 419 ->DispatchEventToExtension(extension_id_, std::move(event)); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void ExtensionDevToolsClientHost::OnExtensionUnloaded( | 422 void ExtensionDevToolsClientHost::OnExtensionUnloaded( |
| 423 content::BrowserContext* browser_context, | 423 content::BrowserContext* browser_context, |
| 424 const Extension* extension, | 424 const Extension* extension, |
| 425 UnloadedExtensionReason reason) { | 425 UnloadedExtensionReason reason) { |
| 426 if (extension->id() == extension_id_) | 426 if (extension->id() == extension_id_) |
| 427 Close(); | 427 Close(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 453 if (!dictionary->GetString("method", &method_name)) | 453 if (!dictionary->GetString("method", &method_name)) |
| 454 return; | 454 return; |
| 455 | 455 |
| 456 OnEvent::Params params; | 456 OnEvent::Params params; |
| 457 base::DictionaryValue* params_value; | 457 base::DictionaryValue* params_value; |
| 458 if (dictionary->GetDictionary("params", ¶ms_value)) | 458 if (dictionary->GetDictionary("params", ¶ms_value)) |
| 459 params.additional_properties.Swap(params_value); | 459 params.additional_properties.Swap(params_value); |
| 460 | 460 |
| 461 std::unique_ptr<base::ListValue> args( | 461 std::unique_ptr<base::ListValue> args( |
| 462 OnEvent::Create(debuggee_, method_name, params)); | 462 OnEvent::Create(debuggee_, method_name, params)); |
| 463 std::unique_ptr<Event> event(new Event( | 463 auto event = |
| 464 events::DEBUGGER_ON_EVENT, OnEvent::kEventName, std::move(args))); | 464 base::MakeUnique<Event>(events::DEBUGGER_ON_EVENT, OnEvent::kEventName, |
| 465 event->restrict_to_browser_context = profile_; | 465 std::move(args), profile_); |
| 466 EventRouter::Get(profile_) | 466 EventRouter::Get(profile_) |
| 467 ->DispatchEventToExtension(extension_id_, std::move(event)); | 467 ->DispatchEventToExtension(extension_id_, std::move(event)); |
| 468 } else { | 468 } else { |
| 469 DebuggerSendCommandFunction* function = pending_requests_[id].get(); | 469 DebuggerSendCommandFunction* function = pending_requests_[id].get(); |
| 470 if (!function) | 470 if (!function) |
| 471 return; | 471 return; |
| 472 | 472 |
| 473 function->SendResponseBody(dictionary); | 473 function->SendResponseBody(dictionary); |
| 474 pending_requests_.erase(id); | 474 pending_requests_.erase(id); |
| 475 } | 475 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 void DebuggerGetTargetsFunction::SendTargetList( | 738 void DebuggerGetTargetsFunction::SendTargetList( |
| 739 const content::DevToolsAgentHost::List& target_list) { | 739 const content::DevToolsAgentHost::List& target_list) { |
| 740 std::unique_ptr<base::ListValue> result(new base::ListValue()); | 740 std::unique_ptr<base::ListValue> result(new base::ListValue()); |
| 741 for (size_t i = 0; i < target_list.size(); ++i) | 741 for (size_t i = 0; i < target_list.size(); ++i) |
| 742 result->Append(SerializeTarget(target_list[i])); | 742 result->Append(SerializeTarget(target_list[i])); |
| 743 SetResult(std::move(result)); | 743 SetResult(std::move(result)); |
| 744 SendResponse(true); | 744 SendResponse(true); |
| 745 } | 745 } |
| 746 | 746 |
| 747 } // namespace extensions | 747 } // namespace extensions |
| OLD | NEW |