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

Side by Side Diff: chrome/renderer/dom_ui_bindings.cc

Issue 316016: Move the json-related files into a separate json directory. This hopefully al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/renderer/dom_ui_bindings.h" 5 #include "chrome/renderer/dom_ui_bindings.h"
6 6
7 #include "base/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
11 11
12 DOMBoundBrowserObject::~DOMBoundBrowserObject() { 12 DOMBoundBrowserObject::~DOMBoundBrowserObject() {
13 STLDeleteContainerPointers(properties_.begin(), properties_.end()); 13 STLDeleteContainerPointers(properties_.begin(), properties_.end());
14 } 14 }
15 15
16 DOMUIBindings::DOMUIBindings() { 16 DOMUIBindings::DOMUIBindings() {
17 BindMethod("send", &DOMUIBindings::send); 17 BindMethod("send", &DOMUIBindings::send);
(...skipping 15 matching lines...) Expand all
33 if (args.size() == 2) { 33 if (args.size() == 2) {
34 if (!args[1].isObject()) 34 if (!args[1].isObject())
35 return; 35 return;
36 // TODO(evanm): we ought to support more than just sending arrays of 36 // TODO(evanm): we ought to support more than just sending arrays of
37 // strings, but it's not yet necessary for the current code. 37 // strings, but it's not yet necessary for the current code.
38 std::vector<std::wstring> strings = args[1].ToStringVector(); 38 std::vector<std::wstring> strings = args[1].ToStringVector();
39 ListValue value; 39 ListValue value;
40 for (size_t i = 0; i < strings.size(); ++i) { 40 for (size_t i = 0; i < strings.size(); ++i) {
41 value.Append(Value::CreateStringValue(strings[i])); 41 value.Append(Value::CreateStringValue(strings[i]));
42 } 42 }
43 JSONWriter::Write(&value, /* pretty_print= */ false, &content); 43 base::JSONWriter::Write(&value, /* pretty_print= */ false, &content);
44 } 44 }
45 45
46 // Send the message up to the browser. 46 // Send the message up to the browser.
47 sender()->Send( 47 sender()->Send(
48 new ViewHostMsg_DOMUISend(routing_id(), message, content)); 48 new ViewHostMsg_DOMUISend(routing_id(), message, content));
49 } 49 }
50 50
51 void DOMBoundBrowserObject::SetProperty(const std::string& name, 51 void DOMBoundBrowserObject::SetProperty(const std::string& name,
52 const std::string& value) { 52 const std::string& value) {
53 CppVariant* cpp_value = new CppVariant; 53 CppVariant* cpp_value = new CppVariant;
54 cpp_value->Set(value); 54 cpp_value->Set(value);
55 BindProperty(name, cpp_value); 55 BindProperty(name, cpp_value);
56 properties_.push_back(cpp_value); 56 properties_.push_back(cpp_value);
57 } 57 }
OLDNEW
« no previous file with comments | « chrome/common/web_resource/web_resource_unpacker.cc ('k') | chrome/renderer/extensions/extension_api_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698