| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 276 |
| 277 void ExtensionDevToolsClientHost::SendDetachedEvent() { | 277 void ExtensionDevToolsClientHost::SendDetachedEvent() { |
| 278 Profile* profile = | 278 Profile* profile = |
| 279 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 279 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 280 if (profile != NULL && | 280 if (profile != NULL && |
| 281 extensions::ExtensionSystem::Get(profile)->event_router()) { | 281 extensions::ExtensionSystem::Get(profile)->event_router()) { |
| 282 Debuggee debuggee; | 282 Debuggee debuggee; |
| 283 debuggee.tab_id = tab_id_; | 283 debuggee.tab_id = tab_id_; |
| 284 scoped_ptr<base::ListValue> args(OnDetach::Create(debuggee, | 284 scoped_ptr<base::ListValue> args(OnDetach::Create(debuggee, |
| 285 detach_reason_)); | 285 detach_reason_)); |
| 286 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 287 keys::kOnDetach, args.Pass())); |
| 288 event->restrict_to_profile = profile; |
| 286 extensions::ExtensionSystem::Get(profile)->event_router()-> | 289 extensions::ExtensionSystem::Get(profile)->event_router()-> |
| 287 DispatchEventToExtension(extension_id_, keys::kOnDetach, args.Pass(), | 290 DispatchEventToExtension(extension_id_, event.Pass()); |
| 288 profile, GURL()); | |
| 289 } | 291 } |
| 290 } | 292 } |
| 291 | 293 |
| 292 void ExtensionDevToolsClientHost::Observe( | 294 void ExtensionDevToolsClientHost::Observe( |
| 293 int type, | 295 int type, |
| 294 const content::NotificationSource& source, | 296 const content::NotificationSource& source, |
| 295 const content::NotificationDetails& details) { | 297 const content::NotificationDetails& details) { |
| 296 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 298 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
| 297 std::string id = | 299 std::string id = |
| 298 content::Details<extensions::UnloadedExtensionInfo>(details)-> | 300 content::Details<extensions::UnloadedExtensionInfo>(details)-> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 333 |
| 332 Debuggee debuggee; | 334 Debuggee debuggee; |
| 333 debuggee.tab_id = tab_id_; | 335 debuggee.tab_id = tab_id_; |
| 334 | 336 |
| 335 OnEvent::Params params; | 337 OnEvent::Params params; |
| 336 DictionaryValue* params_value; | 338 DictionaryValue* params_value; |
| 337 if (dictionary->GetDictionary("params", ¶ms_value)) | 339 if (dictionary->GetDictionary("params", ¶ms_value)) |
| 338 params.additional_properties.Swap(params_value); | 340 params.additional_properties.Swap(params_value); |
| 339 | 341 |
| 340 scoped_ptr<ListValue> args(OnEvent::Create(debuggee, method_name, params)); | 342 scoped_ptr<ListValue> args(OnEvent::Create(debuggee, method_name, params)); |
| 343 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 344 keys::kOnEvent, args.Pass())); |
| 345 event->restrict_to_profile = profile; |
| 341 extensions::ExtensionSystem::Get(profile)->event_router()-> | 346 extensions::ExtensionSystem::Get(profile)->event_router()-> |
| 342 DispatchEventToExtension(extension_id_, keys::kOnEvent, args.Pass(), | 347 DispatchEventToExtension(extension_id_, event.Pass()); |
| 343 profile, GURL()); | |
| 344 } else { | 348 } else { |
| 345 SendCommandDebuggerFunction* function = pending_requests_[id]; | 349 SendCommandDebuggerFunction* function = pending_requests_[id]; |
| 346 if (!function) | 350 if (!function) |
| 347 return; | 351 return; |
| 348 | 352 |
| 349 function->SendResponseBody(dictionary); | 353 function->SendResponseBody(dictionary); |
| 350 pending_requests_.erase(id); | 354 pending_requests_.erase(id); |
| 351 } | 355 } |
| 352 } | 356 } |
| 353 | 357 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 } | 533 } |
| 530 | 534 |
| 531 DictionaryValue* result_body; | 535 DictionaryValue* result_body; |
| 532 SendCommand::Results::Result result; | 536 SendCommand::Results::Result result; |
| 533 if (response->GetDictionary("result", &result_body)) | 537 if (response->GetDictionary("result", &result_body)) |
| 534 result.additional_properties.Swap(result_body); | 538 result.additional_properties.Swap(result_body); |
| 535 | 539 |
| 536 results_ = SendCommand::Results::Create(result); | 540 results_ = SendCommand::Results::Create(result); |
| 537 SendResponse(true); | 541 SendResponse(true); |
| 538 } | 542 } |
| OLD | NEW |