| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 DevToolsManager::GetInstance()->DispatchOnInspectorBackend(this, json_args); | 247 DevToolsManager::GetInstance()->DispatchOnInspectorBackend(this, json_args); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void ExtensionDevToolsClientHost::SendDetachedEvent() { | 250 void ExtensionDevToolsClientHost::SendDetachedEvent() { |
| 251 Profile* profile = | 251 Profile* profile = |
| 252 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 252 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 253 if (profile != NULL && profile->GetExtensionEventRouter()) { | 253 if (profile != NULL && profile->GetExtensionEventRouter()) { |
| 254 Debuggee debuggee; | 254 Debuggee debuggee; |
| 255 debuggee.tab_id = tab_id_; | 255 debuggee.tab_id = tab_id_; |
| 256 | 256 |
| 257 scoped_ptr<base::ListValue> args(OnDetach::Create(debuggee)); | 257 std::string json_args = OnDetach::ToJson(debuggee); |
| 258 std::string json_args; | |
| 259 base::JSONWriter::Write(args.get(), &json_args); | |
| 260 | |
| 261 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 258 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| 262 extension_id_, keys::kOnDetach, json_args, profile, GURL()); | 259 extension_id_, keys::kOnDetach, json_args, profile, GURL()); |
| 263 } | 260 } |
| 264 } | 261 } |
| 265 | 262 |
| 266 void ExtensionDevToolsClientHost::Observe( | 263 void ExtensionDevToolsClientHost::Observe( |
| 267 int type, | 264 int type, |
| 268 const content::NotificationSource& source, | 265 const content::NotificationSource& source, |
| 269 const content::NotificationDetails& details) { | 266 const content::NotificationDetails& details) { |
| 270 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 267 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return; | 300 return; |
| 304 | 301 |
| 305 Debuggee debuggee; | 302 Debuggee debuggee; |
| 306 debuggee.tab_id = tab_id_; | 303 debuggee.tab_id = tab_id_; |
| 307 | 304 |
| 308 OnEvent::Params params; | 305 OnEvent::Params params; |
| 309 DictionaryValue* params_value; | 306 DictionaryValue* params_value; |
| 310 if (dictionary->GetDictionary("params", ¶ms_value)) | 307 if (dictionary->GetDictionary("params", ¶ms_value)) |
| 311 params.additional_properties.Swap(params_value); | 308 params.additional_properties.Swap(params_value); |
| 312 | 309 |
| 313 scoped_ptr<ListValue> args(OnEvent::Create(debuggee, method_name, params)); | 310 std::string json_args = OnEvent::ToJson(debuggee, method_name, params); |
| 314 std::string json_args; | |
| 315 base::JSONWriter::Write(args.get(), &json_args); | |
| 316 | 311 |
| 317 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 312 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| 318 extension_id_, keys::kOnEvent, json_args, profile, GURL()); | 313 extension_id_, keys::kOnEvent, json_args, profile, GURL()); |
| 319 } else { | 314 } else { |
| 320 SendCommandDebuggerFunction* function = pending_requests_[id]; | 315 SendCommandDebuggerFunction* function = pending_requests_[id]; |
| 321 if (!function) | 316 if (!function) |
| 322 return; | 317 return; |
| 323 | 318 |
| 324 function->SendResponseBody(dictionary); | 319 function->SendResponseBody(dictionary); |
| 325 pending_requests_.erase(id); | 320 pending_requests_.erase(id); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 482 } |
| 488 | 483 |
| 489 DictionaryValue* result_body; | 484 DictionaryValue* result_body; |
| 490 SendCommand::Results::Result result; | 485 SendCommand::Results::Result result; |
| 491 if (response->GetDictionary("result", &result_body)) | 486 if (response->GetDictionary("result", &result_body)) |
| 492 result.additional_properties.Swap(result_body); | 487 result.additional_properties.Swap(result_body); |
| 493 | 488 |
| 494 results_ = SendCommand::Results::Create(result); | 489 results_ = SendCommand::Results::Create(result); |
| 495 SendResponse(true); | 490 SendResponse(true); |
| 496 } | 491 } |
| OLD | NEW |