diff options
Diffstat (limited to 'chrome')
20 files changed, 85 insertions, 82 deletions
diff --git a/chrome/browser/background_contents_service.cc b/chrome/browser/background_contents_service.cc index c10d9d2..654a0a1 100644 --- a/chrome/browser/background_contents_service.cc +++ b/chrome/browser/background_contents_service.cc @@ -151,7 +151,7 @@ void BackgroundContentsService::LoadBackgroundContentsFromPrefs( CreateBackgroundContents(profile, GURL(url), frame_name, - WideToUTF16(*it)); + UTF8ToUTF16(*it)); } } diff --git a/chrome/browser/browser_theme_pack.cc b/chrome/browser/browser_theme_pack.cc index 943b1e8..8d2fe89 100644 --- a/chrome/browser/browser_theme_pack.cc +++ b/chrome/browser/browser_theme_pack.cc @@ -618,7 +618,7 @@ void BrowserThemePack::BuildTintsFromJSON(DictionaryValue* tints_value) { if (ValidRealValue(tint_list, 0, &hsl.h) && ValidRealValue(tint_list, 1, &hsl.s) && ValidRealValue(tint_list, 2, &hsl.l)) { - int id = GetIntForString(WideToUTF8(*iter), kTintTable); + int id = GetIntForString(*iter, kTintTable); if (id != -1) { temp_tints[id] = hsl; } @@ -689,7 +689,7 @@ void BrowserThemePack::ReadColorsFromJSON( color = SkColorSetRGB(r, g, b); } - int id = GetIntForString(WideToUTF8(*iter), kColorTable); + int id = GetIntForString(*iter, kColorTable); if (id != -1) { (*temp_colors)[id] = color; } @@ -769,7 +769,7 @@ void BrowserThemePack::BuildDisplayPropertiesFromJSON( for (DictionaryValue::key_iterator iter( display_properties_value->begin_keys()); iter != display_properties_value->end_keys(); ++iter) { - int property_id = GetIntForString(WideToUTF8(*iter), kDisplayProperties); + int property_id = GetIntForString(*iter, kDisplayProperties); switch (property_id) { case BrowserThemeProvider::NTP_BACKGROUND_ALIGNMENT: { std::string val; @@ -817,7 +817,7 @@ void BrowserThemePack::ParseImageNamesFromJSON( iter != images_value->end_keys(); ++iter) { std::string val; if (images_value->GetString(*iter, &val)) { - int id = GetPersistentIDByName(WideToUTF8(*iter)); + int id = GetPersistentIDByName(*iter); if (id != -1) (*file_paths)[id] = images_path.AppendASCII(val); } 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; diff --git a/chrome/browser/extensions/external_pref_extension_provider.cc b/chrome/browser/extensions/external_pref_extension_provider.cc index 5fe39b4..a7c99ff 100644 --- a/chrome/browser/extensions/external_pref_extension_provider.cc +++ b/chrome/browser/extensions/external_pref_extension_provider.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,8 +44,8 @@ void ExternalPrefExtensionProvider::VisitRegisteredExtension( Visitor* visitor, const std::set<std::string>& ids_to_ignore) const { for (DictionaryValue::key_iterator i = prefs_->begin_keys(); i != prefs_->end_keys(); ++i) { - const std::wstring& extension_id = *i; - if (ids_to_ignore.find(WideToASCII(extension_id)) != ids_to_ignore.end()) + const std::string& extension_id = *i; + if (ids_to_ignore.find(extension_id) != ids_to_ignore.end()) continue; DictionaryValue* extension; @@ -79,8 +79,8 @@ void ExternalPrefExtensionProvider::VisitRegisteredExtension( scoped_ptr<Version> version; version.reset(Version::GetVersionFromString(external_version)); - visitor->OnExternalExtensionFound(WideToASCII(extension_id), version.get(), - path, Extension::EXTERNAL_PREF); + visitor->OnExternalExtensionFound(extension_id, version.get(), path, + Extension::EXTERNAL_PREF); } } diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index a564d11..de3a8a6 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,6 +12,7 @@ #include "base/message_loop.h" #include "base/scoped_handle.h" #include "base/task.h" +#include "base/utf_string_conversions.h" // TODO(viettrungluu): delete me. #include "chrome/browser/chrome_thread.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" @@ -381,7 +382,9 @@ bool SandboxedExtensionUnpacker::RewriteCatalogFiles() { return false; } - FilePath relative_path = FilePath::FromWStringHack(*key_it); + // TODO(viettrungluu): Fix the |FilePath::FromWStringHack(UTF8ToWide())| + // hack and remove the corresponding #include. + FilePath relative_path = FilePath::FromWStringHack(UTF8ToWide(*key_it)); relative_path = relative_path.Append(Extension::kMessagesFilename); if (relative_path.IsAbsolute() || relative_path.ReferencesParent()) { ReportFailure("Invalid path for catalog."); diff --git a/chrome/browser/geolocation/access_token_store.cc b/chrome/browser/geolocation/access_token_store.cc index b0d2d5e..f790c51 100644 --- a/chrome/browser/geolocation/access_token_store.cc +++ b/chrome/browser/geolocation/access_token_store.cc @@ -47,7 +47,7 @@ void ChromePrefsAccessTokenStore::LoadDictionaryStoreInUIThread( if (token_dictionary != NULL) { for (DictionaryValue::key_iterator it = token_dictionary->begin_keys(); it != token_dictionary->end_keys(); ++it) { - GURL url(WideToUTF8(*it)); + GURL url(*it); if (!url.is_valid()) continue; token_dictionary->GetStringAsUTF16WithoutPathExpansion( diff --git a/chrome/browser/geolocation/geolocation_content_settings_map.cc b/chrome/browser/geolocation/geolocation_content_settings_map.cc index 2723870..77fb103 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map.cc +++ b/chrome/browser/geolocation/geolocation_content_settings_map.cc @@ -92,13 +92,13 @@ GeolocationContentSettingsMap::AllOriginsSettings if (all_settings_dictionary != NULL) { for (DictionaryValue::key_iterator i(all_settings_dictionary->begin_keys()); i != all_settings_dictionary->end_keys(); ++i) { - const std::wstring& wide_origin(*i); - GURL origin_as_url(WideToUTF8(wide_origin)); + const std::string& origin(*i); + GURL origin_as_url(origin); if (!origin_as_url.is_valid()) continue; DictionaryValue* requesting_origin_settings_dictionary = NULL; bool found = all_settings_dictionary->GetDictionaryWithoutPathExpansion( - wide_origin, &requesting_origin_settings_dictionary); + origin, &requesting_origin_settings_dictionary); DCHECK(found); if (!requesting_origin_settings_dictionary) continue; @@ -177,11 +177,11 @@ void GeolocationContentSettingsMap::GetOneOriginSettingsFromDictionary( OneOriginSettings* one_origin_settings) { for (DictionaryValue::key_iterator i(dictionary->begin_keys()); i != dictionary->end_keys(); ++i) { - const std::wstring& target(*i); + const std::string& target(*i); int setting = kDefaultSetting; bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting); DCHECK(found); - GURL target_url(WideToUTF8(target)); + GURL target_url(target); // An empty URL has a special meaning (wildcard), so only accept invalid // URLs if the original version was empty (avoids treating corrupted prefs // as the wildcard entry; see http://crbug.com/39685) diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc index 324f207..2e4fbb0 100644 --- a/chrome/browser/history/top_sites.cc +++ b/chrome/browser/history/top_sites.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -730,7 +730,7 @@ bool TopSites::GetPinnedURLAtIndex(size_t index, GURL* url) { int current_index; if (pinned_urls_->GetIntegerWithoutPathExpansion(*it, ¤t_index)) { if (static_cast<size_t>(current_index) == index) { - *url = GURL(WideToASCII(*it)); + *url = GURL(*it); return true; } } diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc index f09ac13..ce53c2d 100644 --- a/chrome/browser/host_content_settings_map.cc +++ b/chrome/browser/host_content_settings_map.cc @@ -152,11 +152,11 @@ HostContentSettingsMap::HostContentSettingsMap(Profile* profile) prefs->GetDictionary(prefs::kPerHostContentSettings); for (DictionaryValue::key_iterator i(all_settings_dictionary->begin_keys()); i != all_settings_dictionary->end_keys(); ++i) { - std::wstring wide_host(*i); - Pattern pattern(std::string(kDomainWildcard) + WideToUTF8(wide_host)); + const std::string& host(*i); + Pattern pattern(std::string(kDomainWildcard) + host); DictionaryValue* host_settings_dictionary = NULL; bool found = all_settings_dictionary->GetDictionaryWithoutPathExpansion( - wide_host, &host_settings_dictionary); + host, &host_settings_dictionary); DCHECK(found); ContentSettings settings; GetSettingsFromDictionary(host_settings_dictionary, &settings); @@ -570,14 +570,14 @@ void HostContentSettingsMap::GetSettingsFromDictionary( ContentSettings* settings) { for (DictionaryValue::key_iterator i(dictionary->begin_keys()); i != dictionary->end_keys(); ++i) { - std::wstring content_type(*i); + const std::string& content_type(*i); int setting = CONTENT_SETTING_DEFAULT; bool found = dictionary->GetIntegerWithoutPathExpansion(content_type, &setting); DCHECK(found); for (size_t type = 0; type < arraysize(kTypeNames); ++type) { if ((kTypeNames[type] != NULL) && - (std::wstring(kTypeNames[type]) == content_type)) { + (WideToUTF8(kTypeNames[type]) == content_type)) { settings->settings[type] = IntToContentSetting(setting); break; } @@ -634,16 +634,16 @@ void HostContentSettingsMap::ReadExceptions(bool overwrite) { if (all_settings_dictionary != NULL) { for (DictionaryValue::key_iterator i(all_settings_dictionary->begin_keys()); i != all_settings_dictionary->end_keys(); ++i) { - std::wstring wide_pattern(*i); - if (!Pattern(WideToUTF8(wide_pattern)).IsValid()) + const std::string& pattern(*i); + if (!Pattern(pattern).IsValid()) LOG(WARNING) << "Invalid pattern stored in content settings"; DictionaryValue* pattern_settings_dictionary = NULL; bool found = all_settings_dictionary->GetDictionaryWithoutPathExpansion( - wide_pattern, &pattern_settings_dictionary); + pattern, &pattern_settings_dictionary); DCHECK(found); ContentSettings settings; GetSettingsFromDictionary(pattern_settings_dictionary, &settings); - host_content_settings_[WideToUTF8(wide_pattern)] = settings; + host_content_settings_[pattern] = settings; } } } diff --git a/chrome/browser/host_zoom_map.cc b/chrome/browser/host_zoom_map.cc index 50e1519..512fdf0 100644 --- a/chrome/browser/host_zoom_map.cc +++ b/chrome/browser/host_zoom_map.cc @@ -42,12 +42,12 @@ void HostZoomMap::Load() { if (host_zoom_dictionary != NULL) { for (DictionaryValue::key_iterator i(host_zoom_dictionary->begin_keys()); i != host_zoom_dictionary->end_keys(); ++i) { - std::wstring wide_host(*i); + const std::string& host(*i); int zoom_level = 0; bool success = host_zoom_dictionary->GetIntegerWithoutPathExpansion( - wide_host, &zoom_level); + host, &zoom_level); DCHECK(success); - host_zoom_levels_[WideToUTF8(wide_host)] = zoom_level; + host_zoom_levels_[host] = zoom_level; } } } diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 7384a2a..9b51cfa 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -354,10 +354,10 @@ void MetricsLog::RecordEnvironment( void MetricsLog::WriteAllProfilesMetrics( const DictionaryValue& all_profiles_metrics) { - const std::wstring profile_prefix(prefs::kProfilePrefix); + const std::string profile_prefix(WideToUTF8(prefs::kProfilePrefix)); for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys(); i != all_profiles_metrics.end_keys(); ++i) { - const std::wstring& key_name = *i; + const std::string& key_name = *i; if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) { DictionaryValue* profile; if (all_profiles_metrics.GetDictionaryWithoutPathExpansion(key_name, @@ -367,21 +367,21 @@ void MetricsLog::WriteAllProfilesMetrics( } } -void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash, +void MetricsLog::WriteProfileMetrics(const std::string& profileidhash, const DictionaryValue& profile_metrics) { OPEN_ELEMENT_FOR_SCOPE("userprofile"); - WriteAttribute("profileidhash", WideToUTF8(profileidhash)); + WriteAttribute("profileidhash", profileidhash); for (DictionaryValue::key_iterator i = profile_metrics.begin_keys(); i != profile_metrics.end_keys(); ++i) { Value* value; if (profile_metrics.GetWithoutPathExpansion(*i, &value)) { - DCHECK(*i != L"id"); + DCHECK(*i != "id"); switch (value->GetType()) { case Value::TYPE_STRING: { std::string string_value; if (value->GetAsString(&string_value)) { OPEN_ELEMENT_FOR_SCOPE("profileparam"); - WriteAttribute("name", WideToUTF8(*i)); + WriteAttribute("name", *i); WriteAttribute("value", string_value); } break; @@ -391,7 +391,7 @@ void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash, bool bool_value; if (value->GetAsBoolean(&bool_value)) { OPEN_ELEMENT_FOR_SCOPE("profileparam"); - WriteAttribute("name", WideToUTF8(*i)); + WriteAttribute("name", *i); WriteIntAttribute("value", bool_value ? 1 : 0); } break; @@ -401,7 +401,7 @@ void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash, int int_value; if (value->GetAsInteger(&int_value)) { OPEN_ELEMENT_FOR_SCOPE("profileparam"); - WriteAttribute("name", WideToUTF8(*i)); + WriteAttribute("name", *i); WriteIntAttribute("value", int_value); } break; diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h index eb8e67f..081d4b1 100644 --- a/chrome/browser/metrics/metrics_log.h +++ b/chrome/browser/metrics/metrics_log.h @@ -93,7 +93,7 @@ class MetricsLog : public MetricsLogBase { // Writes metrics for the profile identified by key. This writes all // key/value pairs in profile_metrics. - void WriteProfileMetrics(const std::wstring& key, + void WriteProfileMetrics(const std::string& key, const DictionaryValue& profile_metrics); DISALLOW_COPY_AND_ASSIGN(MetricsLog); diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index 48b766a..779faad 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -222,7 +222,7 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( std::string value; if (inspector_settings->GetStringWithoutPathExpansion(*iter, &value)) web_prefs.inspector_settings.push_back( - std::make_pair(WideToUTF8(*iter), value)); + std::make_pair(*iter, value)); } } web_prefs.tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks); diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index 59a2cfa6..d17d8e8 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -128,7 +128,7 @@ class WebDatabaseTest : public testing::Test { int b_count = GetKeyCount(b); DictionaryValue::key_iterator i(a.begin_keys()); DictionaryValue::key_iterator e(a.end_keys()); - std::wstring av, bv; + std::string av, bv; while (i != e) { if (!(a.GetStringWithoutPathExpansion(*i, &av)) || !(b.GetStringWithoutPathExpansion(*i, &bv)) || diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index d32ef66..6d6c05d 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -514,11 +514,12 @@ ExtensionAction* Extension::LoadExtensionActionHelper( bool Extension::ContainsNonThemeKeys(const DictionaryValue& source) { // Generate a map of allowable keys - static std::map<std::wstring, bool> theme_keys; + static std::map<std::string, bool> theme_keys; static bool theme_key_mapped = false; if (!theme_key_mapped) { for (size_t i = 0; i < arraysize(kValidThemeKeys); ++i) { - theme_keys[kValidThemeKeys[i]] = true; + // TODO(viettrungluu): Make the constants |char*|s and avoid converting. + theme_keys[WideToUTF8(kValidThemeKeys[i])] = true; } theme_key_mapped = true; } @@ -1454,7 +1455,7 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, // Validate that the overrides are all strings for (DictionaryValue::key_iterator iter = overrides->begin_keys(); iter != overrides->end_keys(); ++iter) { - std::string page = WideToUTF8(*iter); + std::string page = *iter; std::string val; // Restrict override pages to a list of supported URLs. if ((page != chrome::kChromeUINewTabHost && @@ -1529,6 +1530,8 @@ GURL Extension::GalleryUrl() const { std::set<FilePath> Extension::GetBrowserImages() { std::set<FilePath> image_paths; + // TODO(viettrungluu): These |FilePath::FromWStringHack(UTF8ToWide())| + // indicate that we're doing something wrong. // Extension icons. for (std::map<int, std::string>::iterator iter = icons_.begin(); @@ -1541,9 +1544,9 @@ std::set<FilePath> Extension::GetBrowserImages() { if (theme_images) { for (DictionaryValue::key_iterator it = theme_images->begin_keys(); it != theme_images->end_keys(); ++it) { - std::wstring val; + std::string val; if (theme_images->GetStringWithoutPathExpansion(*it, &val)) - image_paths.insert(FilePath::FromWStringHack(val)); + image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(val))); } } diff --git a/chrome/common/extensions/extension_message_bundle.cc b/chrome/common/extensions/extension_message_bundle.cc index 6b001b1..04022cd 100644 --- a/chrome/common/extensions/extension_message_bundle.cc +++ b/chrome/common/extensions/extension_message_bundle.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -73,7 +73,7 @@ bool ExtensionMessageBundle::Init(const CatalogVector& locale_catalogs, DictionaryValue* catalog = (*it).get(); for (DictionaryValue::key_iterator key_it = catalog->begin_keys(); key_it != catalog->end_keys(); ++key_it) { - std::string key(StringToLowerASCII(WideToUTF8(*key_it))); + std::string key(StringToLowerASCII(*key_it)); if (!IsValidName(*key_it)) return BadKeyMessage(key, error); std::string value; @@ -126,14 +126,13 @@ bool ExtensionMessageBundle::AppendReservedMessagesForLocale( return true; } -bool ExtensionMessageBundle::GetMessageValue(const std::wstring& wkey, +bool ExtensionMessageBundle::GetMessageValue(const std::string& key, const DictionaryValue& catalog, std::string* value, std::string* error) const { - std::string key(WideToUTF8(wkey)); // Get the top level tree for given key (name part). DictionaryValue* name_tree; - if (!catalog.GetDictionaryWithoutPathExpansion(wkey, &name_tree)) { + if (!catalog.GetDictionaryWithoutPathExpansion(key, &name_tree)) { *error = StringPrintf("Not a valid tree for key %s.", key.c_str()); return false; } @@ -176,10 +175,10 @@ bool ExtensionMessageBundle::GetPlaceholders(const DictionaryValue& name_tree, for (DictionaryValue::key_iterator key_it = placeholders_tree->begin_keys(); key_it != placeholders_tree->end_keys(); ++key_it) { DictionaryValue* placeholder; - std::string content_key = WideToUTF8(*key_it); - if (!IsValidName(*key_it)) + const std::string& content_key(*key_it); + if (!IsValidName(content_key)) return BadKeyMessage(content_key, error); - if (!placeholders_tree->GetDictionaryWithoutPathExpansion(*key_it, + if (!placeholders_tree->GetDictionaryWithoutPathExpansion(content_key, &placeholder)) { *error = StringPrintf("Invalid placeholder %s for key %s", content_key.c_str(), diff --git a/chrome/common/extensions/extension_message_bundle.h b/chrome/common/extensions/extension_message_bundle.h index 2e62649..3c80356 100644 --- a/chrome/common/extensions/extension_message_bundle.h +++ b/chrome/common/extensions/extension_message_bundle.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -133,7 +133,7 @@ class ExtensionMessageBundle { // Helper methods that navigate JSON tree and return simplified message. // They replace all $PLACEHOLDERS$ with their value, and return just key/value // of the message. - bool GetMessageValue(const std::wstring& wkey, + bool GetMessageValue(const std::string& key, const DictionaryValue& catalog, std::string* value, std::string* error) const; diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index e9dff40..d3ee31a 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -19,6 +19,7 @@ #include "base/registry.h" #include "base/scoped_ptr.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "base/win_util.h" #include "base/wmi_util.h" #include "chrome/common/chrome_switches.h" @@ -235,12 +236,12 @@ bool GoogleChromeDistribution::BuildUninstallMetricsString( iter != uninstall_metrics_dict->end_keys(); ++iter) { has_values = true; metrics->append(L"&"); - metrics->append(*iter); + metrics->append(UTF8ToWide(*iter)); metrics->append(L"="); - std::wstring value; + std::string value; uninstall_metrics_dict->GetStringWithoutPathExpansion(*iter, &value); - metrics->append(value); + metrics->append(UTF8ToWide(value)); } return has_values; diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc index dc1314c..265e1d3 100644 --- a/chrome/service/cloud_print/print_system_cups.cc +++ b/chrome/service/cloud_print/print_system_cups.cc @@ -363,10 +363,10 @@ bool PrintSystemCUPS::ParsePrintTicket(const std::string& print_ticket, static_cast<DictionaryValue*>(ticket_value.get()); DictionaryValue::key_iterator it(ticket_dict->begin_keys()); for (; it != ticket_dict->end_keys(); ++it) { - std::wstring key = *it; + const std::string& key = *it; std::string value; if (ticket_dict->GetString(key, &value)) { - (*options)[WideToUTF8(key.c_str())] = value; + (*options)[key] = value; } } diff --git a/chrome/test/ui/javascript_test_util.cc b/chrome/test/ui/javascript_test_util.cc index 8f07809..f4b0f4a9 100644 --- a/chrome/test/ui/javascript_test_util.cc +++ b/chrome/test/ui/javascript_test_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -40,7 +40,7 @@ bool JsonDictionaryToMap(const std::string& json, EXPECT_TRUE(value->IsType(Value::TYPE_STRING)); if (value->IsType(Value::TYPE_STRING)) { - std::string key = WideToUTF8(*it); + const std::string& key(*it); std::string result; succeeded = value->GetAsString(&result); |