summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-19 00:55:22 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-19 00:55:22 +0000
commitff122619c7259df74ccf792d7c3d9a1e433c4ce7 (patch)
treeab57a330cb5aa584130aa4c29df7d810baddce57 /chrome/browser/dom_ui
parente0ff76cbf4da96d50306e3a4ef9bf6bef0ecd399 (diff)
downloadchromium_src-ff122619c7259df74ccf792d7c3d9a1e433c4ce7.zip
chromium_src-ff122619c7259df74ccf792d7c3d9a1e433c4ce7.tar.gz
chromium_src-ff122619c7259df74ccf792d7c3d9a1e433c4ce7.tar.bz2
DOMUI - Simplify DOMMessageHandler::Extract{Integer,String}Value.
BUG=None TEST=None Review URL: http://codereview.chromium.org/2074011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc26
1 files changed, 5 insertions, 21 deletions
diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc
index 1d6b5b5..976c1dc 100644
--- a/chrome/browser/dom_ui/dom_ui.cc
+++ b/chrome/browser/dom_ui/dom_ui.cc
@@ -146,37 +146,21 @@ void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary,
bool DOMMessageHandler::ExtractIntegerValue(const Value* value, int* out_int) {
if (value && value->GetType() == Value::TYPE_LIST) {
const ListValue* list_value = static_cast<const ListValue*>(value);
- Value* list_member;
-
- // Get id.
- if (list_value->Get(0, &list_member) &&
- list_member->GetType() == Value::TYPE_STRING) {
- const StringValue* string_value =
- static_cast<const StringValue*>(list_member);
- std::wstring wstring_value;
- string_value->GetAsString(&wstring_value);
- *out_int = StringToInt(WideToUTF16Hack(wstring_value));
+ std::string string_value;
+ if (list_value->GetString(0, &string_value)) {
+ *out_int = StringToInt(string_value);
return true;
}
}
-
return false;
}
std::wstring DOMMessageHandler::ExtractStringValue(const Value* value) {
if (value && value->GetType() == Value::TYPE_LIST) {
const ListValue* list_value = static_cast<const ListValue*>(value);
- Value* list_member;
-
- // Get id.
- if (list_value->Get(0, &list_member) &&
- list_member->GetType() == Value::TYPE_STRING) {
- const StringValue* string_value =
- static_cast<const StringValue*>(list_member);
- std::wstring wstring_value;
- string_value->GetAsString(&wstring_value);
+ std::wstring wstring_value;
+ if (list_value->GetString(0, &wstring_value))
return wstring_value;
- }
}
return std::wstring();
}