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 std::string json_args = OnDetach::ToJson(debuggee); | 257 scoped_ptr<base::ListValue> args(OnDetach::Create(debuggee)); |
258 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 258 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
259 extension_id_, keys::kOnDetach, json_args, profile, GURL()); | 259 extension_id_, keys::kOnDetach, args.Pass(), profile, GURL()); |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 void ExtensionDevToolsClientHost::Observe( | 263 void ExtensionDevToolsClientHost::Observe( |
264 int type, | 264 int type, |
265 const content::NotificationSource& source, | 265 const content::NotificationSource& source, |
266 const content::NotificationDetails& details) { | 266 const content::NotificationDetails& details) { |
267 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 267 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
268 std::string id = | 268 std::string id = |
269 content::Details<extensions::UnloadedExtensionInfo>(details)-> | 269 content::Details<extensions::UnloadedExtensionInfo>(details)-> |
(...skipping 30 matching lines...) Expand all Loading... |
300 return; | 300 return; |
301 | 301 |
302 Debuggee debuggee; | 302 Debuggee debuggee; |
303 debuggee.tab_id = tab_id_; | 303 debuggee.tab_id = tab_id_; |
304 | 304 |
305 OnEvent::Params params; | 305 OnEvent::Params params; |
306 DictionaryValue* params_value; | 306 DictionaryValue* params_value; |
307 if (dictionary->GetDictionary("params", ¶ms_value)) | 307 if (dictionary->GetDictionary("params", ¶ms_value)) |
308 params.additional_properties.Swap(params_value); | 308 params.additional_properties.Swap(params_value); |
309 | 309 |
310 std::string json_args = OnEvent::ToJson(debuggee, method_name, params); | 310 scoped_ptr<ListValue> args(OnEvent::Create(debuggee, method_name, params)); |
311 | |
312 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 311 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
313 extension_id_, keys::kOnEvent, json_args, profile, GURL()); | 312 extension_id_, keys::kOnEvent, args.Pass(), profile, GURL()); |
314 } else { | 313 } else { |
315 SendCommandDebuggerFunction* function = pending_requests_[id]; | 314 SendCommandDebuggerFunction* function = pending_requests_[id]; |
316 if (!function) | 315 if (!function) |
317 return; | 316 return; |
318 | 317 |
319 function->SendResponseBody(dictionary); | 318 function->SendResponseBody(dictionary); |
320 pending_requests_.erase(id); | 319 pending_requests_.erase(id); |
321 } | 320 } |
322 } | 321 } |
323 | 322 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 } | 481 } |
483 | 482 |
484 DictionaryValue* result_body; | 483 DictionaryValue* result_body; |
485 SendCommand::Results::Result result; | 484 SendCommand::Results::Result result; |
486 if (response->GetDictionary("result", &result_body)) | 485 if (response->GetDictionary("result", &result_body)) |
487 result.additional_properties.Swap(result_body); | 486 result.additional_properties.Swap(result_body); |
488 | 487 |
489 results_ = SendCommand::Results::Create(result); | 488 results_ = SendCommand::Results::Create(result); |
490 SendResponse(true); | 489 SendResponse(true); |
491 } | 490 } |
OLD | NEW |