| 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 <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 void ExtensionDevToolsClientHost::MarkAsDismissed() { | 392 void ExtensionDevToolsClientHost::MarkAsDismissed() { |
| 393 detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER; | 393 detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER; |
| 394 } | 394 } |
| 395 | 395 |
| 396 void ExtensionDevToolsClientHost::SendDetachedEvent() { | 396 void ExtensionDevToolsClientHost::SendDetachedEvent() { |
| 397 if (!EventRouter::Get(profile_)) | 397 if (!EventRouter::Get(profile_)) |
| 398 return; | 398 return; |
| 399 | 399 |
| 400 scoped_ptr<base::ListValue> args(OnDetach::Create(debuggee_, | 400 scoped_ptr<base::ListValue> args(OnDetach::Create(debuggee_, |
| 401 detach_reason_)); | 401 detach_reason_)); |
| 402 scoped_ptr<Event> event(new Event(OnDetach::kEventName, args.Pass())); | 402 scoped_ptr<Event> event( |
| 403 new Event(events::UNKNOWN, OnDetach::kEventName, args.Pass())); |
| 403 event->restrict_to_browser_context = profile_; | 404 event->restrict_to_browser_context = profile_; |
| 404 EventRouter::Get(profile_) | 405 EventRouter::Get(profile_) |
| 405 ->DispatchEventToExtension(extension_id_, event.Pass()); | 406 ->DispatchEventToExtension(extension_id_, event.Pass()); |
| 406 } | 407 } |
| 407 | 408 |
| 408 void ExtensionDevToolsClientHost::OnExtensionUnloaded( | 409 void ExtensionDevToolsClientHost::OnExtensionUnloaded( |
| 409 content::BrowserContext* browser_context, | 410 content::BrowserContext* browser_context, |
| 410 const Extension* extension, | 411 const Extension* extension, |
| 411 UnloadedExtensionInfo::Reason reason) { | 412 UnloadedExtensionInfo::Reason reason) { |
| 412 if (extension->id() == extension_id_) | 413 if (extension->id() == extension_id_) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 if (!dictionary->GetString("method", &method_name)) | 453 if (!dictionary->GetString("method", &method_name)) |
| 453 return; | 454 return; |
| 454 | 455 |
| 455 OnEvent::Params params; | 456 OnEvent::Params params; |
| 456 base::DictionaryValue* params_value; | 457 base::DictionaryValue* params_value; |
| 457 if (dictionary->GetDictionary("params", ¶ms_value)) | 458 if (dictionary->GetDictionary("params", ¶ms_value)) |
| 458 params.additional_properties.Swap(params_value); | 459 params.additional_properties.Swap(params_value); |
| 459 | 460 |
| 460 scoped_ptr<base::ListValue> args( | 461 scoped_ptr<base::ListValue> args( |
| 461 OnEvent::Create(debuggee_, method_name, params)); | 462 OnEvent::Create(debuggee_, method_name, params)); |
| 462 scoped_ptr<Event> event(new Event(OnEvent::kEventName, args.Pass())); | 463 scoped_ptr<Event> event( |
| 464 new Event(events::UNKNOWN, OnEvent::kEventName, args.Pass())); |
| 463 event->restrict_to_browser_context = profile_; | 465 event->restrict_to_browser_context = profile_; |
| 464 EventRouter::Get(profile_) | 466 EventRouter::Get(profile_) |
| 465 ->DispatchEventToExtension(extension_id_, event.Pass()); | 467 ->DispatchEventToExtension(extension_id_, event.Pass()); |
| 466 } else { | 468 } else { |
| 467 DebuggerSendCommandFunction* function = pending_requests_[id].get(); | 469 DebuggerSendCommandFunction* function = pending_requests_[id].get(); |
| 468 if (!function) | 470 if (!function) |
| 469 return; | 471 return; |
| 470 | 472 |
| 471 function->SendResponseBody(dictionary); | 473 function->SendResponseBody(dictionary); |
| 472 pending_requests_.erase(id); | 474 pending_requests_.erase(id); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 const std::vector<DevToolsTargetImpl*>& target_list) { | 745 const std::vector<DevToolsTargetImpl*>& target_list) { |
| 744 scoped_ptr<base::ListValue> result(new base::ListValue()); | 746 scoped_ptr<base::ListValue> result(new base::ListValue()); |
| 745 for (size_t i = 0; i < target_list.size(); ++i) | 747 for (size_t i = 0; i < target_list.size(); ++i) |
| 746 result->Append(SerializeTarget(*target_list[i])); | 748 result->Append(SerializeTarget(*target_list[i])); |
| 747 STLDeleteContainerPointers(target_list.begin(), target_list.end()); | 749 STLDeleteContainerPointers(target_list.begin(), target_list.end()); |
| 748 SetResult(result.release()); | 750 SetResult(result.release()); |
| 749 SendResponse(true); | 751 SendResponse(true); |
| 750 } | 752 } |
| 751 | 753 |
| 752 } // namespace extensions | 754 } // namespace extensions |
| OLD | NEW |