diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 03:02:51 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 03:02:51 +0000 |
commit | 57ecc4bf4069cb869e5fb0a7d922eec2384bac25 (patch) | |
tree | 1b4668fa59d6b6a072144b4ddab8d5f6faba3fa4 /chrome/browser/translate | |
parent | 1af19cfd7b1ef9924516dbe811db495315feaefe (diff) | |
download | chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.zip chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.tar.gz chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.tar.bz2 |
Make prefs use std::string for keys rather than wstrings.
Much remains to be converted.
BUG=23581
TEST=builds and passes tests
Review URL: http://codereview.chromium.org/3076037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/translate')
-rw-r--r-- | chrome/browser/translate/translate_manager.cc | 2 | ||||
-rw-r--r-- | chrome/browser/translate/translate_manager_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/translate/translate_prefs.cc | 26 | ||||
-rw-r--r-- | chrome/browser/translate/translate_prefs.h | 17 |
4 files changed, 24 insertions, 25 deletions
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index 7ce63f6..13810e6 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -242,7 +242,7 @@ void TranslateManager::Observe(NotificationType type, break; } case NotificationType::PREF_CHANGED: { - DCHECK(*Details<std::wstring>(details).ptr() == prefs::kAcceptLanguages); + DCHECK(*Details<std::string>(details).ptr() == prefs::kAcceptLanguages); PrefService* prefs = Source<PrefService>(source).ptr(); InitAcceptLanguages(prefs); break; diff --git a/chrome/browser/translate/translate_manager_unittest.cc b/chrome/browser/translate/translate_manager_unittest.cc index 227d837..e34307f 100644 --- a/chrome/browser/translate/translate_manager_unittest.cc +++ b/chrome/browser/translate/translate_manager_unittest.cc @@ -185,12 +185,12 @@ class TranslateManagerTest : public RenderViewHostTestHarness, std::string()); } - void SetPrefObserverExpectation(const wchar_t* path) { + void SetPrefObserverExpectation(const char* path) { EXPECT_CALL( pref_observer_, Observe(NotificationType(NotificationType::PREF_CHANGED), _, - Property(&Details<std::wstring>::ptr, Pointee(path)))); + Property(&Details<std::string>::ptr, Pointee(path)))); } NotificationObserverMock pref_observer_; diff --git a/chrome/browser/translate/translate_prefs.cc b/chrome/browser/translate/translate_prefs.cc index 3d72df0..5ca8879 100644 --- a/chrome/browser/translate/translate_prefs.cc +++ b/chrome/browser/translate/translate_prefs.cc @@ -9,16 +9,16 @@ #include "chrome/browser/pref_service.h" #include "chrome/browser/scoped_pref_update.h" -const wchar_t TranslatePrefs::kPrefTranslateLanguageBlacklist[] = - L"translate_language_blacklist"; -const wchar_t TranslatePrefs::kPrefTranslateSiteBlacklist[] = - L"translate_site_blacklist"; -const wchar_t TranslatePrefs::kPrefTranslateWhitelists[] = - L"translate_whitelists"; -const wchar_t TranslatePrefs::kPrefTranslateDeniedCount[] = - L"translate_denied_count"; -const wchar_t TranslatePrefs::kPrefTranslateAcceptedCount[] = - L"translate_accepted_count"; +const char TranslatePrefs::kPrefTranslateLanguageBlacklist[] = + "translate_language_blacklist"; +const char TranslatePrefs::kPrefTranslateSiteBlacklist[] = + "translate_site_blacklist"; +const char TranslatePrefs::kPrefTranslateWhitelists[] = + "translate_whitelists"; +const char TranslatePrefs::kPrefTranslateDeniedCount[] = + "translate_denied_count"; +const char TranslatePrefs::kPrefTranslateAcceptedCount[] = + "translate_accepted_count"; // TranslatePrefs: public: ----------------------------------------------------- @@ -226,13 +226,13 @@ bool TranslatePrefs::IsValueInList(const ListValue* list, return false; } -bool TranslatePrefs::IsValueBlacklisted(const wchar_t* pref_id, +bool TranslatePrefs::IsValueBlacklisted(const char* pref_id, const std::string& value) { const ListValue* blacklist = prefs_->GetList(pref_id); return (blacklist && !blacklist->empty() && IsValueInList(blacklist, value)); } -void TranslatePrefs::BlacklistValue(const wchar_t* pref_id, +void TranslatePrefs::BlacklistValue(const char* pref_id, const std::string& value) { ListValue* blacklist = prefs_->GetMutableList(pref_id); if (!blacklist) { @@ -243,7 +243,7 @@ void TranslatePrefs::BlacklistValue(const wchar_t* pref_id, prefs_->ScheduleSavePersistentPrefs(); } -void TranslatePrefs::RemoveValueFromBlacklist(const wchar_t* pref_id, +void TranslatePrefs::RemoveValueFromBlacklist(const char* pref_id, const std::string& value) { ListValue* blacklist = prefs_->GetMutableList(pref_id); if (!blacklist) { diff --git a/chrome/browser/translate/translate_prefs.h b/chrome/browser/translate/translate_prefs.h index a07d70d..a173fab 100644 --- a/chrome/browser/translate/translate_prefs.h +++ b/chrome/browser/translate/translate_prefs.h @@ -17,11 +17,11 @@ class PrefService; class TranslatePrefs { public: - static const wchar_t kPrefTranslateLanguageBlacklist[]; - static const wchar_t kPrefTranslateSiteBlacklist[]; - static const wchar_t kPrefTranslateWhitelists[]; - static const wchar_t kPrefTranslateDeniedCount[]; - static const wchar_t kPrefTranslateAcceptedCount[]; + static const char kPrefTranslateLanguageBlacklist[]; + static const char kPrefTranslateSiteBlacklist[]; + static const char kPrefTranslateWhitelists[]; + static const char kPrefTranslateDeniedCount[]; + static const char kPrefTranslateAcceptedCount[]; explicit TranslatePrefs(PrefService* user_prefs); @@ -62,10 +62,9 @@ class TranslatePrefs { private: static void MigrateTranslateWhitelists(PrefService* user_prefs); - bool IsValueBlacklisted(const wchar_t* pref_id, const std::string& value); - void BlacklistValue(const wchar_t* pref_id, const std::string& value); - void RemoveValueFromBlacklist(const wchar_t* pref_id, - const std::string& value); + bool IsValueBlacklisted(const char* pref_id, const std::string& value); + void BlacklistValue(const char* pref_id, const std::string& value); + void RemoveValueFromBlacklist(const char* pref_id, const std::string& value); bool IsValueInList(const ListValue* list, const std::string& value); bool IsLanguageWhitelisted(const std::string& original_language, std::string* target_language); |