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

Side by Side Diff: chrome/browser/dom_ui/dom_ui.cc

Issue 28281: Get rid of wstring variants of StringToFoo. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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/browser/dom_ui/dom_ui.h" 5 #include "chrome/browser/dom_ui/dom_ui.h"
6 6
7 #include "base/json_reader.h" 7 #include "base/json_reader.h"
8 #include "base/json_writer.h" 8 #include "base/json_writer.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const ListValue* list_value = static_cast<const ListValue*>(value); 141 const ListValue* list_value = static_cast<const ListValue*>(value);
142 Value* list_member; 142 Value* list_member;
143 143
144 // Get id. 144 // Get id.
145 if (list_value->Get(0, &list_member) && 145 if (list_value->Get(0, &list_member) &&
146 list_member->GetType() == Value::TYPE_STRING) { 146 list_member->GetType() == Value::TYPE_STRING) {
147 const StringValue* string_value = 147 const StringValue* string_value =
148 static_cast<const StringValue*>(list_member); 148 static_cast<const StringValue*>(list_member);
149 std::wstring wstring_value; 149 std::wstring wstring_value;
150 string_value->GetAsString(&wstring_value); 150 string_value->GetAsString(&wstring_value);
151 *out_int = StringToInt(wstring_value); 151 *out_int = StringToInt(WideToUTF16Hack(wstring_value));
152 return true; 152 return true;
153 } 153 }
154 } 154 }
155 155
156 return false; 156 return false;
157 } 157 }
158 158
159 std::wstring DOMMessageHandler::ExtractStringValue(const Value* value) { 159 std::wstring DOMMessageHandler::ExtractStringValue(const Value* value) {
160 if (value && value->GetType() == Value::TYPE_LIST) { 160 if (value && value->GetType() == Value::TYPE_LIST) {
161 const ListValue* list_value = static_cast<const ListValue*>(value); 161 const ListValue* list_value = static_cast<const ListValue*>(value);
162 Value* list_member; 162 Value* list_member;
163 163
164 // Get id. 164 // Get id.
165 if (list_value->Get(0, &list_member) && 165 if (list_value->Get(0, &list_member) &&
166 list_member->GetType() == Value::TYPE_STRING) { 166 list_member->GetType() == Value::TYPE_STRING) {
167 const StringValue* string_value = 167 const StringValue* string_value =
168 static_cast<const StringValue*>(list_member); 168 static_cast<const StringValue*>(list_member);
169 std::wstring wstring_value; 169 std::wstring wstring_value;
170 string_value->GetAsString(&wstring_value); 170 string_value->GetAsString(&wstring_value);
171 return wstring_value; 171 return wstring_value;
172 } 172 }
173 } 173 }
174 return std::wstring(); 174 return std::wstring();
175 } 175 }
176
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698