Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: chrome/browser/extensions/api/debugger/debugger_api.cc

Issue 10796114: Added ToJson to JSON schema compiler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed scope Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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", &params_value)) 307 if (dictionary->GetDictionary("params", &params_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
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 }
OLDNEW
« no previous file with comments | « no previous file | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698