summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_dom_ui.cc4
-rw-r--r--chrome/browser/extensions/extension_dom_ui.h2
-rw-r--r--chrome/browser/extensions/extension_override_apitest.cc6
-rw-r--r--chrome/browser/extensions/extension_prefs.cc68
-rw-r--r--chrome/browser/extensions/extension_prefs.h6
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc184
-rw-r--r--chrome/browser/gtk/options/languages_page_gtk.cc4
-rw-r--r--chrome/browser/language_combobox_model.cc2
-rw-r--r--chrome/browser/language_combobox_model.h2
-rw-r--r--chrome/browser/pref_service.cc189
-rw-r--r--chrome/browser/pref_service.h48
-rw-r--r--chrome/browser/views/chrome_views_delegate.cc39
-rw-r--r--chrome/browser/views/options/languages_page_view.cc8
-rw-r--r--chrome/browser/views/task_manager_view.cc9
14 files changed, 165 insertions, 406 deletions
diff --git a/chrome/browser/extensions/extension_dom_ui.cc b/chrome/browser/extensions/extension_dom_ui.cc
index 4a5f24c..b23d12c 100644
--- a/chrome/browser/extensions/extension_dom_ui.cc
+++ b/chrome/browser/extensions/extension_dom_ui.cc
@@ -117,8 +117,8 @@ class ExtensionDOMUIImageLoadingTracker : public ImageLoadingTracker::Observer {
} // namespace
-const wchar_t ExtensionDOMUI::kExtensionURLOverrides[] =
- L"extensions.chrome_url_overrides";
+const char ExtensionDOMUI::kExtensionURLOverrides[] =
+ "extensions.chrome_url_overrides";
ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents)
: DOMUI(tab_contents) {
diff --git a/chrome/browser/extensions/extension_dom_ui.h b/chrome/browser/extensions/extension_dom_ui.h
index 343a486..e0698e7 100644
--- a/chrome/browser/extensions/extension_dom_ui.h
+++ b/chrome/browser/extensions/extension_dom_ui.h
@@ -27,7 +27,7 @@ class ExtensionDOMUI
: public DOMUI,
public ExtensionFunctionDispatcher::Delegate {
public:
- static const wchar_t kExtensionURLOverrides[];
+ static const char kExtensionURLOverrides[];
explicit ExtensionDOMUI(TabContents* tab_contents);
diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc
index 3063975..3e5369a 100644
--- a/chrome/browser/extensions/extension_override_apitest.cc
+++ b/chrome/browser/extensions/extension_override_apitest.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.
@@ -22,7 +22,7 @@ class ExtensionOverrideTest : public ExtensionApiTest {
ExtensionDOMUI::kExtensionURLOverrides);
ListValue* values = NULL;
- if (!overrides->GetList(L"history", &values))
+ if (!overrides->GetList("history", &values))
return false;
std::set<std::string> seen_overrides;
@@ -120,7 +120,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) {
list->Append(Value::CreateStringValue("http://www.google.com/"));
browser()->profile()->GetPrefs()->GetMutableDictionary(
- ExtensionDOMUI::kExtensionURLOverrides)->Set(L"history", list);
+ ExtensionDOMUI::kExtensionURLOverrides)->Set("history", list);
ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes());
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index f8dbc59..e987065 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -18,67 +18,68 @@ namespace {
// A preference that keeps track of per-extension settings. This is a dictionary
// object read from the Preferences file, keyed off of extension id's.
-const wchar_t kExtensionsPref[] = L"extensions.settings";
+const char kExtensionsPref[] = "extensions.settings";
// Where an extension was installed from. (see Extension::Location)
-const wchar_t kPrefLocation[] = L"location";
+const char kPrefLocation[] = "location";
// Enabled, disabled, killed, etc. (see Extension::State)
-const wchar_t kPrefState[] = L"state";
+const char kPrefState[] = "state";
// The path to the current version's manifest file.
-const wchar_t kPrefPath[] = L"path";
+const char kPrefPath[] = "path";
// The dictionary containing the extension's manifest.
-const wchar_t kPrefManifest[] = L"manifest";
+const char kPrefManifest[] = "manifest";
// The version number.
-const wchar_t kPrefVersion[] = L"manifest.version";
+const char kPrefVersion[] = "manifest.version";
// Indicates if an extension is blacklisted:
-const wchar_t kPrefBlacklist[] = L"blacklist";
+const char kPrefBlacklist[] = "blacklist";
// Indicates whether to show an install warning when the user enables.
-const wchar_t kExtensionDidEscalatePermissions[] = L"install_warning_on_enable";
+const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable";
// A preference that tracks extension shelf configuration. This is a list
// object read from the Preferences file, containing a list of toolstrip URLs.
-const wchar_t kExtensionShelf[] = L"extensions.shelf";
+const char kExtensionShelf[] = "extensions.shelf";
// A preference that tracks admin policy regarding which extensions the user
// can and can not install. This preference is a list object, containing
// strings that list extension ids. Denylist can contain "*" meaning all
// extensions.
-const wchar_t kExtensionInstallAllowList[] = L"extensions.install.allowlist";
-const wchar_t kExtensionInstallDenyList[] = L"extensions.install.denylist";
+const char kExtensionInstallAllowList[] = "extensions.install.allowlist";
+const char kExtensionInstallDenyList[] = "extensions.install.denylist";
// A preference that tracks browser action toolbar configuration. This is a list
// object stored in the Preferences file. The extensions are stored by ID.
-const wchar_t kExtensionToolbar[] = L"extensions.toolbar";
+const char kExtensionToolbar[] = "extensions.toolbar";
// The key for a serialized Time value indicating the start of the day (from the
// server's perspective) an extension last included a "ping" parameter during
// its update check.
-const wchar_t kLastPingDay[] = L"lastpingday";
+const char kLastPingDay[] = "lastpingday";
// Path for settings specific to blacklist update.
-const wchar_t kExtensionsBlacklistUpdate[] = L"extensions.blacklistupdate";
+const char kExtensionsBlacklistUpdate[] = "extensions.blacklistupdate";
// Path and sub-keys for the idle install info dictionary preference.
-const wchar_t kIdleInstallInfo[] = L"idle_install_info";
-const wchar_t kIdleInstallInfoCrxPath[] = L"crx_path";
-const wchar_t kIdleInstallInfoVersion[] = L"version";
-const wchar_t kIdleInstallInfoFetchTime[] = L"fetch_time";
+const char kIdleInstallInfo[] = "idle_install_info";
+const char kIdleInstallInfoCrxPath[] = "crx_path";
+const char kIdleInstallInfoVersion[] = "version";
+const char kIdleInstallInfoFetchTime[] = "fetch_time";
// A preference that, if true, will allow this extension to run in incognito
// mode.
-const wchar_t kPrefIncognitoEnabled[] = L"incognito";
+const char kPrefIncognitoEnabled[] = "incognito";
// A preference to control whether an extension is allowed to inject script in
// pages with file URLs.
-const wchar_t kPrefAllowFileAccess[] = L"allowFileAccess";
-}
+const char kPrefAllowFileAccess[] = "allowFileAccess";
+
+} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -207,7 +208,7 @@ DictionaryValue* ExtensionPrefs::CopyCurrentExtensions() {
}
bool ExtensionPrefs::ReadBooleanFromPref(
- DictionaryValue* ext, const std::wstring& pref_key) {
+ DictionaryValue* ext, const std::string& pref_key) {
if (!ext->HasKey(pref_key)) return false;
bool bool_value = false;
if (!ext->GetBoolean(pref_key, &bool_value)) {
@@ -219,7 +220,7 @@ bool ExtensionPrefs::ReadBooleanFromPref(
}
bool ExtensionPrefs::ReadExtensionPrefBoolean(
- const std::string& extension_id, const std::wstring& pref_key) {
+ const std::string& extension_id, const std::string& pref_key) {
const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref);
if (!extensions)
return false;
@@ -574,15 +575,15 @@ FilePath ExtensionPrefs::GetExtensionPath(const std::string& extension_id) {
if (!dict || dict->empty())
return FilePath();
- std::wstring path;
- if (!dict->GetString(ASCIIToWide(extension_id) + L"." + kPrefPath, &path))
+ std::string path;
+ if (!dict->GetString(extension_id + "." + kPrefPath, &path))
return FilePath();
- return install_directory_.Append(FilePath::FromWStringHack(path));
+ return install_directory_.Append(FilePath::FromWStringHack(UTF8ToWide(path)));
}
void ExtensionPrefs::UpdateExtensionPref(const std::string& extension_id,
- const std::wstring& key,
+ const std::string& key,
Value* data_value) {
if (!Extension::IdIsValid(extension_id)) {
NOTREACHED() << "Invalid extension_id " << extension_id;
@@ -593,10 +594,9 @@ void ExtensionPrefs::UpdateExtensionPref(const std::string& extension_id,
}
void ExtensionPrefs::DeleteExtensionPrefs(const std::string& extension_id) {
- std::wstring id = ASCIIToWide(extension_id);
DictionaryValue* dict = prefs_->GetMutableDictionary(kExtensionsPref);
- if (dict->HasKey(id)) {
- dict->Remove(id, NULL);
+ if (dict->HasKey(extension_id)) {
+ dict->Remove(extension_id, NULL);
prefs_->ScheduleSavePersistentPrefs();
}
}
@@ -606,11 +606,10 @@ DictionaryValue* ExtensionPrefs::GetOrCreateExtensionPref(
DCHECK(Extension::IdIsValid(extension_id));
DictionaryValue* dict = prefs_->GetMutableDictionary(kExtensionsPref);
DictionaryValue* extension = NULL;
- std::wstring id = ASCIIToWide(extension_id);
- if (!dict->GetDictionary(id, &extension)) {
+ if (!dict->GetDictionary(extension_id, &extension)) {
// Extension pref does not exist, create it.
extension = new DictionaryValue();
- dict->Set(id, extension);
+ dict->Set(extension_id, extension);
}
return extension;
}
@@ -621,8 +620,7 @@ DictionaryValue* ExtensionPrefs::GetExtensionPref(
if (!dict)
return NULL;
DictionaryValue* extension = NULL;
- std::wstring id = ASCIIToWide(extension_id);
- dict->GetDictionary(id, &extension);
+ dict->GetDictionary(extension_id, &extension);
return extension;
}
diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h
index f61cdc1..de900fe 100644
--- a/chrome/browser/extensions/extension_prefs.h
+++ b/chrome/browser/extensions/extension_prefs.h
@@ -163,7 +163,7 @@ class ExtensionPrefs {
// Sets the pref |key| for extension |id| to |value|.
void UpdateExtensionPref(const std::string& id,
- const std::wstring& key,
+ const std::string& key,
Value* value);
// Deletes the pref dictionary for extension |id|.
@@ -171,11 +171,11 @@ class ExtensionPrefs {
// Reads a boolean pref from |ext| with key |pref_key|.
// Return false if the value is false or kPrefBlacklist does not exist.
- bool ReadBooleanFromPref(DictionaryValue* ext, const std::wstring& pref_key);
+ bool ReadBooleanFromPref(DictionaryValue* ext, const std::string& pref_key);
// Reads a boolean pref |pref_key| from extension with id |extension_id|.
bool ReadExtensionPrefBoolean(const std::string& extension_id,
- const std::wstring& pref_key);
+ const std::string& pref_key);
// Ensures and returns a mutable dictionary for extension |id|'s prefs.
DictionaryValue* GetOrCreateExtensionPref(const std::string& id);
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index 15e5eef..c23f451 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -159,7 +159,7 @@ class MockProviderVisitor : public ExternalExtensionProvider::Visitor {
Value* json_value = serializer.Deserialize(NULL, NULL);
if (!json_value || !json_value->IsType(Value::TYPE_DICTIONARY)) {
- NOTREACHED() << L"Unable to deserialize json data";
+ NOTREACHED() << "Unable to deserialize json data";
return -1;
} else {
DictionaryValue* external_extensions =
@@ -185,8 +185,8 @@ class MockProviderVisitor : public ExternalExtensionProvider::Visitor {
// This tests is to make sure that the provider only notifies us of the
// values we gave it. So if the id we doesn't exist in our internal
// dictionary then something is wrong.
- EXPECT_TRUE(prefs_->GetDictionary(ASCIIToWide(id), &pref))
- << L"Got back ID (" << id.c_str() << ") we weren't expecting";
+ EXPECT_TRUE(prefs_->GetDictionary(id, &pref))
+ << "Got back ID (" << id.c_str() << ") we weren't expecting";
if (pref) {
// Ask provider if the extension we got back is registered.
@@ -198,7 +198,7 @@ class MockProviderVisitor : public ExternalExtensionProvider::Visitor {
EXPECT_EQ(Extension::EXTERNAL_PREF, location);
// Remove it so we won't count it ever again.
- prefs_->Remove(ASCIIToWide(id), NULL);
+ prefs_->Remove(id, NULL);
}
}
@@ -485,26 +485,25 @@ class ExtensionsServiceTest
void ValidatePrefKeyCount(size_t count) {
DictionaryValue* dict =
- prefs_->GetMutableDictionary(L"extensions.settings");
+ prefs_->GetMutableDictionary("extensions.settings");
ASSERT_TRUE(dict != NULL);
EXPECT_EQ(count, dict->size());
}
void ValidateBooleanPref(const std::string& extension_id,
- const std::wstring& pref_path,
+ const std::string& pref_path,
bool expected_val) {
- std::wstring msg = L" while checking: ";
- msg += ASCIIToWide(extension_id);
- msg += L" ";
+ std::string msg = " while checking: ";
+ msg += extension_id;
+ msg += " ";
msg += pref_path;
- msg += L" == ";
- msg += expected_val ? L"true" : L"false";
+ msg += " == ";
+ msg += expected_val ? "true" : "false";
- const DictionaryValue* dict =
- prefs_->GetDictionary(L"extensions.settings");
+ const DictionaryValue* dict = prefs_->GetDictionary("extensions.settings");
ASSERT_TRUE(dict != NULL) << msg;
DictionaryValue* pref = NULL;
- ASSERT_TRUE(dict->GetDictionary(ASCIIToWide(extension_id), &pref)) << msg;
+ ASSERT_TRUE(dict->GetDictionary(extension_id, &pref)) << msg;
EXPECT_TRUE(pref != NULL) << msg;
bool val;
ASSERT_TRUE(pref->GetBoolean(pref_path, &val)) << msg;
@@ -512,12 +511,11 @@ class ExtensionsServiceTest
}
bool IsPrefExist(const std::string& extension_id,
- const std::wstring& pref_path) {
- const DictionaryValue* dict =
- prefs_->GetDictionary(L"extensions.settings");
+ const std::string& pref_path) {
+ const DictionaryValue* dict = prefs_->GetDictionary("extensions.settings");
if (dict == NULL) return false;
DictionaryValue* pref = NULL;
- if (!dict->GetDictionary(ASCIIToWide(extension_id), &pref)) {
+ if (!dict->GetDictionary(extension_id, &pref)) {
return false;
}
if (pref == NULL) {
@@ -531,20 +529,19 @@ class ExtensionsServiceTest
}
void ValidateIntegerPref(const std::string& extension_id,
- const std::wstring& pref_path,
+ const std::string& pref_path,
int expected_val) {
- std::wstring msg = L" while checking: ";
- msg += ASCIIToWide(extension_id);
- msg += L" ";
+ std::string msg = " while checking: ";
+ msg += extension_id;
+ msg += " ";
msg += pref_path;
- msg += L" == ";
- msg += UTF8ToWide(base::IntToString(expected_val));
+ msg += " == ";
+ msg += base::IntToString(expected_val);
- const DictionaryValue* dict =
- prefs_->GetDictionary(L"extensions.settings");
+ const DictionaryValue* dict = prefs_->GetDictionary("extensions.settings");
ASSERT_TRUE(dict != NULL) << msg;
DictionaryValue* pref = NULL;
- ASSERT_TRUE(dict->GetDictionary(ASCIIToWide(extension_id), &pref)) << msg;
+ ASSERT_TRUE(dict->GetDictionary(extension_id, &pref)) << msg;
EXPECT_TRUE(pref != NULL) << msg;
int val;
ASSERT_TRUE(pref->GetInteger(pref_path, &val)) << msg;
@@ -552,21 +549,20 @@ class ExtensionsServiceTest
}
void ValidateStringPref(const std::string& extension_id,
- const std::wstring& pref_path,
+ const std::string& pref_path,
const std::string& expected_val) {
- std::wstring msg = L" while checking: ";
- msg += ASCIIToWide(extension_id);
- msg += L".manifest.";
+ std::string msg = " while checking: ";
+ msg += extension_id;
+ msg += ".manifest.";
msg += pref_path;
- msg += L" == ";
- msg += ASCIIToWide(expected_val);
+ msg += " == ";
+ msg += expected_val;
- const DictionaryValue* dict =
- prefs_->GetDictionary(L"extensions.settings");
+ const DictionaryValue* dict = prefs_->GetDictionary("extensions.settings");
ASSERT_TRUE(dict != NULL) << msg;
DictionaryValue* pref = NULL;
std::string manifest_path = extension_id + ".manifest";
- ASSERT_TRUE(dict->GetDictionary(ASCIIToWide(manifest_path), &pref)) << msg;
+ ASSERT_TRUE(dict->GetDictionary(manifest_path, &pref)) << msg;
EXPECT_TRUE(pref != NULL) << msg;
std::string val;
ASSERT_TRUE(pref->GetString(pref_path, &val)) << msg;
@@ -574,20 +570,20 @@ class ExtensionsServiceTest
}
void SetPrefInteg(const std::string& extension_id,
- const std::wstring& pref_path,
+ const std::string& pref_path,
int value) {
- std::wstring msg = L" while setting: ";
- msg += ASCIIToWide(extension_id);
- msg += L" ";
+ std::string msg = " while setting: ";
+ msg += extension_id;
+ msg += " ";
msg += pref_path;
- msg += L" = ";
- msg += UTF8ToWide(base::IntToString(value));
+ msg += " = ";
+ msg += base::IntToString(value);
const DictionaryValue* dict =
- prefs_->GetMutableDictionary(L"extensions.settings");
+ prefs_->GetMutableDictionary("extensions.settings");
ASSERT_TRUE(dict != NULL) << msg;
DictionaryValue* pref = NULL;
- ASSERT_TRUE(dict->GetDictionary(ASCIIToWide(extension_id), &pref)) << msg;
+ ASSERT_TRUE(dict->GetDictionary(extension_id, &pref)) << msg;
EXPECT_TRUE(pref != NULL) << msg;
pref->SetInteger(pref_path, value);
}
@@ -680,12 +676,12 @@ TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectorySuccess) {
EXPECT_EQ(3u, service_->extensions()->size());
ValidatePrefKeyCount(3);
- ValidateIntegerPref(good0, L"state", Extension::ENABLED);
- ValidateIntegerPref(good0, L"location", Extension::INTERNAL);
- ValidateIntegerPref(good1, L"state", Extension::ENABLED);
- ValidateIntegerPref(good1, L"location", Extension::INTERNAL);
- ValidateIntegerPref(good2, L"state", Extension::ENABLED);
- ValidateIntegerPref(good2, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(good0, "state", Extension::ENABLED);
+ ValidateIntegerPref(good0, "location", Extension::INTERNAL);
+ ValidateIntegerPref(good1, "state", Extension::ENABLED);
+ ValidateIntegerPref(good1, "location", Extension::INTERNAL);
+ ValidateIntegerPref(good2, "state", Extension::ENABLED);
+ ValidateIntegerPref(good2, "location", Extension::INTERNAL);
Extension* extension = loaded_[0];
const UserScriptList& scripts = extension->content_scripts();
@@ -811,9 +807,9 @@ TEST_F(ExtensionsServiceTest, CleanupOnStartup) {
InitializeInstalledExtensionsService(pref_path, source_install_dir);
// Simulate that one of them got partially deleted by clearing its pref.
- DictionaryValue* dict = prefs_->GetMutableDictionary(L"extensions.settings");
+ DictionaryValue* dict = prefs_->GetMutableDictionary("extensions.settings");
ASSERT_TRUE(dict != NULL);
- dict->Remove(L"behllobkkfkfnphdnhnkndlbkcpglgmj", NULL);
+ dict->Remove("behllobkkfkfnphdnhnkndlbkcpglgmj", NULL);
service_->Init();
loop_.RunAllPending();
@@ -858,15 +854,15 @@ TEST_F(ExtensionsServiceTest, InstallExtension) {
int pref_count = 0;
ValidatePrefKeyCount(++pref_count);
- ValidateIntegerPref(good_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(good_crx, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", Extension::INTERNAL);
// An extension with page actions.
path = extensions_path.AppendASCII("page_action.crx");
InstallExtension(path, true);
ValidatePrefKeyCount(++pref_count);
- ValidateIntegerPref(page_action, L"state", Extension::ENABLED);
- ValidateIntegerPref(page_action, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(page_action, "state", Extension::ENABLED);
+ ValidateIntegerPref(page_action, "location", Extension::INTERNAL);
// Bad signature.
path = extensions_path.AppendASCII("bad_signature.crx");
@@ -1095,8 +1091,8 @@ TEST_F(ExtensionsServiceTest, InstallTheme) {
InstallExtension(path, true);
int pref_count = 0;
ValidatePrefKeyCount(++pref_count);
- ValidateIntegerPref(theme_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(theme_crx, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(theme_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(theme_crx, "location", Extension::INTERNAL);
// A theme when extensions are disabled. Themes can be installed, even when
// extensions are disabled.
@@ -1104,8 +1100,8 @@ TEST_F(ExtensionsServiceTest, InstallTheme) {
path = extensions_path.AppendASCII("theme2.crx");
InstallExtension(path, true);
ValidatePrefKeyCount(++pref_count);
- ValidateIntegerPref(theme2_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(theme2_crx, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(theme2_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(theme2_crx, "location", Extension::INTERNAL);
// A theme with extension elements. Themes cannot have extension elements so
// this test should fail.
@@ -1166,8 +1162,8 @@ TEST_F(ExtensionsServiceTest, InstallApps) {
ValidatePrefKeyCount(++pref_count);
ASSERT_EQ(1u, service_->extensions()->size());
std::string id = service_->extensions()->at(0)->id();
- ValidateIntegerPref(id, L"state", Extension::ENABLED);
- ValidateIntegerPref(id, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(id, "state", Extension::ENABLED);
+ ValidateIntegerPref(id, "location", Extension::INTERNAL);
// Another app with non-overlapping extent. Should succeed.
PackAndInstallExtension(extensions_path.AppendASCII("app2"), true);
@@ -1195,8 +1191,8 @@ TEST_F(ExtensionsServiceTest, Reinstall) {
ASSERT_EQ(1u, loaded_.size());
ASSERT_EQ(0u, GetErrors().size());
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(good_crx, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", Extension::INTERNAL);
installed_ = NULL;
loaded_.clear();
@@ -1210,8 +1206,8 @@ TEST_F(ExtensionsServiceTest, Reinstall) {
ASSERT_EQ(1u, loaded_.size());
ASSERT_EQ(0u, GetErrors().size());
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(good_crx, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", Extension::INTERNAL);
}
// Test upgrading a signed extension.
@@ -1526,10 +1522,10 @@ TEST_F(ExtensionsServiceTest, SetUnsetBlacklistInPrefs) {
loop_.RunAllPending();
// blacklist is set for good0,1,2
- ValidateBooleanPref(good0, L"blacklist", true);
- ValidateBooleanPref(good1, L"blacklist", true);
+ ValidateBooleanPref(good0, "blacklist", true);
+ ValidateBooleanPref(good1, "blacklist", true);
// invalid_id should not be inserted to pref.
- EXPECT_FALSE(IsPrefExist("invalid_id", L"blacklist"));
+ EXPECT_FALSE(IsPrefExist("invalid_id", "blacklist"));
// remove good1, add good2
blacklist.pop_back();
@@ -1537,10 +1533,10 @@ TEST_F(ExtensionsServiceTest, SetUnsetBlacklistInPrefs) {
service_->UpdateExtensionBlacklist(blacklist);
// only good0 and good1 should be set
- ValidateBooleanPref(good0, L"blacklist", true);
- EXPECT_FALSE(IsPrefExist(good1, L"blacklist"));
- ValidateBooleanPref(good2, L"blacklist", true);
- EXPECT_FALSE(IsPrefExist("invalid_id", L"blacklist"));
+ ValidateBooleanPref(good0, "blacklist", true);
+ EXPECT_FALSE(IsPrefExist(good1, "blacklist"));
+ ValidateBooleanPref(good2, "blacklist", true);
+ EXPECT_FALSE(IsPrefExist("invalid_id", "blacklist"));
}
// Unload installed extension from blacklist.
@@ -1564,7 +1560,7 @@ TEST_F(ExtensionsServiceTest, UnloadBlacklistedExtension) {
loop_.RunAllPending();
// Now, the good_crx is blacklisted.
- ValidateBooleanPref(good_crx, L"blacklist", true);
+ ValidateBooleanPref(good_crx, "blacklist", true);
EXPECT_EQ(0u, service_->extensions()->size());
// Remove good_crx from blacklist
@@ -1573,7 +1569,7 @@ TEST_F(ExtensionsServiceTest, UnloadBlacklistedExtension) {
// Make sure pref is updated
loop_.RunAllPending();
// blacklist value should not be set for good_crx
- EXPECT_FALSE(IsPrefExist(good_crx, L"blacklist"));
+ EXPECT_FALSE(IsPrefExist(good_crx, "blacklist"));
}
// Unload installed extension from blacklist.
@@ -1586,7 +1582,7 @@ TEST_F(ExtensionsServiceTest, BlacklistedExtensionWillNotInstall) {
loop_.RunAllPending();
// Now, the good_crx is blacklisted.
- ValidateBooleanPref(good_crx, L"blacklist", true);
+ ValidateBooleanPref(good_crx, "blacklist", true);
// We can not install good_crx.
FilePath extensions_path;
@@ -1596,7 +1592,7 @@ TEST_F(ExtensionsServiceTest, BlacklistedExtensionWillNotInstall) {
service_->InstallExtension(path);
loop_.RunAllPending();
EXPECT_EQ(0u, service_->extensions()->size());
- ValidateBooleanPref(good_crx, L"blacklist", true);
+ ValidateBooleanPref(good_crx, "blacklist", true);
}
// Test loading extensions from the profile directory, except
@@ -1621,7 +1617,7 @@ TEST_F(ExtensionsServiceTest, WillNotLoadBlacklistedExtensionsFromDirectory) {
// Make sure pref is updated
loop_.RunAllPending();
- ValidateBooleanPref(good0, L"blacklist", true);
+ ValidateBooleanPref(good0, "blacklist", true);
// Load extensions.
service_->Init();
@@ -1642,10 +1638,8 @@ TEST_F(ExtensionsServiceTest, WillNotLoadBlacklistedExtensionsFromDirectory) {
TEST_F(ExtensionsServiceTest, BlacklistedByPolicyWillNotInstall) {
InitializeEmptyExtensionsService();
- ListValue* whitelist = prefs_->GetMutableList(
- L"extensions.install.allowlist");
- ListValue* blacklist = prefs_->GetMutableList(
- L"extensions.install.denylist");
+ ListValue* whitelist = prefs_->GetMutableList("extensions.install.allowlist");
+ ListValue* blacklist = prefs_->GetMutableList("extensions.install.denylist");
ASSERT_TRUE(whitelist != NULL && blacklist != NULL);
// Blacklist everything.
@@ -1750,8 +1744,8 @@ TEST_F(ExtensionsServiceTest, UninstallExtension) {
EXPECT_TRUE(file_util::PathExists(extension_path));
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(good_crx, L"location", Extension::INTERNAL);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", Extension::INTERNAL);
// Uninstall it.
service_->UninstallExtension(extension_id, false);
@@ -1932,8 +1926,8 @@ void ExtensionsServiceTest::TestExternalProvider(
ASSERT_EQ(location, loaded_[0]->location());
ASSERT_EQ("1.0.0.0", loaded_[0]->version()->GetString());
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(good_crx, L"location", location);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", location);
// Reload extensions without changing anything. The extension should be
// loaded again.
@@ -1943,8 +1937,8 @@ void ExtensionsServiceTest::TestExternalProvider(
ASSERT_EQ(0u, GetErrors().size());
ASSERT_EQ(1u, loaded_.size());
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(good_crx, L"location", location);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", location);
// Now update the extension with a new version. We should get upgraded.
source_path = source_path.DirName().AppendASCII("good2.crx");
@@ -1957,8 +1951,8 @@ void ExtensionsServiceTest::TestExternalProvider(
ASSERT_EQ(1u, loaded_.size());
ASSERT_EQ("1.0.0.1", loaded_[0]->version()->GetString());
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(good_crx, L"location", location);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", location);
// Uninstall the extension and reload. Nothing should happen because the
// preference should prevent us from reinstalling.
@@ -1975,11 +1969,11 @@ void ExtensionsServiceTest::TestExternalProvider(
loop_.RunAllPending();
ASSERT_EQ(0u, loaded_.size());
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, L"state", Extension::KILLBIT);
- ValidateIntegerPref(good_crx, L"location", location);
+ ValidateIntegerPref(good_crx, "state", Extension::KILLBIT);
+ ValidateIntegerPref(good_crx, "location", location);
// Now clear the preference and reinstall.
- SetPrefInteg(good_crx, L"state", Extension::ENABLED);
+ SetPrefInteg(good_crx, "state", Extension::ENABLED);
prefs_->ScheduleSavePersistentPrefs();
loaded_.clear();
@@ -1987,8 +1981,8 @@ void ExtensionsServiceTest::TestExternalProvider(
loop_.RunAllPending();
ASSERT_EQ(1u, loaded_.size());
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, L"state", Extension::ENABLED);
- ValidateIntegerPref(good_crx, L"location", location);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", location);
// Now test an externally triggered uninstall (deleting the registry key or
// the pref entry).
diff --git a/chrome/browser/gtk/options/languages_page_gtk.cc b/chrome/browser/gtk/options/languages_page_gtk.cc
index 19c2d15..e39972f 100644
--- a/chrome/browser/gtk/options/languages_page_gtk.cc
+++ b/chrome/browser/gtk/options/languages_page_gtk.cc
@@ -321,7 +321,7 @@ void LanguagesPageGtk::NotifyPrefChanged(const std::string* pref_name) {
}
if (!pref_name || *pref_name == prefs::kSpellCheckDictionary) {
int index = dictionary_language_model_->GetSelectedLanguageIndex(
- UTF8ToWide(prefs::kSpellCheckDictionary));
+ prefs::kSpellCheckDictionary);
// If not found, fall back from "language-region" to "language".
if (index < 0) {
@@ -329,7 +329,7 @@ void LanguagesPageGtk::NotifyPrefChanged(const std::string* pref_name) {
dictionary_language_.SetValue(
SpellCheckCommon::GetLanguageFromLanguageRegion(lang_region));
index = dictionary_language_model_->GetSelectedLanguageIndex(
- UTF8ToWide(prefs::kSpellCheckDictionary));
+ prefs::kSpellCheckDictionary);
}
gtk_combo_box_set_active(GTK_COMBO_BOX(dictionary_language_combobox_),
diff --git a/chrome/browser/language_combobox_model.cc b/chrome/browser/language_combobox_model.cc
index 2d16a73..1745167 100644
--- a/chrome/browser/language_combobox_model.cc
+++ b/chrome/browser/language_combobox_model.cc
@@ -158,7 +158,7 @@ LanguageComboboxModel::LanguageComboboxModel(
// shouldn't be reflected in this combo box. We return -1 if the value in
// the pref doesn't map to a know language (possible if the user edited the
// prefs file manually).
-int LanguageComboboxModel::GetSelectedLanguageIndex(const std::wstring& prefs) {
+int LanguageComboboxModel::GetSelectedLanguageIndex(const std::string& prefs) {
PrefService* local_state;
if (!profile_)
local_state = g_browser_process->local_state();
diff --git a/chrome/browser/language_combobox_model.h b/chrome/browser/language_combobox_model.h
index f247af7..b30aa29 100644
--- a/chrome/browser/language_combobox_model.h
+++ b/chrome/browser/language_combobox_model.h
@@ -88,7 +88,7 @@ class LanguageComboboxModel : public LanguageList, public ComboboxModel {
// shouldn't be reflected in this combo box. We return -1 if the value in
// the pref doesn't map to a know language (possible if the user edited the
// prefs file manually).
- int GetSelectedLanguageIndex(const std::wstring& prefs);
+ int GetSelectedLanguageIndex(const std::string& prefs);
private:
// Profile.
diff --git a/chrome/browser/pref_service.cc b/chrome/browser/pref_service.cc
index 2a7dbe9..96964e9 100644
--- a/chrome/browser/pref_service.cc
+++ b/chrome/browser/pref_service.cc
@@ -176,34 +176,18 @@ void PrefService::RegisterBooleanPref(const char* path,
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterBooleanPref(const wchar_t* path, bool default_value) {
- RegisterBooleanPref(WideToUTF8(path).c_str(), default_value);
-}
-
void PrefService::RegisterIntegerPref(const char* path, int default_value) {
Preference* pref = new Preference(pref_value_store_.get(), path,
Value::CreateIntegerValue(default_value));
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterIntegerPref(const wchar_t* path, int default_value) {
- RegisterIntegerPref(WideToUTF8(path).c_str(), default_value);
-}
-
void PrefService::RegisterRealPref(const char* path, double default_value) {
Preference* pref = new Preference(pref_value_store_.get(), path,
Value::CreateRealValue(default_value));
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterRealPref(const wchar_t* path,
- double default_value) {
- RegisterRealPref(WideToUTF8(path).c_str(), default_value);
-}
-
void PrefService::RegisterStringPref(const char* path,
const std::string& default_value) {
Preference* pref = new Preference(pref_value_store_.get(), path,
@@ -211,12 +195,6 @@ void PrefService::RegisterStringPref(const char* path,
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterStringPref(const wchar_t* path,
- const std::string& default_value) {
- RegisterStringPref(WideToUTF8(path).c_str(), default_value);
-}
-
void PrefService::RegisterFilePathPref(const char* path,
const FilePath& default_value) {
Preference* pref = new Preference(pref_value_store_.get(), path,
@@ -224,34 +202,18 @@ void PrefService::RegisterFilePathPref(const char* path,
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterFilePathPref(const wchar_t* path,
- const FilePath& default_value) {
- RegisterFilePathPref(WideToUTF8(path).c_str(), default_value);
-}
-
void PrefService::RegisterListPref(const char* path) {
Preference* pref = new Preference(pref_value_store_.get(), path,
new ListValue);
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterListPref(const wchar_t* path) {
- RegisterListPref(WideToUTF8(path).c_str());
-}
-
void PrefService::RegisterDictionaryPref(const char* path) {
Preference* pref = new Preference(pref_value_store_.get(), path,
new DictionaryValue());
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterDictionaryPref(const wchar_t* path) {
- RegisterDictionaryPref(WideToUTF8(path).c_str());
-}
-
void PrefService::RegisterLocalizedBooleanPref(const char* path,
int locale_default_message_id) {
Preference* pref = new Preference(pref_value_store_.get(), path,
@@ -259,13 +221,6 @@ void PrefService::RegisterLocalizedBooleanPref(const char* path,
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterLocalizedBooleanPref(const wchar_t* path,
- int locale_default_message_id) {
- RegisterLocalizedBooleanPref(WideToUTF8(path).c_str(),
- locale_default_message_id);
-}
-
void PrefService::RegisterLocalizedIntegerPref(const char* path,
int locale_default_message_id) {
Preference* pref = new Preference(pref_value_store_.get(), path,
@@ -273,13 +228,6 @@ void PrefService::RegisterLocalizedIntegerPref(const char* path,
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterLocalizedIntegerPref(const wchar_t* path,
- int locale_default_message_id) {
- RegisterLocalizedIntegerPref(WideToUTF8(path).c_str(),
- locale_default_message_id);
-}
-
void PrefService::RegisterLocalizedRealPref(const char* path,
int locale_default_message_id) {
Preference* pref = new Preference(pref_value_store_.get(), path,
@@ -287,13 +235,6 @@ void PrefService::RegisterLocalizedRealPref(const char* path,
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterLocalizedRealPref(const wchar_t* path,
- int locale_default_message_id) {
- RegisterLocalizedRealPref(WideToUTF8(path).c_str(),
- locale_default_message_id);
-}
-
void PrefService::RegisterLocalizedStringPref(const char* path,
int locale_default_message_id) {
Preference* pref = new Preference(pref_value_store_.get(), path,
@@ -301,13 +242,6 @@ void PrefService::RegisterLocalizedStringPref(const char* path,
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterLocalizedStringPref(const wchar_t* path,
- int locale_default_message_id) {
- RegisterLocalizedStringPref(WideToUTF8(path).c_str(),
- locale_default_message_id);
-}
-
bool PrefService::GetBoolean(const char* path) const {
DCHECK(CalledOnValidThread());
@@ -323,11 +257,6 @@ bool PrefService::GetBoolean(const char* path) const {
return result;
}
-// TODO(viettrungluu): deprecate:
-bool PrefService::GetBoolean(const wchar_t* path) const {
- return GetBoolean(WideToUTF8(path).c_str());
-}
-
int PrefService::GetInteger(const char* path) const {
DCHECK(CalledOnValidThread());
@@ -343,11 +272,6 @@ int PrefService::GetInteger(const char* path) const {
return result;
}
-// TODO(viettrungluu): deprecate:
-int PrefService::GetInteger(const wchar_t* path) const {
- return GetInteger(WideToUTF8(path).c_str());
-}
-
double PrefService::GetReal(const char* path) const {
DCHECK(CalledOnValidThread());
@@ -363,11 +287,6 @@ double PrefService::GetReal(const char* path) const {
return result;
}
-// TODO(viettrungluu): deprecate:
-double PrefService::GetReal(const wchar_t* path) const {
- return GetReal(WideToUTF8(path).c_str());
-}
-
std::string PrefService::GetString(const char* path) const {
DCHECK(CalledOnValidThread());
@@ -383,11 +302,6 @@ std::string PrefService::GetString(const char* path) const {
return result;
}
-// TODO(viettrungluu): deprecate:
-std::string PrefService::GetString(const wchar_t* path) const {
- return GetString(WideToUTF8(path).c_str());
-}
-
FilePath PrefService::GetFilePath(const char* path) const {
DCHECK(CalledOnValidThread());
@@ -407,20 +321,10 @@ FilePath PrefService::GetFilePath(const char* path) const {
return FilePath(result);
}
-// TODO(viettrungluu): deprecate:
-FilePath PrefService::GetFilePath(const wchar_t* path) const {
- return GetFilePath(WideToUTF8(path).c_str());
-}
-
bool PrefService::HasPrefPath(const char* path) const {
return pref_value_store_->HasPrefPath(path);
}
-// TODO(viettrungluu): deprecate:
-bool PrefService::HasPrefPath(const wchar_t* path) const {
- return HasPrefPath(WideToUTF8(path).c_str());
-}
-
const PrefService::Preference* PrefService::FindPreference(
const char* pref_name) const {
DCHECK(CalledOnValidThread());
@@ -429,12 +333,6 @@ const PrefService::Preference* PrefService::FindPreference(
return it == prefs_.end() ? NULL : *it;
}
-// TODO(viettrungluu): deprecate:
-const PrefService::Preference* PrefService::FindPreference(
- const wchar_t* pref_name) const {
- return FindPreference(WideToUTF8(pref_name).c_str());
-}
-
bool PrefService::IsManagedPreference(const char* pref_name) const {
const Preference* pref = FindPreference(pref_name);
if (pref && pref->IsManaged()) {
@@ -443,11 +341,6 @@ bool PrefService::IsManagedPreference(const char* pref_name) const {
return false;
}
-// TODO(viettrungluu): deprecate:
-bool PrefService::IsManagedPreference(const wchar_t* pref_name) const {
- return IsManagedPreference(WideToUTF8(pref_name).c_str());
-}
-
void PrefService::FireObserversIfChanged(const char* path,
const Value* old_value) {
if (PrefIsChanged(path, old_value))
@@ -495,11 +388,6 @@ const DictionaryValue* PrefService::GetDictionary(const char* path) const {
return static_cast<const DictionaryValue*>(value);
}
-// TODO(viettrungluu): deprecate:
-const DictionaryValue* PrefService::GetDictionary(const wchar_t* path) const {
- return GetDictionary(WideToUTF8(path).c_str());
-}
-
const ListValue* PrefService::GetList(const char* path) const {
DCHECK(CalledOnValidThread());
@@ -514,11 +402,6 @@ const ListValue* PrefService::GetList(const char* path) const {
return static_cast<const ListValue*>(value);
}
-// TODO(viettrungluu): deprecate:
-const ListValue* PrefService::GetList(const wchar_t* path) const {
- return GetList(WideToUTF8(path).c_str());
-}
-
void PrefService::AddPrefObserver(const char* path,
NotificationObserver* obs) {
DCHECK(CalledOnValidThread());
@@ -553,12 +436,6 @@ void PrefService::AddPrefObserver(const char* path,
observer_list->AddObserver(obs);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::AddPrefObserver(const wchar_t* path,
- NotificationObserver* obs) {
- AddPrefObserver(WideToUTF8(path).c_str(), obs);
-}
-
void PrefService::RemovePrefObserver(const char* path,
NotificationObserver* obs) {
DCHECK(CalledOnValidThread());
@@ -572,12 +449,6 @@ void PrefService::RemovePrefObserver(const char* path,
observer_list->RemoveObserver(obs);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RemovePrefObserver(const wchar_t* path,
- NotificationObserver* obs) {
- RemovePrefObserver(WideToUTF8(path).c_str(), obs);
-}
-
void PrefService::RegisterPreference(Preference* pref) {
DCHECK(CalledOnValidThread());
@@ -605,11 +476,6 @@ void PrefService::ClearPref(const char* path) {
FireObservers(path);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::ClearPref(const wchar_t* path) {
- ClearPref(WideToUTF8(path).c_str());
-}
-
void PrefService::Set(const char* path, const Value& value) {
DCHECK(CalledOnValidThread());
@@ -641,11 +507,6 @@ void PrefService::Set(const char* path, const Value& value) {
FireObserversIfChanged(path, old_value.get());
}
-// TODO(viettrungluu): deprecate:
-void PrefService::Set(const wchar_t* path, const Value& value) {
- Set(WideToUTF8(path).c_str(), value);
-}
-
void PrefService::SetBoolean(const char* path, bool value) {
DCHECK(CalledOnValidThread());
@@ -670,11 +531,6 @@ void PrefService::SetBoolean(const char* path, bool value) {
FireObserversIfChanged(path, old_value.get());
}
-// TODO(viettrungluu): deprecate:
-void PrefService::SetBoolean(const wchar_t* path, bool value) {
- SetBoolean(WideToUTF8(path).c_str(), value);
-}
-
void PrefService::SetInteger(const char* path, int value) {
DCHECK(CalledOnValidThread());
@@ -699,11 +555,6 @@ void PrefService::SetInteger(const char* path, int value) {
FireObserversIfChanged(path, old_value.get());
}
-// TODO(viettrungluu): deprecate:
-void PrefService::SetInteger(const wchar_t* path, int value) {
- SetInteger(WideToUTF8(path).c_str(), value);
-}
-
void PrefService::SetReal(const char* path, double value) {
DCHECK(CalledOnValidThread());
@@ -728,11 +579,6 @@ void PrefService::SetReal(const char* path, double value) {
FireObserversIfChanged(path, old_value.get());
}
-// TODO(viettrungluu): deprecate:
-void PrefService::SetReal(const wchar_t* path, double value) {
- SetReal(WideToUTF8(path).c_str(), value);
-}
-
void PrefService::SetString(const char* path, const std::string& value) {
DCHECK(CalledOnValidThread());
@@ -757,11 +603,6 @@ void PrefService::SetString(const char* path, const std::string& value) {
FireObserversIfChanged(path, old_value.get());
}
-// TODO(viettrungluu): deprecate:
-void PrefService::SetString(const wchar_t* path, const std::string& value) {
- SetString(WideToUTF8(path).c_str(), value);
-}
-
void PrefService::SetFilePath(const char* path, const FilePath& value) {
DCHECK(CalledOnValidThread());
@@ -794,11 +635,6 @@ void PrefService::SetFilePath(const char* path, const FilePath& value) {
FireObserversIfChanged(path, old_value.get());
}
-// TODO(viettrungluu): deprecate:
-void PrefService::SetFilePath(const wchar_t* path, const FilePath& value) {
- SetFilePath(WideToUTF8(path).c_str(), value);
-}
-
void PrefService::SetInt64(const char* path, int64 value) {
DCHECK(CalledOnValidThread());
@@ -823,11 +659,6 @@ void PrefService::SetInt64(const char* path, int64 value) {
FireObserversIfChanged(path, old_value.get());
}
-// TODO(viettrungluu): deprecate:
-void PrefService::SetInt64(const wchar_t* path, int64 value) {
- SetInt64(WideToUTF8(path).c_str(), value);
-}
-
int64 PrefService::GetInt64(const char* path) const {
DCHECK(CalledOnValidThread());
@@ -845,22 +676,12 @@ int64 PrefService::GetInt64(const char* path) const {
return val;
}
-// TODO(viettrungluu): deprecate:
-int64 PrefService::GetInt64(const wchar_t* path) const {
- return GetInt64(WideToUTF8(path).c_str());
-}
-
void PrefService::RegisterInt64Pref(const char* path, int64 default_value) {
Preference* pref = new Preference(pref_value_store_.get(), path,
Value::CreateStringValue(base::Int64ToString(default_value)));
RegisterPreference(pref);
}
-// TODO(viettrungluu): deprecate:
-void PrefService::RegisterInt64Pref(const wchar_t* path, int64 default_value) {
- RegisterInt64Pref(WideToUTF8(path).c_str(), default_value);
-}
-
DictionaryValue* PrefService::GetMutableDictionary(const char* path) {
DCHECK(CalledOnValidThread());
@@ -886,11 +707,6 @@ DictionaryValue* PrefService::GetMutableDictionary(const char* path) {
return dict;
}
-// TODO(viettrungluu): deprecate:
-DictionaryValue* PrefService::GetMutableDictionary(const wchar_t* path) {
- return GetMutableDictionary(WideToUTF8(path).c_str());
-}
-
ListValue* PrefService::GetMutableList(const char* path) {
DCHECK(CalledOnValidThread());
@@ -915,11 +731,6 @@ ListValue* PrefService::GetMutableList(const char* path) {
return list;
}
-// TODO(viettrungluu): deprecate:
-ListValue* PrefService::GetMutableList(const wchar_t* path) {
- return GetMutableList(WideToUTF8(path).c_str());
-}
-
Value* PrefService::GetPrefCopy(const char* path) {
DCHECK(CalledOnValidThread());
diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h
index 58e5ea9..53a8523 100644
--- a/chrome/browser/pref_service.h
+++ b/chrome/browser/pref_service.h
@@ -128,7 +128,6 @@ class PrefService : public NonThreadSafe,
// Returns true if the preference for the given preference name is available
// and is managed.
bool IsManagedPreference(const char* pref_name) const;
- /*DEPRECATED*/bool IsManagedPreference(const wchar_t* pref_name) const;
// Writes the data to disk. The return value only reflects whether
// serialization was successful; we don't know whether the data actually made
@@ -148,18 +147,6 @@ class PrefService : public NonThreadSafe,
void RegisterFilePathPref(const char* path, const FilePath& default_value);
void RegisterListPref(const char* path);
void RegisterDictionaryPref(const char* path);
- /*DEPRECATED*/void RegisterBooleanPref(const wchar_t* path,
- bool default_value);
- /*DEPRECATED*/void RegisterIntegerPref(const wchar_t* path,
- int default_value);
- /*DEPRECATED*/void RegisterRealPref(const wchar_t* path,
- double default_value);
- /*DEPRECATED*/void RegisterStringPref(const wchar_t* path,
- const std::string& default_value);
- /*DEPRECATED*/void RegisterFilePathPref(const wchar_t* path,
- const FilePath& default_value);
- /*DEPRECATED*/void RegisterListPref(const wchar_t* path);
- /*DEPRECATED*/void RegisterDictionaryPref(const wchar_t* path);
// These varients use a default value from the locale dll instead.
void RegisterLocalizedBooleanPref(const char* path,
@@ -170,14 +157,6 @@ class PrefService : public NonThreadSafe,
int locale_default_message_id);
void RegisterLocalizedStringPref(const char* path,
int locale_default_message_id);
- /*DEPRECATED*/void RegisterLocalizedBooleanPref(const wchar_t* path,
- int locale_default_message_id);
- /*DEPRECATED*/void RegisterLocalizedIntegerPref(const wchar_t* path,
- int locale_default_message_id);
- /*DEPRECATED*/void RegisterLocalizedRealPref(const wchar_t* path,
- int locale_default_message_id);
- /*DEPRECATED*/void RegisterLocalizedStringPref(const wchar_t* path,
- int locale_default_message_id);
// If the path is valid and the value at the end of the path matches the type
// specified, it will return the specified value. Otherwise, the default
@@ -187,31 +166,19 @@ class PrefService : public NonThreadSafe,
double GetReal(const char* path) const;
std::string GetString(const char* path) const;
FilePath GetFilePath(const char* path) const;
- /*DEPRECATED*/bool GetBoolean(const wchar_t* path) const;
- /*DEPRECATED*/int GetInteger(const wchar_t* path) const;
- /*DEPRECATED*/double GetReal(const wchar_t* path) const;
- /*DEPRECATED*/std::string GetString(const wchar_t* path) const;
- /*DEPRECATED*/FilePath GetFilePath(const wchar_t* path) const;
// Returns the branch if it exists. If it's not a branch or the branch does
// not exist, returns NULL.
const DictionaryValue* GetDictionary(const char* path) const;
const ListValue* GetList(const char* path) const;
- /*DEPRECATED*/const DictionaryValue* GetDictionary(const wchar_t* path) const;
- /*DEPRECATED*/const ListValue* GetList(const wchar_t* path) const;
// If the pref at the given path changes, we call the observer's Observe
// method with NOTIFY_PREF_CHANGED.
virtual void AddPrefObserver(const char* path, NotificationObserver* obs);
void RemovePrefObserver(const char* path, NotificationObserver* obs);
- /*DEPRECATED*/virtual void AddPrefObserver(const wchar_t* path,
- NotificationObserver* obs);
- /*DEPRECATED*/void RemovePrefObserver(const wchar_t* path,
- NotificationObserver* obs);
// Removes a user pref and restores the pref to its default value.
void ClearPref(const char* path);
- /*DEPRECATED*/void ClearPref(const wchar_t* path);
// If the path is valid (i.e., registered), update the pref value in the user
// prefs.
@@ -221,12 +188,6 @@ class PrefService : public NonThreadSafe,
void SetReal(const char* path, double value);
void SetString(const char* path, const std::string& value);
void SetFilePath(const char* path, const FilePath& value);
- /*DEPRECATED*/void Set(const wchar_t* path, const Value& value);
- /*DEPRECATED*/void SetBoolean(const wchar_t* path, bool value);
- /*DEPRECATED*/void SetInteger(const wchar_t* path, int value);
- /*DEPRECATED*/void SetReal(const wchar_t* path, double value);
- /*DEPRECATED*/void SetString(const wchar_t* path, const std::string& value);
- /*DEPRECATED*/void SetFilePath(const wchar_t* path, const FilePath& value);
// Int64 helper methods that actually store the given value as a string.
// Note that if obtaining the named value via GetDictionary or GetList, the
@@ -234,10 +195,6 @@ class PrefService : public NonThreadSafe,
void SetInt64(const char* path, int64 value);
int64 GetInt64(const char* path) const;
void RegisterInt64Pref(const char* path, int64 default_value);
- /*DEPRECATED*/void SetInt64(const wchar_t* path, int64 value);
- /*DEPRECATED*/int64 GetInt64(const wchar_t* path) const;
- /*DEPRECATED*/void RegisterInt64Pref(const wchar_t* path,
- int64 default_value);
// Used to set the value of dictionary or list values in the pref tree. This
// will create a dictionary or list if one does not exist in the pref tree.
@@ -248,15 +205,12 @@ class PrefService : public NonThreadSafe,
// Use a ScopedPrefUpdate to update observers on changes.
DictionaryValue* GetMutableDictionary(const char* path);
ListValue* GetMutableList(const char* path);
- /*DEPRECATED*/DictionaryValue* GetMutableDictionary(const wchar_t* path);
- /*DEPRECATED*/ListValue* GetMutableList(const wchar_t* path);
// Returns true if a value has been set for the specified path.
// NOTE: this is NOT the same as FindPreference. In particular
// FindPreference returns whether RegisterXXX has been invoked, where as
// this checks if a value exists for the path.
bool HasPrefPath(const char* path) const;
- /*DEPRECATED*/bool HasPrefPath(const wchar_t* path) const;
class PreferencePathComparator {
public:
@@ -270,8 +224,6 @@ class PrefService : public NonThreadSafe,
// A helper method to quickly look up a preference. Returns NULL if the
// preference is not registered.
const Preference* FindPreference(const char* pref_name) const;
- /*DEPRECATED*/const Preference* FindPreference(
- const wchar_t* pref_name) const;
// For the given pref_name, fire any observer of the pref only if |old_value|
// is different from the current value. Virtual so it can be mocked for a
diff --git a/chrome/browser/views/chrome_views_delegate.cc b/chrome/browser/views/chrome_views_delegate.cc
index de824db..d56748e 100644
--- a/chrome/browser/views/chrome_views_delegate.cc
+++ b/chrome/browser/views/chrome_views_delegate.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.
@@ -6,6 +6,7 @@
#include "app/clipboard/clipboard.h"
#include "base/scoped_ptr.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/views/accessibility_event_router_views.h"
@@ -31,21 +32,21 @@ void ChromeViewsDelegate::SaveWindowPlacement(const std::wstring& window_name,
DictionaryValue* window_preferences =
g_browser_process->local_state()->GetMutableDictionary(
- window_name.c_str());
- window_preferences->SetInteger(L"left", bounds.x());
- window_preferences->SetInteger(L"top", bounds.y());
- window_preferences->SetInteger(L"right", bounds.right());
- window_preferences->SetInteger(L"bottom", bounds.bottom());
- window_preferences->SetBoolean(L"maximized", maximized);
+ WideToUTF8(window_name).c_str());
+ window_preferences->SetInteger("left", bounds.x());
+ window_preferences->SetInteger("top", bounds.y());
+ window_preferences->SetInteger("right", bounds.right());
+ window_preferences->SetInteger("bottom", bounds.bottom());
+ window_preferences->SetBoolean("maximized", maximized);
scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_info_provider(
WindowSizer::CreateDefaultMonitorInfoProvider());
gfx::Rect work_area(
monitor_info_provider->GetMonitorWorkAreaMatching(bounds));
- window_preferences->SetInteger(L"work_area_left", work_area.x());
- window_preferences->SetInteger(L"work_area_top", work_area.y());
- window_preferences->SetInteger(L"work_area_right", work_area.right());
- window_preferences->SetInteger(L"work_area_bottom", work_area.bottom());
+ window_preferences->SetInteger("work_area_left", work_area.x());
+ window_preferences->SetInteger("work_area_top", work_area.y());
+ window_preferences->SetInteger("work_area_right", work_area.right());
+ window_preferences->SetInteger("work_area_bottom", work_area.bottom());
}
bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name,
@@ -54,12 +55,13 @@ bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name,
return false;
const DictionaryValue* dictionary =
- g_browser_process->local_state()->GetDictionary(window_name.c_str());
+ g_browser_process->local_state()->GetDictionary(
+ WideToUTF8(window_name).c_str());
int left, top, right, bottom;
- if (!dictionary || !dictionary->GetInteger(L"left", &left) ||
- !dictionary->GetInteger(L"top", &top) ||
- !dictionary->GetInteger(L"right", &right) ||
- !dictionary->GetInteger(L"bottom", &bottom))
+ if (!dictionary || !dictionary->GetInteger("left", &left) ||
+ !dictionary->GetInteger("top", &top) ||
+ !dictionary->GetInteger("right", &right) ||
+ !dictionary->GetInteger("bottom", &bottom))
return false;
bounds->SetRect(left, top, right - left, bottom - top);
@@ -73,8 +75,9 @@ bool ChromeViewsDelegate::GetSavedMaximizedState(
return false;
const DictionaryValue* dictionary =
- g_browser_process->local_state()->GetDictionary(window_name.c_str());
- return dictionary && dictionary->GetBoolean(L"maximized", maximized) &&
+ g_browser_process->local_state()->GetDictionary(
+ WideToUTF8(window_name).c_str());
+ return dictionary && dictionary->GetBoolean("maximized", maximized) &&
maximized;
}
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc
index 8a2df06..68db592 100644
--- a/chrome/browser/views/options/languages_page_view.cc
+++ b/chrome/browser/views/options/languages_page_view.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.
@@ -405,7 +405,7 @@ void LanguagesPageView::NotifyPrefChanged(const std::string* pref_name) {
}
if (!pref_name || *pref_name == prefs::kApplicationLocale) {
int index = ui_language_model_->GetSelectedLanguageIndex(
- UTF8ToWide(prefs::kApplicationLocale));
+ prefs::kApplicationLocale);
if (-1 == index) {
// The pref value for locale isn't valid. Use the current app locale
// (which is what we're currently using).
@@ -418,7 +418,7 @@ void LanguagesPageView::NotifyPrefChanged(const std::string* pref_name) {
}
if (!pref_name || *pref_name == prefs::kSpellCheckDictionary) {
int index = dictionary_language_model_->GetSelectedLanguageIndex(
- UTF8ToWide(prefs::kSpellCheckDictionary));
+ prefs::kSpellCheckDictionary);
// If the index for the current language cannot be found, it is due to
// the fact that the pref-member value for the last dictionary language
@@ -435,7 +435,7 @@ void LanguagesPageView::NotifyPrefChanged(const std::string* pref_name) {
dictionary_language_.SetValue(
SpellCheckCommon::GetLanguageFromLanguageRegion(lang_region));
index = dictionary_language_model_->GetSelectedLanguageIndex(
- UTF8ToWide(prefs::kSpellCheckDictionary));
+ prefs::kSpellCheckDictionary);
}
change_dictionary_language_combobox_->SetSelectedItem(index);
diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/views/task_manager_view.cc
index b83c42b..59142c3 100644
--- a/chrome/browser/views/task_manager_view.cc
+++ b/chrome/browser/views/task_manager_view.cc
@@ -540,8 +540,8 @@ bool TaskManagerView::ExecuteWindowsCommand(int command_id) {
if (g_browser_process->local_state()) {
DictionaryValue* window_preferences =
g_browser_process->local_state()->GetMutableDictionary(
- GetWindowName().c_str());
- window_preferences->SetBoolean(L"always_on_top", is_always_on_top_);
+ WideToUTF8(GetWindowName()).c_str());
+ window_preferences->SetBoolean("always_on_top", is_always_on_top_);
}
return true;
}
@@ -673,9 +673,10 @@ bool TaskManagerView::GetSavedAlwaysOnTopState(bool* always_on_top) const {
return false;
const DictionaryValue* dictionary =
- g_browser_process->local_state()->GetDictionary(GetWindowName().c_str());
+ g_browser_process->local_state()->GetDictionary(
+ WideToUTF8(GetWindowName()).c_str());
return dictionary &&
- dictionary->GetBoolean(L"always_on_top", always_on_top) && always_on_top;
+ dictionary->GetBoolean("always_on_top", always_on_top) && always_on_top;
}
} // namespace