Chromium Code Reviews| 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 scoped_ptr<std::string> json_args(OnDetach::ToJson(debuggee)); |
|
not at google - send to devlin
2012/07/24 23:04:29
just return string
mitchellwrosen
2012/07/25 17:08:20
Done.
| |
| 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) { |
| 271 std::string id = | 268 std::string id = |
| 272 content::Details<extensions::UnloadedExtensionInfo>(details)-> | 269 content::Details<extensions::UnloadedExtensionInfo>(details)-> |
| (...skipping 30 matching lines...) Expand all 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 scoped_ptr<std::string> json_args(OnEvent::ToJson(debuggee, method_name, |
| 314 std::string json_args; | 311 params)); |
|
not at google - send to devlin
2012/07/24 23:04:29
nit: argument should be on same line or line up ve
mitchellwrosen
2012/07/25 17:08:20
Oh, I've seen it both ways. I thought the style gu
| |
| 315 base::JSONWriter::Write(args.get(), &json_args); | |
| 316 | 312 |
| 317 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 313 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| 318 extension_id_, keys::kOnEvent, json_args, profile, GURL()); | 314 extension_id_, keys::kOnEvent, *json_args, profile, GURL()); |
| 319 } else { | 315 } else { |
| 320 SendCommandDebuggerFunction* function = pending_requests_[id]; | 316 SendCommandDebuggerFunction* function = pending_requests_[id]; |
| 321 if (!function) | 317 if (!function) |
| 322 return; | 318 return; |
| 323 | 319 |
| 324 function->SendResponseBody(dictionary); | 320 function->SendResponseBody(dictionary); |
| 325 pending_requests_.erase(id); | 321 pending_requests_.erase(id); |
| 326 } | 322 } |
| 327 } | 323 } |
| 328 | 324 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 } | 483 } |
| 488 | 484 |
| 489 DictionaryValue* result_body; | 485 DictionaryValue* result_body; |
| 490 SendCommand::Results::Result result; | 486 SendCommand::Results::Result result; |
| 491 if (response->GetDictionary("result", &result_body)) | 487 if (response->GetDictionary("result", &result_body)) |
| 492 result.additional_properties.Swap(result_body); | 488 result.additional_properties.Swap(result_body); |
| 493 | 489 |
| 494 results_ = SendCommand::Results::Create(result); | 490 results_ = SendCommand::Results::Create(result); |
| 495 SendResponse(true); | 491 SendResponse(true); |
| 496 } | 492 } |
| OLD | NEW |