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

Unified Diff: base/values.cc

Issue 647016: importer: use FilePath instead of wstring in some places (Closed)
Patch Set: with fixes Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/values.h ('k') | chrome/browser/importer/firefox_importer_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index 7e55739d8703992f5a6bf9ca5efb2b58a25c66d9..f78f4748d8bd0fcff9973bee460a99927228b789 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;
« no previous file with comments | « base/values.h ('k') | chrome/browser/importer/firefox_importer_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698