diff options
author | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-03 20:21:01 +0000 |
---|---|---|
committer | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-03 20:21:01 +0000 |
commit | 32c147158f76e19aa22efa2a7b14d3f0e1e23a02 (patch) | |
tree | a84b94bc6c2e4e52d009db317ed49a343658634c /chrome/browser/extensions/extension.cc | |
parent | 600a41fb05efe99eb2890e884a7af0541456c365 (diff) | |
download | chromium_src-32c147158f76e19aa22efa2a7b14d3f0e1e23a02.zip chromium_src-32c147158f76e19aa22efa2a7b14d3f0e1e23a02.tar.gz chromium_src-32c147158f76e19aa22efa2a7b14d3f0e1e23a02.tar.bz2 |
Port DictionaryValue to use string16 instead of wstring.
Review URL: http://codereview.chromium.org/31014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension.cc')
-rw-r--r-- | chrome/browser/extensions/extension.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/chrome/browser/extensions/extension.cc b/chrome/browser/extensions/extension.cc index 918268f..1db97ceb 100644 --- a/chrome/browser/extensions/extension.cc +++ b/chrome/browser/extensions/extension.cc @@ -163,14 +163,14 @@ bool Extension::InitFromValue(const DictionaryValue& source, std::string* error) { // Check format version. int format_version = 0; - if (!source.GetInteger(kFormatVersionKey, &format_version) || + if (!source.GetInteger(WideToUTF16Hack(kFormatVersionKey), &format_version) || static_cast<uint32>(format_version) != kExpectedFormatVersion) { *error = kInvalidFormatVersionError; return false; } // Initialize id. - if (!source.GetString(kIdKey, &id_)) { + if (!source.GetString(WideToUTF16Hack(kIdKey), &id_)) { *error = kInvalidIdError; return false; } @@ -193,7 +193,7 @@ bool Extension::InitFromValue(const DictionaryValue& source, // Initialize version. std::string version_str; - if (!source.GetString(kVersionKey, &version_str)) { + if (!source.GetString(WideToUTF16Hack(kVersionKey), &version_str)) { *error = kInvalidVersionError; return false; } @@ -204,14 +204,14 @@ bool Extension::InitFromValue(const DictionaryValue& source, } // Initialize name. - if (!source.GetString(kNameKey, &name_)) { + if (!source.GetString(WideToUTF16Hack(kNameKey), &name_)) { *error = kInvalidNameError; return false; } // Initialize description (optional). - if (source.HasKey(kDescriptionKey)) { - if (!source.GetString(kDescriptionKey, &description_)) { + if (source.HasKey(WideToUTF16Hack(kDescriptionKey))) { + if (!source.GetString(WideToUTF16Hack(kDescriptionKey), &description_)) { *error = kInvalidDescriptionError; return false; } @@ -220,17 +220,17 @@ bool Extension::InitFromValue(const DictionaryValue& source, // Initialize zip hash (only present in zip) // There's no need to verify it at this point. If it's in a bogus format // it won't pass the hash verify step. - if (source.HasKey(kZipHashKey)) { - if (!source.GetString(kZipHashKey, &zip_hash_)) { + if (source.HasKey(WideToUTF16Hack(kZipHashKey))) { + if (!source.GetString(WideToUTF16Hack(kZipHashKey), &zip_hash_)) { *error = kInvalidZipHashError; return false; } } // Initialize plugins dir (optional). - if (source.HasKey(kPluginsDirKey)) { + if (source.HasKey(WideToUTF16Hack(kPluginsDirKey))) { std::string plugins_dir; - if (!source.GetString(kPluginsDirKey, &plugins_dir)) { + if (!source.GetString(WideToUTF16Hack(kPluginsDirKey), &plugins_dir)) { *error = kInvalidPluginsDirError; return false; } @@ -238,9 +238,9 @@ bool Extension::InitFromValue(const DictionaryValue& source, } // Initialize content scripts (optional). - if (source.HasKey(kContentScriptsKey)) { + if (source.HasKey(WideToUTF16Hack(kContentScriptsKey))) { ListValue* list_value; - if (!source.GetList(kContentScriptsKey, &list_value)) { + if (!source.GetList(WideToUTF16Hack(kContentScriptsKey), &list_value)) { *error = kInvalidContentScriptsListError; return false; } @@ -255,12 +255,12 @@ bool Extension::InitFromValue(const DictionaryValue& source, ListValue* matches; ListValue* js; - if (!content_script->GetList(kMatchesKey, &matches)) { + if (!content_script->GetList(WideToUTF16Hack(kMatchesKey), &matches)) { *error = FormatErrorMessage(kInvalidMatchesError, IntToString(i)); return false; } - if (!content_script->GetList(kJsKey, &js)) { + if (!content_script->GetList(WideToUTF16Hack(kJsKey), &js)) { *error = FormatErrorMessage(kInvalidJsListError, IntToString(i)); return false; } @@ -277,9 +277,10 @@ bool Extension::InitFromValue(const DictionaryValue& source, } UserScript script; - if (content_script->HasKey(kRunAtKey)) { + if (content_script->HasKey(WideToUTF16Hack(kRunAtKey))) { std::string run_location; - if (!content_script->GetString(kRunAtKey, &run_location)) { + if (!content_script->GetString(WideToUTF16Hack(kRunAtKey), + &run_location)) { *error = FormatErrorMessage(kInvalidRunAtError, IntToString(i)); return false; } @@ -328,4 +329,3 @@ bool Extension::InitFromValue(const DictionaryValue& source, return true; } - |