diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-30 19:47:47 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-30 19:47:47 +0000 |
commit | e7b418bc2ddad0832b849de9e9594745ee180d03 (patch) | |
tree | 16ad06a92cbfc71e1bc5a4e3254abcb54c40f3c3 /base/json | |
parent | 813fd51fbd13972fb52b46ef7c1606be80af0fd4 (diff) | |
download | chromium_src-e7b418bc2ddad0832b849de9e9594745ee180d03.zip chromium_src-e7b418bc2ddad0832b849de9e9594745ee180d03.tar.gz chromium_src-e7b418bc2ddad0832b849de9e9594745ee180d03.tar.bz2 |
Convert DictionaryValue's keys to std::string (from wstring).
Everything now needs to be changed to avoid the deprecated wstring methods; this
includes the unit tests.
BUG=23581
TEST=all our tests still pass
Review URL: http://codereview.chromium.org/3075010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/json')
-rw-r--r-- | base/json/json_writer.cc | 8 | ||||
-rw-r--r-- | base/json/json_writer.h | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/base/json/json_writer.cc b/base/json/json_writer.cc index fa43953..dbf43ec 100644 --- a/base/json/json_writer.cc +++ b/base/json/json_writer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -188,8 +188,10 @@ void JSONWriter::BuildJSONString(const Value* const node, } } -void JSONWriter::AppendQuotedString(const std::wstring& str) { - JsonDoubleQuote(WideToUTF16Hack(str), true, json_string_); +void JSONWriter::AppendQuotedString(const std::string& str) { + // TODO(viettrungluu): |str| is UTF-8, not ASCII, so to properly escape it we + // have to convert it to UTF-16. This round-trip is suboptimal. + JsonDoubleQuote(UTF8ToUTF16(str), true, json_string_); } void JSONWriter::IndentLine(int depth) { diff --git a/base/json/json_writer.h b/base/json/json_writer.h index db24718..eb17145 100644 --- a/base/json/json_writer.h +++ b/base/json/json_writer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -45,8 +45,8 @@ class JSONWriter { // json_string_ will contain the JSON. void BuildJSONString(const Value* const node, int depth, bool escape); - // Appends a quoted, escaped, version of str to json_string_. - void AppendQuotedString(const std::wstring& str); + // Appends a quoted, escaped, version of (UTF-8) str to json_string_. + void AppendQuotedString(const std::string& str); // Adds space to json_string_ for the indent level. void IndentLine(int depth); |