summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_prefs.cc
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 19:47:47 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 19:47:47 +0000
commite7b418bc2ddad0832b849de9e9594745ee180d03 (patch)
tree16ad06a92cbfc71e1bc5a4e3254abcb54c40f3c3 /chrome/browser/extensions/extension_prefs.cc
parent813fd51fbd13972fb52b46ef7c1606be80af0fd4 (diff)
downloadchromium_src-e7b418bc2ddad0832b849de9e9594745ee180d03.zip
chromium_src-e7b418bc2ddad0832b849de9e9594745ee180d03.tar.gz
chromium_src-e7b418bc2ddad0832b849de9e9594745ee180d03.tar.bz2
Convert DictionaryValue's keys to std::string (from wstring).
Everything now needs to be changed to avoid the deprecated wstring methods; this includes the unit tests. BUG=23581 TEST=all our tests still pass Review URL: http://codereview.chromium.org/3075010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_prefs.cc')
-rw-r--r--chrome/browser/extensions/extension_prefs.cc29
1 files changed, 13 insertions, 16 deletions
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index 4006120..8380543 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -82,16 +82,16 @@ namespace {
// and http://crbug.com/39745 for more details).
static void CleanupBadExtensionKeys(PrefService* prefs) {
DictionaryValue* dictionary = prefs->GetMutableDictionary(kExtensionsPref);
- std::set<std::wstring> bad_keys;
+ std::set<std::string> bad_keys;
for (DictionaryValue::key_iterator i = dictionary->begin_keys();
i != dictionary->end_keys(); ++i) {
- const std::wstring key_name = *i;
- if (!Extension::IdIsValid(WideToASCII(key_name))) {
+ const std::string& key_name(*i);
+ if (!Extension::IdIsValid(key_name)) {
bad_keys.insert(key_name);
}
}
bool dirty = false;
- for (std::set<std::wstring>::iterator i = bad_keys.begin();
+ for (std::set<std::string>::iterator i = bad_keys.begin();
i != bad_keys.end(); ++i) {
dirty = true;
dictionary->Remove(*i, NULL);
@@ -259,7 +259,7 @@ void ExtensionPrefs::UpdateBlacklist(
NOTREACHED() << "Invalid pref for extension " << *extension_id;
continue;
}
- std::string id = WideToASCII(*extension_id);
+ const std::string& id(*extension_id);
if (blacklist_set.find(id) == blacklist_set.end()) {
if (!IsBlacklistBitSet(ext)) {
// This extension is not in blacklist. And it was not blacklisted
@@ -373,10 +373,9 @@ void ExtensionPrefs::GetKilledExtensionIds(std::set<std::string>* killed_ids) {
for (DictionaryValue::key_iterator i = dict->begin_keys();
i != dict->end_keys(); ++i) {
- std::wstring key_name = *i;
- if (!Extension::IdIsValid(WideToASCII(key_name))) {
- LOG(WARNING) << "Invalid external extension ID encountered: "
- << WideToASCII(key_name);
+ const std::string& key_name(*i);
+ if (!Extension::IdIsValid(key_name)) {
+ LOG(WARNING) << "Invalid external extension ID encountered: " << key_name;
continue;
}
@@ -390,8 +389,7 @@ void ExtensionPrefs::GetKilledExtensionIds(std::set<std::string>* killed_ids) {
int state;
if (extension->GetInteger(kPrefState, &state) &&
state == static_cast<int>(Extension::KILLBIT)) {
- StringToLowerASCII(&key_name);
- killed_ids->insert(WideToASCII(key_name));
+ killed_ids->insert(StringToLowerASCII(key_name));
}
}
}
@@ -643,8 +641,7 @@ static ExtensionInfo* GetInstalledExtensionInfoImpl(
// Just a warning for now.
}
- return new ExtensionInfo(manifest, WideToASCII(*extension_id),
- FilePath(path), location);
+ return new ExtensionInfo(manifest, *extension_id, FilePath(path), location);
}
ExtensionPrefs::ExtensionsInfo* ExtensionPrefs::GetInstalledExtensionsInfo() {
@@ -655,7 +652,7 @@ ExtensionPrefs::ExtensionsInfo* ExtensionPrefs::GetInstalledExtensionsInfo() {
for (DictionaryValue::key_iterator extension_id(
extension_data->begin_keys());
extension_id != extension_data->end_keys(); ++extension_id) {
- if (!Extension::IdIsValid(WideToASCII(*extension_id)))
+ if (!Extension::IdIsValid(*extension_id))
continue;
ExtensionInfo* info = GetInstalledExtensionInfoImpl(extension_data.get(),
@@ -674,7 +671,7 @@ ExtensionInfo* ExtensionPrefs::GetInstalledExtensionInfo(
for (DictionaryValue::key_iterator extension_iter(
extension_data->begin_keys());
extension_iter != extension_data->end_keys(); ++extension_iter) {
- if (WideToASCII(*extension_iter) == extension_id) {
+ if (*extension_iter == extension_id) {
return GetInstalledExtensionInfoImpl(extension_data.get(),
extension_iter);
}
@@ -762,7 +759,7 @@ std::set<std::string> ExtensionPrefs::GetIdleInstallInfoIds() {
for (DictionaryValue::key_iterator iter = extensions->begin_keys();
iter != extensions->end_keys(); ++iter) {
- std::string id = WideToASCII(*iter);
+ const std::string& id(*iter);
if (!Extension::IdIsValid(id)) {
NOTREACHED();
continue;