summaryrefslogtreecommitdiffstats
path: root/base/values.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 13:32:16 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 13:32:16 +0000
commit9430e4bae7a8faa17b353f66ed572b72cf393c05 (patch)
treef19b02c0477d30aaf70203872739607afec657a2 /base/values.cc
parent76b24b56f8c5d78bc5c32fbdd81102ba9ed82dcb (diff)
downloadchromium_src-9430e4bae7a8faa17b353f66ed572b72cf393c05.zip
chromium_src-9430e4bae7a8faa17b353f66ed572b72cf393c05.tar.gz
chromium_src-9430e4bae7a8faa17b353f66ed572b72cf393c05.tar.bz2
importer: use FilePath instead of wstring in some places
Added API to DictionaryValue to use ASCII where appropriate. BUG=24672 TEST=profile import still got my bookmarks Review URL: http://codereview.chromium.org/647016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/values.cc')
-rw-r--r--base/values.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/base/values.cc b/base/values.cc
index 7e55739..f78f474 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -354,6 +354,10 @@ bool DictionaryValue::HasKey(const std::wstring& key) const {
return current_entry != dictionary_.end();
}
+bool DictionaryValue::HasKeyASCII(const std::string& key) const {
+ return HasKey(ASCIIToWide(key));
+}
+
void DictionaryValue::Clear() {
ValueMap::iterator dict_iterator = dictionary_.begin();
while (dict_iterator != dictionary_.end()) {
@@ -471,6 +475,26 @@ bool DictionaryValue::GetReal(const std::wstring& path,
return value->GetAsReal(out_value);
}
+bool DictionaryValue::GetString(const std::string& path,
+ string16* out_value) const {
+ return GetStringAsUTF16(ASCIIToWide(path), out_value);
+}
+
+bool DictionaryValue::GetStringASCII(const std::string& path,
+ std::string* out_value) const {
+ std::string out;
+ if (!GetString(ASCIIToWide(path), &out))
+ return false;
+
+ if (!IsStringASCII(out)) {
+ NOTREACHED();
+ return false;
+ }
+
+ out_value->assign(out);
+ return true;
+}
+
bool DictionaryValue::GetString(const std::wstring& path,
std::string* out_value) const {
Value* value;