diff options
131 files changed, 1688 insertions, 1471 deletions
diff --git a/chrome/browser/autofill/autofill_dialog_gtk.cc b/chrome/browser/autofill/autofill_dialog_gtk.cc index 0616d27..d832e69 100644 --- a/chrome/browser/autofill/autofill_dialog_gtk.cc +++ b/chrome/browser/autofill/autofill_dialog_gtk.cc @@ -234,7 +234,7 @@ void AutoFillDialog::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { DCHECK_EQ(NotificationType::PREF_CHANGED, type.value); - const std::wstring* pref_name = Details<std::wstring>(details).ptr(); + const std::string* pref_name = Details<std::string>(details).ptr(); if (!pref_name || *pref_name == prefs::kAutoFillEnabled) { gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(form_autofill_enable_check_), diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index fdca465..2d44ff5 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -2200,10 +2200,10 @@ void AutomationProvider::GetPrefsInfo(Browser* browser, void AutomationProvider::SetPrefs(Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { - std::wstring path; + std::string path; Value* val; AutomationJSONReply reply(this, reply_message); - if (args->GetString(L"path", &path) && args->Get("value", &val)) { + if (args->GetString("path", &path) && args->Get("value", &val)) { PrefService* pref_service = profile_->GetPrefs(); const PrefService::Preference* pref = pref_service->FindPreference(path.c_str()); @@ -2933,7 +2933,7 @@ void AutomationProvider::WaitUntilTranslateComplete( scoped_ptr<DictionaryValue> return_value(new DictionaryValue); if (!translate_bar) { - return_value->SetBoolean(L"translation_success", false); + return_value->SetBoolean("translation_success", false); AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); return; } @@ -2947,7 +2947,7 @@ void AutomationProvider::WaitUntilTranslateComplete( // Otherwise send back the success or failure of the attempted translation. return_value->SetBoolean( - L"translation_success", + "translation_success", translate_bar->type() == TranslateInfoBarDelegate::AFTER_TRANSLATE); AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); } @@ -3937,7 +3937,7 @@ void AutomationProvider::WaitForNavigation(int handle, } void AutomationProvider::SetIntPreference(int handle, - const std::wstring& name, + const std::string& name, int value, bool* success) { *success = false; @@ -3949,7 +3949,7 @@ void AutomationProvider::SetIntPreference(int handle, } void AutomationProvider::SetStringPreference(int handle, - const std::wstring& name, + const std::string& name, const std::string& value, bool* success) { *success = false; @@ -3961,7 +3961,7 @@ void AutomationProvider::SetStringPreference(int handle, } void AutomationProvider::GetBooleanPreference(int handle, - const std::wstring& name, + const std::string& name, bool* success, bool* value) { *success = false; @@ -3974,7 +3974,7 @@ void AutomationProvider::GetBooleanPreference(int handle, } void AutomationProvider::SetBooleanPreference(int handle, - const std::wstring& name, + const std::string& name, bool value, bool* success) { *success = false; diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index f693d89..9ff8753 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -738,25 +738,25 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, // Sets the int value for preference with name |name|. void SetIntPreference(int handle, - const std::wstring& name, + const std::string& name, int value, bool* success); // Sets the string value for preference with name |name|. void SetStringPreference(int handle, - const std::wstring& name, + const std::string& name, const std::string& value, bool* success); // Gets the bool value for preference with name |name|. void GetBooleanPreference(int handle, - const std::wstring& name, + const std::string& name, bool* success, bool* value); // Sets the bool value for preference with name |name|. void SetBooleanPreference(int handle, - const std::wstring& name, + const std::string& name, bool value, bool* success); diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 7118ebf..83c6c48 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -312,7 +312,7 @@ Browser* Browser::CreateForType(Type type, Profile* profile) { } // static -Browser* Browser::CreateForApp(const std::wstring& app_name, +Browser* Browser::CreateForApp(const std::string& app_name, Extension* extension, Profile* profile, bool is_panel) { @@ -360,7 +360,7 @@ void Browser::CreateBrowserWindow() { // name. See http://crbug.com/7028. win_util::SetAppIdForWindow( type_ & TYPE_APP ? - ShellIntegration::GetAppId(app_name_, profile_->GetPath()) : + ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) : ShellIntegration::GetChromiumAppId(profile_->GetPath()), window()->GetNativeHandle()); #endif @@ -571,7 +571,7 @@ TabContents* Browser::OpenApplicationWindow( } // TODO(erikkay) this can't be correct for extensions - std::wstring app_name = web_app::GenerateApplicationNameFromURL(url); + std::string app_name = web_app::GenerateApplicationNameFromURL(url); RegisterAppPrefs(app_name); bool as_panel = extension && (container == Extension::LAUNCH_PANEL); @@ -673,10 +673,10 @@ void Browser::OpenExtensionsWindow(Profile* profile) { /////////////////////////////////////////////////////////////////////////////// // Browser, State Storage and Retrieval for UI: -std::wstring Browser::GetWindowPlacementKey() const { - std::wstring name(prefs::kBrowserWindowPlacement); +std::string Browser::GetWindowPlacementKey() const { + std::string name(prefs::kBrowserWindowPlacement); if (!app_name_.empty()) { - name.append(L"_"); + name.append("_"); name.append(app_name_); } return name; @@ -775,8 +775,7 @@ string16 Browser::GetWindowTitleForCurrentTab() const { void Browser::FormatTitleForDisplay(string16* title) { size_t current_index = 0; size_t match_index; - while ((match_index = title->find(L'\n', current_index)) != - std::wstring::npos) { + while ((match_index = title->find(L'\n', current_index)) != string16::npos) { title->replace(match_index, 1, string16()); current_index = match_index; } @@ -2748,7 +2747,7 @@ bool Browser::IsApplication() const { void Browser::ConvertContentsToApplication(TabContents* contents) { const GURL& url = contents->controller().GetActiveEntry()->url(); - std::wstring app_name = web_app::GenerateApplicationNameFromURL(url); + std::string app_name = web_app::GenerateApplicationNameFromURL(url); RegisterAppPrefs(app_name); DetachContents(contents); @@ -3085,7 +3084,7 @@ void Browser::Observe(NotificationType type, } case NotificationType::PREF_CHANGED: { - if (*(Details<std::wstring>(details).ptr()) == prefs::kUseVerticalTabs) + if (*(Details<std::string>(details).ptr()) == prefs::kUseVerticalTabs) UseVerticalTabsChanged(); else NOTREACHED(); @@ -4026,12 +4025,12 @@ void Browser::TabDetachedAtImpl(TabContents* contents, int index, } // static -void Browser::RegisterAppPrefs(const std::wstring& app_name) { +void Browser::RegisterAppPrefs(const std::string& app_name) { // A set of apps that we've already started. - static std::set<std::wstring>* g_app_names = NULL; + static std::set<std::string>* g_app_names = NULL; if (!g_app_names) - g_app_names = new std::set<std::wstring>; + g_app_names = new std::set<std::string>; // Only register once for each app name. if (g_app_names->find(app_name) != g_app_names->end()) @@ -4039,8 +4038,8 @@ void Browser::RegisterAppPrefs(const std::wstring& app_name) { g_app_names->insert(app_name); // We need to register the window position pref. - std::wstring window_pref(prefs::kBrowserWindowPlacement); - window_pref.append(L"_"); + std::string window_pref(prefs::kBrowserWindowPlacement); + window_pref.append("_"); window_pref.append(app_name); PrefService* prefs = g_browser_process->local_state(); DCHECK(prefs); diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 4a7c9fa..1041735 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -126,7 +126,7 @@ class Browser : public TabStripModelDelegate, // app. |app_name| is required and is used to identify the window to the // shell. |extension| is optional. If supplied, we create a window with // a bigger icon and title text, that supports tabs. - static Browser* CreateForApp(const std::wstring& app_name, + static Browser* CreateForApp(const std::string& app_name, Extension* extension, Profile* profile, bool is_panel); @@ -261,7 +261,7 @@ class Browser : public TabStripModelDelegate, // State Storage and Retrieval for UI /////////////////////////////////////// // Save and restore the window position. - std::wstring GetWindowPlacementKey() const; + std::string GetWindowPlacementKey() const; bool ShouldSaveWindowPlacement() const; void SaveWindowPlacement(const gfx::Rect& bounds, bool maximized); gfx::Rect GetSavedWindowBounds() const; @@ -901,7 +901,7 @@ class Browser : public TabStripModelDelegate, // Create a preference dictionary for the provided application name. This is // done only once per application name / per session. - static void RegisterAppPrefs(const std::wstring& app_name); + static void RegisterAppPrefs(const std::string& app_name); // Shared code between Reload() and ReloadIgnoringCache(). void ReloadInternal(WindowOpenDisposition disposition, bool ignore_cache); @@ -969,7 +969,7 @@ class Browser : public TabStripModelDelegate, // An optional application name which is used to retrieve and save window // positions. - std::wstring app_name_; + std::string app_name_; // Unique identifier of this browser for session restore. This id is only // unique within the current session, and is not guaranteed to be unique diff --git a/chrome/browser/browser_encoding_uitest.cc b/chrome/browser/browser_encoding_uitest.cc index ac3ac5d..e232c5e 100644 --- a/chrome/browser/browser_encoding_uitest.cc +++ b/chrome/browser/browser_encoding_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-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. #include <string> diff --git a/chrome/browser/chromeos/cros_settings.cc b/chrome/browser/chromeos/cros_settings.cc index d299c4f..84499b8 100644 --- a/chrome/browser/chromeos/cros_settings.cc +++ b/chrome/browser/chromeos/cros_settings.cc @@ -17,28 +17,28 @@ CrosSettings* CrosSettings::Get() { return Singleton<CrosSettings>::get(); } -bool CrosSettings::IsCrosSettings(const std::wstring& path) { - return StartsWith(path, kCrosSettingsPrefix, true); +bool CrosSettings::IsCrosSettings(const std::string& path) { + return StartsWithASCII(path, kCrosSettingsPrefix, true); } -void CrosSettings::SetBoolean(const std::wstring& path, bool in_value) { +void CrosSettings::SetBoolean(const std::string& path, bool in_value) { Set(path, Value::CreateBooleanValue(in_value)); } -void CrosSettings::SetInteger(const std::wstring& path, int in_value) { +void CrosSettings::SetInteger(const std::string& path, int in_value) { Set(path, Value::CreateIntegerValue(in_value)); } -void CrosSettings::SetReal(const std::wstring& path, double in_value) { +void CrosSettings::SetReal(const std::string& path, double in_value) { Set(path, Value::CreateRealValue(in_value)); } -void CrosSettings::SetString(const std::wstring& path, +void CrosSettings::SetString(const std::string& path, const std::string& in_value) { Set(path, Value::CreateStringValue(in_value)); } -bool CrosSettings::GetBoolean(const std::wstring& path, +bool CrosSettings::GetBoolean(const std::string& path, bool* bool_value) const { Value* value; if (!Get(path, &value)) @@ -63,7 +63,7 @@ bool CrosSettings::RemoveProvider(CrosSettingsProvider* provider) { } CrosSettingsProvider* CrosSettings::GetProvider( - const std::wstring& path) const { + const std::string& path) const { for (size_t i = 0; i < providers_.size(); ++i) { if (providers_[i]->HandlesSetting(path)){ return providers_[i]; @@ -72,7 +72,7 @@ CrosSettingsProvider* CrosSettings::GetProvider( return NULL; } -void CrosSettings::Set(const std::wstring& path, Value* in_value) { +void CrosSettings::Set(const std::string& path, Value* in_value) { CrosSettingsProvider* provider; provider = GetProvider(path); if (provider) { @@ -80,7 +80,7 @@ void CrosSettings::Set(const std::wstring& path, Value* in_value) { } } -bool CrosSettings::Get(const std::wstring& path, Value** out_value) const { +bool CrosSettings::Get(const std::string& path, Value** out_value) const { CrosSettingsProvider* provider; provider = GetProvider(path); if (provider) { @@ -89,7 +89,7 @@ bool CrosSettings::Get(const std::wstring& path, Value** out_value) const { return false; } -bool CrosSettings::GetInteger(const std::wstring& path, +bool CrosSettings::GetInteger(const std::string& path, int* out_value) const { Value* value; if (!Get(path, &value)) @@ -98,7 +98,7 @@ bool CrosSettings::GetInteger(const std::wstring& path, return value->GetAsInteger(out_value); } -bool CrosSettings::GetReal(const std::wstring& path, +bool CrosSettings::GetReal(const std::string& path, double* out_value) const { Value* value; if (!Get(path, &value)) @@ -107,7 +107,7 @@ bool CrosSettings::GetReal(const std::wstring& path, return value->GetAsReal(out_value); } -bool CrosSettings::GetString(const std::wstring& path, +bool CrosSettings::GetString(const std::string& path, std::string* out_value) const { Value* value; if (!Get(path, &value)) diff --git a/chrome/browser/chromeos/cros_settings.h b/chrome/browser/chromeos/cros_settings.h index 1b20ad3..0cf52ab 100644 --- a/chrome/browser/chromeos/cros_settings.h +++ b/chrome/browser/chromeos/cros_settings.h @@ -25,30 +25,30 @@ class CrosSettings { static CrosSettings* Get(); // Helper function to test if given path is a value cros settings name. - static bool IsCrosSettings(const std::wstring& path); + static bool IsCrosSettings(const std::string& path); // Sets |in_value| to given |path| in cros settings. // Note that this takes ownership of |in_value|. - void Set(const std::wstring& path, Value* in_value); + void Set(const std::string& path, Value* in_value); // Gets settings value of given |path| to |out_value|. // Note that |out_value| is still owned by this class. - bool Get(const std::wstring& path, Value** out_value) const; + bool Get(const std::string& path, Value** out_value) const; // Convenience forms of Set(). These methods will replace any existing // value at that path, even if it has a different type. - void SetBoolean(const std::wstring& path, bool in_value); - void SetInteger(const std::wstring& path, int in_value); - void SetReal(const std::wstring& path, double in_value); - void SetString(const std::wstring& path, const std::string& in_value); + void SetBoolean(const std::string& path, bool in_value); + void SetInteger(const std::string& path, int in_value); + void SetReal(const std::string& path, double in_value); + void SetString(const std::string& path, const std::string& in_value); // These are convenience forms of Get(). The value will be retrieved // and the return value will be true if the path is valid and the value at // the end of the path can be returned in the form specified. - bool GetBoolean(const std::wstring& path, bool* out_value) const; - bool GetInteger(const std::wstring& path, int* out_value) const; - bool GetReal(const std::wstring& path, double* out_value) const; - bool GetString(const std::wstring& path, std::string* out_value) const; + bool GetBoolean(const std::string& path, bool* out_value) const; + bool GetInteger(const std::string& path, int* out_value) const; + bool GetReal(const std::string& path, double* out_value) const; + bool GetString(const std::string& path, std::string* out_value) const; private: // adding/removing of providers @@ -59,7 +59,7 @@ class CrosSettings { CrosSettings(); ~CrosSettings(); - CrosSettingsProvider* GetProvider(const std::wstring& path) const; + CrosSettingsProvider* GetProvider(const std::string& path) const; friend struct DefaultSingletonTraits<CrosSettings>; DISALLOW_COPY_AND_ASSIGN(CrosSettings); }; diff --git a/chrome/browser/chromeos/cros_settings_names.cc b/chrome/browser/chromeos/cros_settings_names.cc index 6cbd59a..d234514 100644 --- a/chrome/browser/chromeos/cros_settings_names.cc +++ b/chrome/browser/chromeos/cros_settings_names.cc @@ -6,12 +6,12 @@ namespace chromeos { -const wchar_t kCrosSettingsPrefix[] = L"cros."; +const char kCrosSettingsPrefix[] = "cros."; -const wchar_t kAccountsPrefAllowBWSI[] = L"cros.accounts.allowBWSI"; -const wchar_t kAccountsPrefAllowGuest[] = L"cros.accounts.allowGuest"; -const wchar_t kAccountsPrefShowUserNamesOnSignIn[] - = L"cros.accounts.showUserNamesOnSignIn"; -const wchar_t kAccountsPrefUsers[] = L"cros.accounts.users"; +const char kAccountsPrefAllowBWSI[] = "cros.accounts.allowBWSI"; +const char kAccountsPrefAllowGuest[] = "cros.accounts.allowGuest"; +const char kAccountsPrefShowUserNamesOnSignIn[] + = "cros.accounts.showUserNamesOnSignIn"; +const char kAccountsPrefUsers[] = "cros.accounts.users"; } // namespace chromeos diff --git a/chrome/browser/chromeos/cros_settings_names.h b/chrome/browser/chromeos/cros_settings_names.h index 7532fa4..21a7a1a 100644 --- a/chrome/browser/chromeos/cros_settings_names.h +++ b/chrome/browser/chromeos/cros_settings_names.h @@ -8,12 +8,12 @@ namespace chromeos { -extern const wchar_t kCrosSettingsPrefix[]; +extern const char kCrosSettingsPrefix[]; -extern const wchar_t kAccountsPrefAllowBWSI[]; -extern const wchar_t kAccountsPrefAllowGuest[]; -extern const wchar_t kAccountsPrefShowUserNamesOnSignIn[]; -extern const wchar_t kAccountsPrefUsers[]; +extern const char kAccountsPrefAllowBWSI[]; +extern const char kAccountsPrefAllowGuest[]; +extern const char kAccountsPrefShowUserNamesOnSignIn[]; +extern const char kAccountsPrefUsers[]; } // namespace chromeos diff --git a/chrome/browser/chromeos/cros_settings_provider.h b/chrome/browser/chromeos/cros_settings_provider.h index e4184ed7..c069ce1 100644 --- a/chrome/browser/chromeos/cros_settings_provider.h +++ b/chrome/browser/chromeos/cros_settings_provider.h @@ -17,14 +17,14 @@ class CrosSettingsProvider { // Sets |in_value| to given |path| in cros settings. // Note that this takes ownership of |in_value|. - virtual void Set(const std::wstring& path, Value* in_value) = 0; + virtual void Set(const std::string& path, Value* in_value) = 0; // Gets settings value of given |path| to |out_value|. // Note that |out_value| is still owned by this class. - virtual bool Get(const std::wstring& path, Value** out_value) const = 0; + virtual bool Get(const std::string& path, Value** out_value) const = 0; // Gets the namespace prefix provided by this provider - virtual bool HandlesSetting(const std::wstring& path) = 0; + virtual bool HandlesSetting(const std::string& path) = 0; }; } // namespace chromeos diff --git a/chrome/browser/chromeos/cros_settings_provider_user.cc b/chrome/browser/chromeos/cros_settings_provider_user.cc index 900427a..1cdde9f 100644 --- a/chrome/browser/chromeos/cros_settings_provider_user.cc +++ b/chrome/browser/chromeos/cros_settings_provider_user.cc @@ -33,17 +33,17 @@ UserCrosSettingsProvider::UserCrosSettingsProvider() Set(kAccountsPrefUsers, user_list); } -void UserCrosSettingsProvider::Set(const std::wstring& path, Value* in_value) { +void UserCrosSettingsProvider::Set(const std::string& path, Value* in_value) { dict_->Set(path, in_value); } -bool UserCrosSettingsProvider::Get(const std::wstring& path, +bool UserCrosSettingsProvider::Get(const std::string& path, Value** out_value) const { return dict_->Get(path, out_value); } -bool UserCrosSettingsProvider::HandlesSetting(const std::wstring& path) { - return ::StartsWith(path, std::wstring(L"cros.accounts"), true); +bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) { + return ::StartsWithASCII(path, "cros.accounts", true); } } // namespace chromeos diff --git a/chrome/browser/chromeos/cros_settings_provider_user.h b/chrome/browser/chromeos/cros_settings_provider_user.h index de31493..42f2213 100644 --- a/chrome/browser/chromeos/cros_settings_provider_user.h +++ b/chrome/browser/chromeos/cros_settings_provider_user.h @@ -16,9 +16,9 @@ namespace chromeos { class UserCrosSettingsProvider : public CrosSettingsProvider { public: - virtual void Set(const std::wstring& path, Value* in_value); - virtual bool Get(const std::wstring& path, Value** out_value) const; - virtual bool HandlesSetting(const std::wstring& path); + virtual void Set(const std::string& path, Value* in_value); + virtual bool Get(const std::string& path, Value** out_value) const; + virtual bool HandlesSetting(const std::string& path); UserCrosSettingsProvider(); private: diff --git a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc index 2f73048..8321ca6 100644 --- a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc @@ -10,7 +10,7 @@ namespace chromeos { -Value* CoreChromeOSOptionsHandler::FetchPref(const std::wstring& pref_name) { +Value* CoreChromeOSOptionsHandler::FetchPref(const std::string& pref_name) { if (!CrosSettings::IsCrosSettings(pref_name)) return ::CoreOptionsHandler::FetchPref(pref_name); @@ -19,14 +19,14 @@ Value* CoreChromeOSOptionsHandler::FetchPref(const std::wstring& pref_name) { return pref_value ? pref_value->DeepCopy() : Value::CreateNullValue(); } -void CoreChromeOSOptionsHandler::ObservePref(const std::wstring& pref_name) { +void CoreChromeOSOptionsHandler::ObservePref(const std::string& pref_name) { if (!CrosSettings::IsCrosSettings(pref_name)) return ::CoreOptionsHandler::ObservePref(pref_name); // TODO(xiyuan): Change this when CrosSettings supports observers. } -void CoreChromeOSOptionsHandler::SetPref(const std::wstring& pref_name, +void CoreChromeOSOptionsHandler::SetPref(const std::string& pref_name, Value::ValueType pref_type, const std::string& value_string) { if (!CrosSettings::IsCrosSettings(pref_name)) diff --git a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h index 4004a90..f0d7956 100644 --- a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h +++ b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h @@ -16,9 +16,9 @@ class CoreChromeOSOptionsHandler : public ::CoreOptionsHandler { protected: // ::CoreOptionsHandler Implementation - virtual Value* FetchPref(const std::wstring& pref_name); - virtual void ObservePref(const std::wstring& pref_name); - virtual void SetPref(const std::wstring& pref_name, + virtual Value* FetchPref(const std::string& pref_name); + virtual void ObservePref(const std::string& pref_name); + virtual void SetPref(const std::string& pref_name, Value::ValueType pref_type, const std::string& value_string); diff --git a/chrome/browser/chromeos/language_preferences.h b/chrome/browser/chromeos/language_preferences.h index 55962b75..bc08750 100644 --- a/chrome/browser/chromeos/language_preferences.h +++ b/chrome/browser/chromeos/language_preferences.h @@ -15,7 +15,7 @@ namespace chromeos { template <typename DataType> struct LanguageMultipleChoicePreference { - const wchar_t* pref_name; // Chrome preference name. + const char* pref_name; // Chrome preference name. DataType default_pref_value; const char* ibus_config_name; // Currently we have 10 combobox items at most. @@ -28,14 +28,14 @@ struct LanguageMultipleChoicePreference { }; struct LanguageBooleanPrefs { - const wchar_t* pref_name; // Chrome preference name. + const char* pref_name; // Chrome preference name. bool default_pref_value; const char* ibus_config_name; int message_id; }; struct LanguageIntegerRangePreference { - const wchar_t* pref_name; // Chrome preference name. + const char* pref_name; // Chrome preference name. int default_pref_value; int min_pref_value; int max_pref_value; @@ -242,7 +242,7 @@ const LanguageMultipleChoicePreference<int> kPinyinDoublePinyinSchema = { }; const struct { - const wchar_t* pref_name; // Chrome preference name. + const char* pref_name; // Chrome preference name. int default_pref_value; const char* ibus_config_name; // TODO(yusukes): Add message_id if needed. @@ -421,7 +421,7 @@ const size_t kNumMozcIntegerPrefs = arraysize(kMozcIntegerPrefs); // A string Chrome preference (Local State) of the preferred keyboard layout in // the login screen. -const wchar_t kPreferredKeyboardLayout[] = L"PreferredKeyboardLayout"; +const char kPreferredKeyboardLayout[] = "PreferredKeyboardLayout"; // A input method name that corresponds the hardware keyboard layout. // TODO(yusukes): just assuming US qwerty keyboard is not always correct. diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc index de6e4b8..416a474 100644 --- a/chrome/browser/chromeos/options/system_page_view.cc +++ b/chrome/browser/chromeos/options/system_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. @@ -214,7 +214,7 @@ class TouchpadSection : public SettingsPageSection, protected: // SettingsPageSection overrides: virtual void InitContents(GridLayout* layout); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: // The View that contains the contents of the section. @@ -328,7 +328,7 @@ void TouchpadSection::InitContents(GridLayout* layout) { profile()->GetPrefs(), this); } -void TouchpadSection::NotifyPrefChanged(const std::wstring* pref_name) { +void TouchpadSection::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { bool enabled = tap_to_click_enabled_.GetValue(); enable_tap_to_click_checkbox_->SetChecked(enabled); @@ -364,7 +364,7 @@ class LanguageSection : public SettingsPageSection, }; // Overridden from SettingsPageSection: virtual void InitContents(GridLayout* layout); - void NotifyPrefChanged(const std::wstring* pref_name); + void NotifyPrefChanged(const std::string* pref_name); // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, @@ -424,7 +424,7 @@ void LanguageSection::ItemChanged(views::Combobox* sender, xkb_pref_.SetValue(new_index); } -void LanguageSection::NotifyPrefChanged(const std::wstring* pref_name) { +void LanguageSection::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kLanguageXkbModifierRemap) { const int id = xkb_pref_.GetValue(); if (id >= 0) { @@ -450,7 +450,7 @@ class AccessibilitySection : public SettingsPageSection, // Overridden from SettingsPageSection: virtual void InitContents(GridLayout* layout); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: // The View that contains the contents of the section. @@ -495,7 +495,7 @@ void AccessibilitySection::ButtonPressed( } } -void AccessibilitySection::NotifyPrefChanged(const std::wstring* pref_name) { +void AccessibilitySection::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kAccessibilityEnabled) { bool enabled = accessibility_enabled_.GetValue(); accessibility_checkbox_->SetChecked(enabled); diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index c950b3a..30a53d8 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -180,10 +180,10 @@ void Preferences::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) - NotifyPrefChanged(Details<std::wstring>(details).ptr()); + NotifyPrefChanged(Details<std::string>(details).ptr()); } -void Preferences::NotifyPrefChanged(const std::wstring* pref_name) { +void Preferences::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { CrosLibrary::Get()->GetSynapticsLibrary()->SetBoolParameter( PARAM_BOOL_TAP_TO_CLICK, diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h index 60aa75e..b1b8649 100644 --- a/chrome/browser/chromeos/preferences.h +++ b/chrome/browser/chromeos/preferences.h @@ -41,7 +41,7 @@ class Preferences : public NotificationObserver { // This will set the OS settings when the preference changes. // If this method is called with NULL, it will set all OS settings to what's // stored in the preferences. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: // Writes boolean |value| to the input method (IBus) configuration daemon. diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.mm b/chrome/browser/cocoa/content_settings_dialog_controller.mm index 2befeaf..147895c 100644 --- a/chrome/browser/cocoa/content_settings_dialog_controller.mm +++ b/chrome/browser/cocoa/content_settings_dialog_controller.mm @@ -45,7 +45,7 @@ ContentSettingsDialogController* g_instance = nil; // Callback when preferences are changed. |prefName| is the name of the // pref that has changed. -- (void)prefChanged:(std::wstring*)prefName; +- (void)prefChanged:(std::string*)prefName; @end @@ -63,7 +63,7 @@ class PrefObserverBridge : public NotificationObserver { const NotificationSource& source, const NotificationDetails& details) { if (!disabled_ && type == NotificationType::PREF_CHANGED) { - [controller_ prefChanged:Details<std::wstring>(details).ptr()]; + [controller_ prefChanged:Details<std::string>(details).ptr()]; } } @@ -504,7 +504,7 @@ class PrefObserverDisabler { // Callback when preferences are changed. |prefName| is the name of the // pref that has changed and should not be NULL. -- (void)prefChanged:(std::wstring*)prefName { +- (void)prefChanged:(std::string*)prefName { DCHECK(prefName); if (!prefName) return; if (*prefName == prefs::kClearSiteDataOnExit) { diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index 03e2978..93489bc 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -321,7 +321,7 @@ CGFloat AutoSizeUnderTheHoodContent(NSView* view, @interface PreferencesWindowController(Private) // Callback when preferences are changed. |prefName| is the name of the // pref that has changed. -- (void)prefChanged:(std::wstring*)prefName; +- (void)prefChanged:(std::string*)prefName; // Callback when sync state has changed. syncService_ needs to be // queried to find out what happened. - (void)syncStateChanged; @@ -372,7 +372,7 @@ class PrefObserverBridge : public NotificationObserver, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) - [controller_ prefChanged:Details<std::wstring>(details).ptr()]; + [controller_ prefChanged:Details<std::string>(details).ptr()]; } // Overridden from ProfileSyncServiceObserver. @@ -877,7 +877,7 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase { // Windows, we don't need to use this method for initializing, that's handled by // Cocoa Bindings. // Handles prefs for the "Basics" panel. -- (void)basicsPrefChanged:(std::wstring*)prefName { +- (void)basicsPrefChanged:(std::string*)prefName { if (*prefName == prefs::kRestoreOnStartup) { const SessionStartupPref startupPref = SessionStartupPref::GetStartupPref(prefs_); @@ -1201,7 +1201,7 @@ const int kDisabledIndex = 1; // that has changed. Unlike on Windows, we don't need to use this method for // initializing, that's handled by Cocoa Bindings. // Handles prefs for the "Personal Stuff" panel. -- (void)userDataPrefChanged:(std::wstring*)prefName { +- (void)userDataPrefChanged:(std::string*)prefName { if (*prefName == prefs::kPasswordManagerEnabled) { [self setPasswordManagerEnabledIndex:askSavePasswords_.GetValue() ? kEnabledIndex : kDisabledIndex]; @@ -1359,7 +1359,7 @@ const int kDisabledIndex = 1; // that has changed. Unlike on Windows, we don't need to use this method for // initializing, that's handled by Cocoa Bindings. // Handles prefs for the "Under the hood" panel. -- (void)underHoodPrefChanged:(std::wstring*)prefName { +- (void)underHoodPrefChanged:(std::string*)prefName { if (*prefName == prefs::kAlternateErrorPagesEnabled) { [self setShowAlternateErrorPages: alternateErrorPages_.GetValue() ? YES : NO]; @@ -1733,7 +1733,7 @@ const int kDisabledIndex = 1; // Callback when preferences are changed. |prefName| is the name of the // pref that has changed and should not be NULL. -- (void)prefChanged:(std::wstring*)prefName { +- (void)prefChanged:(std::string*)prefName { DCHECK(prefName); if (!prefName) return; [self basicsPrefChanged:prefName]; diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index f36dde5..db37585 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -80,7 +80,7 @@ const CGFloat kWrenchMenuLeftPadding = 3.0; @interface ToolbarController(Private) - (void)addAccessibilityDescriptions; - (void)initCommandStatus:(CommandUpdater*)commands; -- (void)prefChanged:(std::wstring*)prefName; +- (void)prefChanged:(std::string*)prefName; - (BackgroundGradientView*)backgroundGradientView; - (void)toolbarFrameChanged; - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; @@ -166,7 +166,7 @@ class NotificationBridge : public NotificationObserver { const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) - [controller_ prefChanged:Details<std::wstring>(details).ptr()]; + [controller_ prefChanged:Details<std::string>(details).ptr()]; else if (type == NotificationType::UPGRADE_RECOMMENDED) [controller_ badgeWrenchMenu]; } @@ -583,7 +583,7 @@ class NotificationBridge : public NotificationObserver { [wrenchMenuController_ insertUpdateAvailableItem]; } -- (void)prefChanged:(std::wstring*)prefName { +- (void)prefChanged:(std::string*)prefName { if (!prefName) return; if (*prefName == prefs::kShowHomeButton) { [self showOptionalHomeButton]; diff --git a/chrome/browser/cocoa/window_size_autosaver.h b/chrome/browser/cocoa/window_size_autosaver.h index f6fe2fd..be4dfc1 100644 --- a/chrome/browser/cocoa/window_size_autosaver.h +++ b/chrome/browser/cocoa/window_size_autosaver.h @@ -32,13 +32,13 @@ enum WindowSizeAutosaverState { @interface WindowSizeAutosaver : NSObject { NSWindow* window_; // weak PrefService* prefService_; // weak - const wchar_t* path_; + const char* path_; WindowSizeAutosaverState state_; } - (id)initWithWindow:(NSWindow*)window prefService:(PrefService*)prefs - path:(const wchar_t*)path + path:(const char*)path state:(WindowSizeAutosaverState)state; @end diff --git a/chrome/browser/cocoa/window_size_autosaver.mm b/chrome/browser/cocoa/window_size_autosaver.mm index a200090..581f6fc 100644 --- a/chrome/browser/cocoa/window_size_autosaver.mm +++ b/chrome/browser/cocoa/window_size_autosaver.mm @@ -25,7 +25,7 @@ const int kMinWindowHeight = 17; - (id)initWithWindow:(NSWindow*)window prefService:(PrefService*)prefs - path:(const wchar_t*)path + path:(const char*)path state:(WindowSizeAutosaverState)state { if ((self = [super init])) { window_ = window; @@ -58,17 +58,17 @@ const int kMinWindowHeight = 17; NSRect frame = [window_ frame]; if (state_ == kSaveWindowRect) { // Save the origin of the window. - windowPrefs->SetInteger(L"left", NSMinX(frame)); - windowPrefs->SetInteger(L"right", NSMaxX(frame)); + windowPrefs->SetInteger("left", NSMinX(frame)); + windowPrefs->SetInteger("right", NSMaxX(frame)); // windows's and linux's profiles have top < bottom due to having their // screen origin in the upper left, while cocoa's is in the lower left. To // keep the top < bottom invariant, store top in bottom and vice versa. - windowPrefs->SetInteger(L"top", NSMinY(frame)); - windowPrefs->SetInteger(L"bottom", NSMaxY(frame)); + windowPrefs->SetInteger("top", NSMinY(frame)); + windowPrefs->SetInteger("bottom", NSMaxY(frame)); } else if (state_ == kSaveWindowPos) { // Save the origin of the window. - windowPrefs->SetInteger(L"x", frame.origin.x); - windowPrefs->SetInteger(L"y", frame.origin.y); + windowPrefs->SetInteger("x", frame.origin.x); + windowPrefs->SetInteger("y", frame.origin.y); } else { NOTREACHED(); } @@ -79,18 +79,18 @@ const int kMinWindowHeight = 17; DictionaryValue* windowPrefs = prefService_->GetMutableDictionary(path_); if (state_ == kSaveWindowRect) { int x1, x2, y1, y2; - if (!windowPrefs->GetInteger(L"left", &x1) || - !windowPrefs->GetInteger(L"right", &x2) || - !windowPrefs->GetInteger(L"top", &y1) || - !windowPrefs->GetInteger(L"bottom", &y2)) { + if (!windowPrefs->GetInteger("left", &x1) || + !windowPrefs->GetInteger("right", &x2) || + !windowPrefs->GetInteger("top", &y1) || + !windowPrefs->GetInteger("bottom", &y2)) { return; } if (x2 - x1 < kMinWindowWidth || y2 - y1 < kMinWindowHeight) { // Windows should never be very small. - windowPrefs->Remove(L"left", NULL); - windowPrefs->Remove(L"right", NULL); - windowPrefs->Remove(L"top", NULL); - windowPrefs->Remove(L"bottom", NULL); + windowPrefs->Remove("left", NULL); + windowPrefs->Remove("right", NULL); + windowPrefs->Remove("top", NULL); + windowPrefs->Remove("bottom", NULL); } else { [window_ setFrame:NSMakeRect(x1, y1, x2 - x1, y2 - y1) display:YES]; @@ -99,8 +99,8 @@ const int kMinWindowHeight = 17; } } else if (state_ == kSaveWindowPos) { int x, y; - if (!windowPrefs->GetInteger(L"x", &x) || - !windowPrefs->GetInteger(L"y", &y)) + if (!windowPrefs->GetInteger("x", &x) || + !windowPrefs->GetInteger("y", &y)) return; // Nothing stored. // Turn the origin (lower-left) into an upper-left window point. NSPoint upperLeft = NSMakePoint(x, y + NSHeight([window_ frame])); diff --git a/chrome/browser/cocoa/window_size_autosaver_unittest.mm b/chrome/browser/cocoa/window_size_autosaver_unittest.mm index b3ce0d2..163b5a1 100644 --- a/chrome/browser/cocoa/window_size_autosaver_unittest.mm +++ b/chrome/browser/cocoa/window_size_autosaver_unittest.mm @@ -18,7 +18,7 @@ namespace { class WindowSizeAutosaverTest : public CocoaTest { virtual void SetUp() { CocoaTest::SetUp(); - path_ = L"WindowSizeAutosaverTest"; + path_ = "WindowSizeAutosaverTest"; window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 101, 150, 151) styleMask:NSTitledWindowMask @@ -35,7 +35,7 @@ class WindowSizeAutosaverTest : public CocoaTest { public: BrowserTestHelper browser_helper_; NSWindow* window_; - const wchar_t* path_; + const char* path_; }; TEST_F(WindowSizeAutosaverTest, RestoresAndSavesPos) { @@ -87,12 +87,12 @@ TEST_F(WindowSizeAutosaverTest, RestoresAndSavesPos) { EXPECT_TRUE(pref->GetDictionary(path_) != NULL); int x, y; DictionaryValue* windowPref = pref->GetMutableDictionary(path_); - EXPECT_FALSE(windowPref->GetInteger(L"left", &x)); - EXPECT_FALSE(windowPref->GetInteger(L"right", &x)); - EXPECT_FALSE(windowPref->GetInteger(L"top", &x)); - EXPECT_FALSE(windowPref->GetInteger(L"bottom", &x)); - ASSERT_TRUE(windowPref->GetInteger(L"x", &x)); - ASSERT_TRUE(windowPref->GetInteger(L"y", &y)); + EXPECT_FALSE(windowPref->GetInteger("left", &x)); + EXPECT_FALSE(windowPref->GetInteger("right", &x)); + EXPECT_FALSE(windowPref->GetInteger("top", &x)); + EXPECT_FALSE(windowPref->GetInteger("bottom", &x)); + ASSERT_TRUE(windowPref->GetInteger("x", &x)); + ASSERT_TRUE(windowPref->GetInteger("y", &y)); EXPECT_EQ(300, x); EXPECT_EQ(310, y); } @@ -146,12 +146,12 @@ TEST_F(WindowSizeAutosaverTest, RestoresAndSavesRect) { EXPECT_TRUE(pref->GetDictionary(path_) != NULL); int x1, y1, x2, y2; DictionaryValue* windowPref = pref->GetMutableDictionary(path_); - EXPECT_FALSE(windowPref->GetInteger(L"x", &x1)); - EXPECT_FALSE(windowPref->GetInteger(L"y", &x1)); - ASSERT_TRUE(windowPref->GetInteger(L"left", &x1)); - ASSERT_TRUE(windowPref->GetInteger(L"right", &x2)); - ASSERT_TRUE(windowPref->GetInteger(L"top", &y1)); - ASSERT_TRUE(windowPref->GetInteger(L"bottom", &y2)); + EXPECT_FALSE(windowPref->GetInteger("x", &x1)); + EXPECT_FALSE(windowPref->GetInteger("y", &x1)); + ASSERT_TRUE(windowPref->GetInteger("left", &x1)); + ASSERT_TRUE(windowPref->GetInteger("right", &x2)); + ASSERT_TRUE(windowPref->GetInteger("top", &y1)); + ASSERT_TRUE(windowPref->GetInteger("bottom", &y2)); EXPECT_EQ(300, x1); EXPECT_EQ(310, y1); EXPECT_EQ(300 + 250, x2); @@ -164,10 +164,10 @@ TEST_F(WindowSizeAutosaverTest, DoesNotRestoreButClearsEmptyRect) { ASSERT_TRUE(pref != NULL); DictionaryValue* windowPref = pref->GetMutableDictionary(path_); - windowPref->SetInteger(L"left", 50); - windowPref->SetInteger(L"right", 50); - windowPref->SetInteger(L"top", 60); - windowPref->SetInteger(L"bottom", 60); + windowPref->SetInteger("left", 50); + windowPref->SetInteger("right", 50); + windowPref->SetInteger("top", 60); + windowPref->SetInteger("bottom", 60); { // Window rect shouldn't change... @@ -186,12 +186,12 @@ TEST_F(WindowSizeAutosaverTest, DoesNotRestoreButClearsEmptyRect) { // ...and it should be gone from the profile, too. EXPECT_TRUE(pref->GetDictionary(path_) != NULL); int x1, y1, x2, y2; - EXPECT_FALSE(windowPref->GetInteger(L"x", &x1)); - EXPECT_FALSE(windowPref->GetInteger(L"y", &x1)); - ASSERT_FALSE(windowPref->GetInteger(L"left", &x1)); - ASSERT_FALSE(windowPref->GetInteger(L"right", &x2)); - ASSERT_FALSE(windowPref->GetInteger(L"top", &y1)); - ASSERT_FALSE(windowPref->GetInteger(L"bottom", &y2)); + EXPECT_FALSE(windowPref->GetInteger("x", &x1)); + EXPECT_FALSE(windowPref->GetInteger("y", &x1)); + ASSERT_FALSE(windowPref->GetInteger("left", &x1)); + ASSERT_FALSE(windowPref->GetInteger("right", &x2)); + ASSERT_FALSE(windowPref->GetInteger("top", &y1)); + ASSERT_FALSE(windowPref->GetInteger("bottom", &y2)); } } // namespace diff --git a/chrome/browser/command_line_pref_store.h b/chrome/browser/command_line_pref_store.h index f577e00..5e92636 100644 --- a/chrome/browser/command_line_pref_store.h +++ b/chrome/browser/command_line_pref_store.h @@ -37,7 +37,7 @@ class CommandLinePrefStore : public PrefStore { struct StringSwitchToPreferenceMapEntry { const char* switch_name; - const wchar_t* preference_path; + const char* preference_path; }; static const StringSwitchToPreferenceMapEntry string_switch_map_[]; @@ -45,7 +45,7 @@ class CommandLinePrefStore : public PrefStore { // is present. struct BooleanSwitchToPreferenceMapEntry { const char* switch_name; - const wchar_t* preference_path; + const char* preference_path; bool set_value; }; static const BooleanSwitchToPreferenceMapEntry boolean_switch_map_[]; diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 91ace00..bf027c0 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -26,7 +26,7 @@ #include "chrome/common/url_constants.h" #include "grit/generated_resources.h" -const std::wstring DevToolsWindow::kDevToolsApp = L"DevToolsApp"; +const char DevToolsWindow::kDevToolsApp[] = "DevToolsApp"; // static TabContents* DevToolsWindow::GetDevToolsContents(TabContents* inspected_tab) { @@ -195,9 +195,9 @@ RenderViewHost* DevToolsWindow::GetRenderViewHost() { void DevToolsWindow::CreateDevToolsBrowser() { // TODO(pfeldman): Make browser's getter for this key static. - std::wstring wp_key = L""; + std::string wp_key; wp_key.append(prefs::kBrowserWindowPlacement); - wp_key.append(L"_"); + wp_key.append("_"); wp_key.append(kDevToolsApp); PrefService* prefs = g_browser_process->local_state(); diff --git a/chrome/browser/debugger/devtools_window.h b/chrome/browser/debugger/devtools_window.h index 5e9e08b..d69e7d5 100644 --- a/chrome/browser/debugger/devtools_window.h +++ b/chrome/browser/debugger/devtools_window.h @@ -31,7 +31,7 @@ class DevToolsWindow public NotificationObserver, public TabContentsDelegate { public: - static const std::wstring kDevToolsApp; + static const char kDevToolsApp[]; static TabContents* GetDevToolsContents(TabContents* inspected_tab); DevToolsWindow(Profile* profile, RenderViewHost* inspected_rvh, bool docked); diff --git a/chrome/browser/dom_ui/advanced_options_handler.cc b/chrome/browser/dom_ui/advanced_options_handler.cc index 64f0f60..464d7ff 100644 --- a/chrome/browser/dom_ui/advanced_options_handler.cc +++ b/chrome/browser/dom_ui/advanced_options_handler.cc @@ -179,7 +179,7 @@ void AdvancedOptionsHandler::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) { - std::wstring* pref_name = Details<std::wstring>(details).ptr(); + std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kDownloadDefaultDirectory) { SetupDownloadLocationPath(); } else if (*pref_name == prefs::kDownloadExtensionsToOpen) { diff --git a/chrome/browser/dom_ui/core_options_handler.cc b/chrome/browser/dom_ui/core_options_handler.cc index b556c82..f01a726 100644 --- a/chrome/browser/dom_ui/core_options_handler.cc +++ b/chrome/browser/dom_ui/core_options_handler.cc @@ -25,7 +25,7 @@ CoreOptionsHandler::~CoreOptionsHandler() { // Remove registered preference change notification observers. DCHECK(dom_ui_); PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs(); - std::wstring last_pref; + std::string last_pref; for (PreferenceCallbackMap::const_iterator iter = pref_callback_map_.begin(); iter != pref_callback_map_.end(); ++iter) { @@ -89,7 +89,7 @@ void CoreOptionsHandler::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) - NotifyPrefChanged(Details<std::wstring>(details).ptr()); + NotifyPrefChanged(Details<std::string>(details).ptr()); } void CoreOptionsHandler::RegisterMessages() { @@ -113,7 +113,7 @@ void CoreOptionsHandler::HandleInitialize(const Value* value) { (static_cast<OptionsUI*>(dom_ui_))->InitializeHandlers(); } -Value* CoreOptionsHandler::FetchPref(const std::wstring& pref_name) { +Value* CoreOptionsHandler::FetchPref(const std::string& pref_name) { DCHECK(dom_ui_); PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs(); @@ -123,14 +123,14 @@ Value* CoreOptionsHandler::FetchPref(const std::wstring& pref_name) { return pref ? pref->GetValue()->DeepCopy() : Value::CreateNullValue(); } -void CoreOptionsHandler::ObservePref(const std::wstring& pref_name) { +void CoreOptionsHandler::ObservePref(const std::string& pref_name) { DCHECK(dom_ui_); PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs(); pref_service->AddPrefObserver(pref_name.c_str(), this); } -void CoreOptionsHandler::SetPref(const std::wstring& pref_name, +void CoreOptionsHandler::SetPref(const std::string& pref_name, Value::ValueType pref_type, const std::string& value_string) { DCHECK(dom_ui_); @@ -185,7 +185,7 @@ void CoreOptionsHandler::HandleFetchPrefs(const Value* value) { if (!list_member->IsType(Value::TYPE_STRING)) continue; - std::wstring pref_name; + std::string pref_name; if (!list_member->GetAsString(&pref_name)) continue; @@ -219,7 +219,7 @@ void CoreOptionsHandler::HandleObservePrefs(const Value* value) { break; // Just ignore bad pref identifiers for now. - std::wstring pref_name; + std::string pref_name; if (!list_member->IsType(Value::TYPE_STRING) || !list_member->GetAsString(&pref_name)) continue; @@ -256,7 +256,7 @@ void CoreOptionsHandler::HandleSetPref(const Value* value, if (param_values->GetSize() != 2) return; - std::wstring pref_name; + std::string pref_name; if (!param_values->GetString(0, &pref_name)) return; @@ -267,7 +267,7 @@ void CoreOptionsHandler::HandleSetPref(const Value* value, SetPref(pref_name, type, value_string); } -void CoreOptionsHandler::NotifyPrefChanged(const std::wstring* pref_name) { +void CoreOptionsHandler::NotifyPrefChanged(const std::string* pref_name) { DCHECK(pref_name); DCHECK(dom_ui_); PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs(); diff --git a/chrome/browser/dom_ui/core_options_handler.h b/chrome/browser/dom_ui/core_options_handler.h index c88f01a..1e807b3 100644 --- a/chrome/browser/dom_ui/core_options_handler.h +++ b/chrome/browser/dom_ui/core_options_handler.h @@ -33,18 +33,18 @@ class CoreOptionsHandler : public OptionsPageUIHandler { protected: // Fetches a pref value of given |pref_name|. // Note that caller owns the returned Value. - virtual Value* FetchPref(const std::wstring& pref_name); + virtual Value* FetchPref(const std::string& pref_name); // Observes a pref of given |pref_name|. - virtual void ObservePref(const std::wstring& pref_name); + virtual void ObservePref(const std::string& pref_name); // Sets a pref value |value_string| of |pref_type| to given |pref_name|. - virtual void SetPref(const std::wstring& pref_name, + virtual void SetPref(const std::string& pref_name, Value::ValueType pref_type, const std::string& value_string); private: - typedef std::multimap<std::wstring, std::wstring> PreferenceCallbackMap; + typedef std::multimap<std::string, std::wstring> PreferenceCallbackMap; // Callback for the "coreOptionsInitialize" message. This message will // trigger the Initialize() method of all other handlers so that final // setup can be performed before the page is shown. @@ -70,7 +70,7 @@ class CoreOptionsHandler : public OptionsPageUIHandler { void HandleSetPref(const Value* value, Value::ValueType type); - void NotifyPrefChanged(const std::wstring* pref_name); + void NotifyPrefChanged(const std::string* pref_name); PreferenceCallbackMap pref_callback_map_; DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); diff --git a/chrome/browser/dom_ui/font_settings_handler.cc b/chrome/browser/dom_ui/font_settings_handler.cc index e6402fe..67c46316 100644 --- a/chrome/browser/dom_ui/font_settings_handler.cc +++ b/chrome/browser/dom_ui/font_settings_handler.cc @@ -119,7 +119,7 @@ void FontSettingsHandler::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) { - std::wstring* pref_name = Details<std::wstring>(details).ptr(); + std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kWebKitSerifFontFamily || *pref_name == prefs::kWebKitDefaultFontSize) { SetupSerifFontPreview(); diff --git a/chrome/browser/dom_ui/font_settings_utils_mac.mm b/chrome/browser/dom_ui/font_settings_utils_mac.mm index 33eb468..01d4f76 100644 --- a/chrome/browser/dom_ui/font_settings_utils_mac.mm +++ b/chrome/browser/dom_ui/font_settings_utils_mac.mm @@ -12,7 +12,7 @@ #include "chrome/common/pref_names.h" static void ValidateFontFamily(PrefService* prefs, - const wchar_t* family_pref_name) { + const char* family_pref_name) { // The native font settings dialog saved fonts by the font name, rather // than the family name. This worked for the old dialog since // -[NSFont fontWithName:size] accepted a font or family name, but the diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc index 94fff13..15a2016 100644 --- a/chrome/browser/dom_ui/ntp_resource_cache.cc +++ b/chrome/browser/dom_ui/ntp_resource_cache.cc @@ -176,7 +176,7 @@ void NTPResourceCache::Observe(NotificationType type, new_tab_incognito_css_ = NULL; new_tab_css_ = NULL; } else if (NotificationType::PREF_CHANGED == type) { - std::wstring* pref_name = Details<std::wstring>(details).ptr(); + std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kShowBookmarkBar || *pref_name == prefs::kHomePageIsNewTabPage || *pref_name == prefs::kNTPShownSections) { diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc index b1ae3c8..e78f05b 100644 --- a/chrome/browser/dom_ui/shown_sections_handler.cc +++ b/chrome/browser/dom_ui/shown_sections_handler.cc @@ -61,7 +61,7 @@ void ShownSectionsHandler::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(NotificationType::PREF_CHANGED == type); - std::wstring* pref_name = Details<std::wstring>(details).ptr(); + std::string* pref_name = Details<std::string>(details).ptr(); DCHECK(*pref_name == prefs::kNTPShownSections); int sections = pref_service_->GetInteger(prefs::kNTPShownSections); diff --git a/chrome/browser/extensions/extension_pref_store.cc b/chrome/browser/extensions/extension_pref_store.cc index 5d20cae..dbac8cc 100644 --- a/chrome/browser/extensions/extension_pref_store.cc +++ b/chrome/browser/extensions/extension_pref_store.cc @@ -24,7 +24,7 @@ ExtensionPrefStore::~ExtensionPrefStore() { } void ExtensionPrefStore::InstallExtensionPref(Extension* extension, - const wchar_t* new_pref_path, + const char* new_pref_path, Value* new_pref_value) { ExtensionStack::iterator i; for (i = extension_stack_.begin(); i != extension_stack_.end(); ++i) { @@ -84,7 +84,7 @@ void ExtensionPrefStore::GetExtensionIDs(std::vector<std::string>* result) { // a given preference, among other optimizations. But probably fewer than 10 // installed extensions will be trying to control any preferences, so stick // with this simpler algorithm until it causes a problem. -void ExtensionPrefStore::UpdateOnePref(const wchar_t* path) { +void ExtensionPrefStore::UpdateOnePref(const char* path) { scoped_ptr<Value> old_value; PrefService* pref_service = GetPrefService(); diff --git a/chrome/browser/extensions/extension_pref_store.h b/chrome/browser/extensions/extension_pref_store.h index 98a2b00..47eac8d 100644 --- a/chrome/browser/extensions/extension_pref_store.h +++ b/chrome/browser/extensions/extension_pref_store.h @@ -38,7 +38,7 @@ class ExtensionPrefStore : public PrefStore, // must be called each time an extension API tries to set a preference. // The ExtensionPrefStore will take ownership of the |pref_value|. virtual void InstallExtensionPref(Extension* extension, - const wchar_t* pref_path, + const char* pref_path, Value* pref_value); // Removes an extension and all its preference settings from this PrefStore. @@ -54,7 +54,7 @@ class ExtensionPrefStore : public PrefStore, // The nested pairs are <extension, <pref_path, pref_value> >. This is here, // rather than in (say) notification_type.h, to keep the dependency on // std::pair out of the many places that include notification_type.h. - typedef std::pair<Extension*, std::pair<const wchar_t*, Value*> > + typedef std::pair<Extension*, std::pair<const char*, Value*> > ExtensionPrefDetails; protected: @@ -69,12 +69,12 @@ class ExtensionPrefStore : public PrefStore, private: // Maps preference paths to their values. - typedef std::map<const wchar_t*, Value*> PrefValueMap; + typedef std::map<const char*, Value*> PrefValueMap; // Applies the highest-priority extension's setting for the given preference // path to the |prefs_| store, or clears the setting there if no extensions // wish to control it. - void UpdateOnePref(const wchar_t* path); + void UpdateOnePref(const char* path); // Updates each preference in the key set of the |pref_values| map. void UpdatePrefs(const PrefValueMap* pref_values); diff --git a/chrome/browser/extensions/extension_pref_store_unittest.cc b/chrome/browser/extensions/extension_pref_store_unittest.cc index 55d300e2..05cd322 100644 --- a/chrome/browser/extensions/extension_pref_store_unittest.cc +++ b/chrome/browser/extensions/extension_pref_store_unittest.cc @@ -83,7 +83,7 @@ class MockPrefService : public PrefService { fired_observers_(false) {} // Tracks whether the observers would have been notified. - virtual void FireObserversIfChanged(const wchar_t* pref_name, + virtual void FireObserversIfChanged(const char* pref_name, const Value* old_value) { fired_observers_ = PrefIsChanged(pref_name, old_value); } @@ -92,10 +92,10 @@ class MockPrefService : public PrefService { }; // Use static constants to avoid confusing std::map with hard-coded strings. -static const wchar_t* kPref1 = L"path1.subpath"; -static const wchar_t* kPref2 = L"path2"; -static const wchar_t* kPref3 = L"path3"; -static const wchar_t* kPref4 = L"path4"; +static const char* kPref1 = "path1.subpath"; +static const char* kPref2 = "path2"; +static const char* kPref3 = "path3"; +static const char* kPref4 = "path4"; } // namespace diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index d7bfc8d..cf15d02 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -314,7 +314,7 @@ bool CreateWindowFunction::RunImpl() { // // NOTE(rafaelw): It's ok if GetCurrentBrowser() returns NULL here. // GetBrowserWindowBounds will default to saved "default" values for the app. - WindowSizer::GetBrowserWindowBounds(std::wstring(), empty_bounds, + WindowSizer::GetBrowserWindowBounds(std::string(), empty_bounds, GetCurrentBrowser(), &bounds, &maximized); diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 015002c..8201edd 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -334,7 +334,7 @@ ExtensionUpdater::~ExtensionUpdater() { } static void EnsureInt64PrefRegistered(PrefService* prefs, - const wchar_t name[]) { + const char name[]) { if (!prefs->FindPreference(name)) prefs->RegisterInt64Pref(name, 0); } diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc index 047f48d..a28abed 100644 --- a/chrome/browser/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_toolbar_gtk.cc @@ -377,7 +377,7 @@ void BrowserToolbarGtk::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) { - NotifyPrefChanged(Details<std::wstring>(details).ptr()); + NotifyPrefChanged(Details<std::string>(details).ptr()); } else if (type == NotificationType::BROWSER_THEME_CHANGED) { // Update the spacing around the menu buttons bool use_gtk = theme_provider_->UseGtkTheme(); @@ -627,7 +627,7 @@ void BrowserToolbarGtk::OnDragDataReceived(GtkWidget* widget, home_page_.SetValue(url.spec()); } -void BrowserToolbarGtk::NotifyPrefChanged(const std::wstring* pref) { +void BrowserToolbarGtk::NotifyPrefChanged(const std::string* pref) { if (!pref || *pref == prefs::kShowHomeButton) { if (show_home_button_.GetValue() && !ShouldOnlyShowLocation()) { gtk_widget_show(home_->widget()); diff --git a/chrome/browser/gtk/browser_toolbar_gtk.h b/chrome/browser/gtk/browser_toolbar_gtk.h index 38b7d7f..09f04f1 100644 --- a/chrome/browser/gtk/browser_toolbar_gtk.h +++ b/chrome/browser/gtk/browser_toolbar_gtk.h @@ -160,7 +160,7 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver, GdkEventExpose*); // Updates preference-dependent state. - void NotifyPrefChanged(const std::wstring* pref); + void NotifyPrefChanged(const std::string* pref); // Start the upgrade notification animation if we have detected an upgrade // and the current toolbar is focused. diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index e7b0007..e81bca9 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -1141,7 +1141,7 @@ void BrowserWindowGtk::Observe(NotificationType type, break; case NotificationType::PREF_CHANGED: { - std::wstring* pref_name = Details<std::wstring>(details).ptr(); + std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kUseCustomChromeFrame) { UpdateCustomFrame(); } else { @@ -1750,27 +1750,27 @@ void BrowserWindowGtk::SaveWindowPosition() { if (!g_browser_process->local_state()) return; - std::wstring window_name = browser_->GetWindowPlacementKey(); + std::string window_name = browser_->GetWindowPlacementKey(); DictionaryValue* window_preferences = g_browser_process->local_state()->GetMutableDictionary( window_name.c_str()); // Note that we store left/top for consistency with Windows, but that we // *don't* obey them; we only use them for computing width/height. See // comments in SetGeometryHints(). - window_preferences->SetInteger(L"left", restored_bounds_.x()); - window_preferences->SetInteger(L"top", restored_bounds_.y()); - window_preferences->SetInteger(L"right", restored_bounds_.right()); - window_preferences->SetInteger(L"bottom", restored_bounds_.bottom()); - window_preferences->SetBoolean(L"maximized", IsMaximized()); + window_preferences->SetInteger("left", restored_bounds_.x()); + window_preferences->SetInteger("top", restored_bounds_.y()); + window_preferences->SetInteger("right", restored_bounds_.right()); + window_preferences->SetInteger("bottom", restored_bounds_.bottom()); + window_preferences->SetBoolean("maximized", IsMaximized()); scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_info_provider( WindowSizer::CreateDefaultMonitorInfoProvider()); gfx::Rect work_area( monitor_info_provider->GetMonitorWorkAreaMatching(restored_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()); } // static diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index 577c6d1..3ffaae5 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -345,7 +345,7 @@ void GtkThemeProvider::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if ((type == NotificationType::PREF_CHANGED) && - (*Details<std::wstring>(details).ptr() == prefs::kUsesSystemTheme)) + (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); } diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc index 15650b2..f400b75 100644 --- a/chrome/browser/gtk/options/advanced_contents_gtk.cc +++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc @@ -153,7 +153,7 @@ class DownloadSection : public OptionsPageBase { private: // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // Callbacks for the widgets. static void OnDownloadLocationChanged(GtkFileChooser* widget, @@ -268,7 +268,7 @@ DownloadSection::DownloadSection(Profile* profile) NotifyPrefChanged(NULL); } -void DownloadSection::NotifyPrefChanged(const std::wstring* pref_name) { +void DownloadSection::NotifyPrefChanged(const std::string* pref_name) { pref_changing_ = true; if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) { gtk_file_chooser_set_current_folder( @@ -351,7 +351,7 @@ class NetworkSection : public OptionsPageBase { private: // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); struct ProxyConfigCommand { std::string binary; @@ -409,7 +409,7 @@ NetworkSection::NetworkSection(Profile* profile) NotifyPrefChanged(NULL); } -void NetworkSection::NotifyPrefChanged(const std::wstring* pref_name) { +void NetworkSection::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || proxy_prefs_->IsObserved(*pref_name)) gtk_widget_set_sensitive(change_proxies_button_, !proxy_prefs_->IsManaged()); @@ -520,7 +520,7 @@ class TranslateSection : public OptionsPageBase { private: // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); CHROMEGTK_CALLBACK_0(TranslateSection, void, OnTranslateClicked); @@ -566,7 +566,7 @@ TranslateSection::TranslateSection(Profile* profile) NotifyPrefChanged(NULL); } -void TranslateSection::NotifyPrefChanged(const std::wstring* pref_name) { +void TranslateSection::NotifyPrefChanged(const std::string* pref_name) { pref_changing_ = true; if (!pref_name || *pref_name == prefs::kEnableTranslate) { gtk_toggle_button_set_active( @@ -601,7 +601,7 @@ class PrivacySection : public OptionsPageBase { private: // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // Try to make the the crash stats consent and the metrics upload // permission match the |reporting_enabled_checkbox_|. @@ -887,7 +887,7 @@ void PrivacySection::OnLoggingChange(GtkWidget* widget, privacy_section->enable_metrics_recording_.SetValue(enabled); } -void PrivacySection::NotifyPrefChanged(const std::wstring* pref_name) { +void PrivacySection::NotifyPrefChanged(const std::string* pref_name) { pref_changing_ = true; if (!pref_name || *pref_name == prefs::kAlternateErrorPagesEnabled) { gtk_toggle_button_set_active( @@ -961,7 +961,7 @@ class SecuritySection : public OptionsPageBase { private: // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // The callback functions for the options widgets. static void OnManageCertificatesClicked(GtkButton* button, @@ -1055,7 +1055,7 @@ SecuritySection::SecuritySection(Profile* profile) NotifyPrefChanged(NULL); } -void SecuritySection::NotifyPrefChanged(const std::wstring* pref_name) { +void SecuritySection::NotifyPrefChanged(const std::string* pref_name) { pref_changing_ = true; if (!pref_name || *pref_name == prefs::kCertRevocationCheckingEnabled) { gtk_toggle_button_set_active( diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc index 7f363cf..a9e9514 100644 --- a/chrome/browser/gtk/options/content_page_gtk.cc +++ b/chrome/browser/gtk/options/content_page_gtk.cc @@ -150,7 +150,7 @@ void ContentPageGtk::OnStateChanged() { // If |pref_name| is NULL, set the state of all the widgets. (This is used // in ContentPageGtk() above to initialize the dialog.) Otherwise, reset the // state of the widget for the given preference name, as it has changed. -void ContentPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { +void ContentPageGtk::NotifyPrefChanged(const std::string* pref_name) { initializing_ = true; if (!pref_name || *pref_name == prefs::kPasswordManagerEnabled) { if (ask_to_save_passwords_.GetValue()) { diff --git a/chrome/browser/gtk/options/content_page_gtk.h b/chrome/browser/gtk/options/content_page_gtk.h index 675f0a2..f41cf99 100644 --- a/chrome/browser/gtk/options/content_page_gtk.h +++ b/chrome/browser/gtk/options/content_page_gtk.h @@ -34,7 +34,7 @@ class ContentPageGtk : public OptionsPageBase, void UpdateSyncControls(); // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // Overridden from OptionsPageBase. virtual void Observe(NotificationType type, diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc b/chrome/browser/gtk/options/cookie_filter_page_gtk.cc index d51c91d..1826694 100644 --- a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc +++ b/chrome/browser/gtk/options/cookie_filter_page_gtk.cc @@ -50,7 +50,7 @@ CookieFilterPageGtk::CookieFilterPageGtk(Profile* profile) CookieFilterPageGtk::~CookieFilterPageGtk() { } -void CookieFilterPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { +void CookieFilterPageGtk::NotifyPrefChanged(const std::string* pref_name) { initializing_ = true; if (!pref_name || *pref_name == prefs::kClearSiteDataOnExit) { diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.h b/chrome/browser/gtk/options/cookie_filter_page_gtk.h index ff65022..8aaf214 100644 --- a/chrome/browser/gtk/options/cookie_filter_page_gtk.h +++ b/chrome/browser/gtk/options/cookie_filter_page_gtk.h @@ -30,7 +30,7 @@ class CookieFilterPageGtk : public OptionsPageBase { private: // Overridden from OptionsPageBase - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); virtual void HighlightGroup(OptionsGroup highlight_group); CHROMEGTK_CALLBACK_0(CookieFilterPageGtk, void, OnCookiesAllowToggled); diff --git a/chrome/browser/gtk/options/fonts_page_gtk.cc b/chrome/browser/gtk/options/fonts_page_gtk.cc index 33b0bb8..abb544d 100644 --- a/chrome/browser/gtk/options/fonts_page_gtk.cc +++ b/chrome/browser/gtk/options/fonts_page_gtk.cc @@ -120,7 +120,7 @@ void FontsPageGtk::InitDefaultEncodingComboBox() { } } -void FontsPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { +void FontsPageGtk::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kWebKitSerifFontFamily || *pref_name == prefs::kWebKitDefaultFontSize) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(serif_font_button_), diff --git a/chrome/browser/gtk/options/fonts_page_gtk.h b/chrome/browser/gtk/options/fonts_page_gtk.h index eb90901..b1ef255 100644 --- a/chrome/browser/gtk/options/fonts_page_gtk.h +++ b/chrome/browser/gtk/options/fonts_page_gtk.h @@ -32,7 +32,7 @@ class FontsPageGtk : public OptionsPageBase { void InitDefaultEncodingComboBox(); // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // Retrieve the font selection from the button and save it to the prefs. Also // ensure the button(s) are displayed in the proper size, as the diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc index 53615f0..ea3adc9 100644 --- a/chrome/browser/gtk/options/general_page_gtk.cc +++ b/chrome/browser/gtk/options/general_page_gtk.cc @@ -120,7 +120,7 @@ GeneralPageGtk::~GeneralPageGtk() { /////////////////////////////////////////////////////////////////////////////// // GeneralPageGtk, OptionsPageBase overrides: -void GeneralPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { +void GeneralPageGtk::NotifyPrefChanged(const std::string* pref_name) { initializing_ = true; if (!pref_name || *pref_name == prefs::kRestoreOnStartup) { PrefService* prefs = profile()->GetPrefs(); diff --git a/chrome/browser/gtk/options/general_page_gtk.h b/chrome/browser/gtk/options/general_page_gtk.h index 3ac5f66..acfee2f 100644 --- a/chrome/browser/gtk/options/general_page_gtk.h +++ b/chrome/browser/gtk/options/general_page_gtk.h @@ -35,7 +35,7 @@ class GeneralPageGtk : public OptionsPageBase, private: // Overridden from OptionsPageBase - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); virtual void HighlightGroup(OptionsGroup highlight_group); // Initialize the option group widgets, return their container diff --git a/chrome/browser/gtk/options/languages_page_gtk.cc b/chrome/browser/gtk/options/languages_page_gtk.cc index 4b8d8e3..19c2d15 100644 --- a/chrome/browser/gtk/options/languages_page_gtk.cc +++ b/chrome/browser/gtk/options/languages_page_gtk.cc @@ -313,7 +313,7 @@ int LanguagesPageGtk::FirstSelectedRowNum() { return row_num; } -void LanguagesPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { +void LanguagesPageGtk::NotifyPrefChanged(const std::string* pref_name) { initializing_ = true; if (!pref_name || *pref_name == prefs::kAcceptLanguages) { language_order_table_model_->SetAcceptLanguagesString( @@ -321,7 +321,7 @@ void LanguagesPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { } if (!pref_name || *pref_name == prefs::kSpellCheckDictionary) { int index = dictionary_language_model_->GetSelectedLanguageIndex( - prefs::kSpellCheckDictionary); + UTF8ToWide(prefs::kSpellCheckDictionary)); // If not found, fall back from "language-region" to "language". if (index < 0) { @@ -329,7 +329,7 @@ void LanguagesPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { dictionary_language_.SetValue( SpellCheckCommon::GetLanguageFromLanguageRegion(lang_region)); index = dictionary_language_model_->GetSelectedLanguageIndex( - prefs::kSpellCheckDictionary); + UTF8ToWide(prefs::kSpellCheckDictionary)); } gtk_combo_box_set_active(GTK_COMBO_BOX(dictionary_language_combobox_), diff --git a/chrome/browser/gtk/options/languages_page_gtk.h b/chrome/browser/gtk/options/languages_page_gtk.h index f3f56d4..5fe66a9 100644 --- a/chrome/browser/gtk/options/languages_page_gtk.h +++ b/chrome/browser/gtk/options/languages_page_gtk.h @@ -59,7 +59,7 @@ class LanguagesPageGtk int FirstSelectedRowNum(); // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // Callbacks for accept languages widgets. CHROMEG_CALLBACK_0(LanguagesPageGtk, void, OnSelectionChanged, diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc index 3bf6d13..dabdc96 100644 --- a/chrome/browser/host_content_settings_map.cc +++ b/chrome/browser/host_content_settings_map.cc @@ -505,10 +505,10 @@ void HostContentSettingsMap::SetContentSetting( { AutoLock auto_lock(lock_); - if (!map_to_modify->count(pattern.AsString())) - (*map_to_modify)[pattern.AsString()].content_settings = ContentSettings(); + if (!map_to_modify->count(pattern_str)) + (*map_to_modify)[pattern_str].content_settings = ContentSettings(); HostContentSettings::iterator - i(map_to_modify->find(pattern.AsString())); + i(map_to_modify->find(pattern_str)); ContentSettings& settings = i->second.content_settings; if (RequiresResourceIdentifier(content_type)) { settings.settings[content_type] = CONTENT_SETTING_DEFAULT; @@ -725,7 +725,7 @@ void HostContentSettingsMap::Observe(NotificationType type, if (updating_preferences_) return; - std::wstring* name = Details<std::wstring>(details).ptr(); + std::string* name = Details<std::string>(details).ptr(); if (prefs::kDefaultContentSettings == *name) { ReadDefaultSettings(true); } else if (prefs::kContentSettingsPatterns == *name) { diff --git a/chrome/browser/host_zoom_map.cc b/chrome/browser/host_zoom_map.cc index 512fdf0..b676cf4 100644 --- a/chrome/browser/host_zoom_map.cc +++ b/chrome/browser/host_zoom_map.cc @@ -94,13 +94,11 @@ void HostZoomMap::SetZoomLevel(const GURL& url, int level) { ScopedPrefUpdate update(profile_->GetPrefs(), prefs::kPerHostZoomLevels); DictionaryValue* host_zoom_dictionary = profile_->GetPrefs()->GetMutableDictionary(prefs::kPerHostZoomLevels); - std::wstring wide_host(UTF8ToWide(host)); if (level == 0) { - host_zoom_dictionary->RemoveWithoutPathExpansion(wide_host, NULL); + host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL); } else { host_zoom_dictionary->SetWithoutPathExpansion( - wide_host, - Value::CreateIntegerValue(level)); + host, Value::CreateIntegerValue(level)); } } updating_preferences_ = false; @@ -150,7 +148,7 @@ void HostZoomMap::Observe( if (updating_preferences_) return; - std::wstring* name = Details<std::wstring>(details).ptr(); + std::string* name = Details<std::string>(details).ptr(); if (prefs::kPerHostZoomLevels == *name) { Load(); return; diff --git a/chrome/browser/host_zoom_map_unittest.cc b/chrome/browser/host_zoom_map_unittest.cc index a59a142..4b20a09 100644 --- a/chrome/browser/host_zoom_map_unittest.cc +++ b/chrome/browser/host_zoom_map_unittest.cc @@ -40,7 +40,7 @@ class HostZoomMapTest : public testing::Test { pref_observer_, Observe(NotificationType(NotificationType::PREF_CHANGED), _, - Property(&Details<std::wstring>::ptr, + Property(&Details<std::string>::ptr, Pointee(per_host_zoom_levels_pref_)))); } @@ -48,7 +48,7 @@ class HostZoomMapTest : public testing::Test { ChromeThread ui_thread_; TestingProfile profile_; PrefService* prefs_; - std::wstring per_host_zoom_levels_pref_; // For the observe matcher. + std::string per_host_zoom_levels_pref_; // For the observe matcher. GURL url_; std::string host_; NotificationObserverMock pref_observer_; diff --git a/chrome/browser/managed_prefs_banner_base.cc b/chrome/browser/managed_prefs_banner_base.cc index 0297488..6836e0c 100644 --- a/chrome/browser/managed_prefs_banner_base.cc +++ b/chrome/browser/managed_prefs_banner_base.cc @@ -21,19 +21,19 @@ ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* local_state, Init(local_state, user_prefs, page); } -void ManagedPrefsBannerBase::AddLocalStatePref(const wchar_t* pref) { +void ManagedPrefsBannerBase::AddLocalStatePref(const char* pref) { local_state_set_->AddPref(pref); } -void ManagedPrefsBannerBase::RemoveLocalStatePref(const wchar_t* pref) { +void ManagedPrefsBannerBase::RemoveLocalStatePref(const char* pref) { local_state_set_->RemovePref(pref); } -void ManagedPrefsBannerBase::AddUserPref(const wchar_t* pref) { +void ManagedPrefsBannerBase::AddUserPref(const char* pref) { user_pref_set_->AddPref(pref); } -void ManagedPrefsBannerBase::RemoveUserPref(const wchar_t* pref) { +void ManagedPrefsBannerBase::RemoveUserPref(const char* pref) { user_pref_set_->RemovePref(pref); } @@ -79,7 +79,7 @@ void ManagedPrefsBannerBase::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (NotificationType::PREF_CHANGED == type) { - std::wstring* pref = Details<std::wstring>(details).ptr(); + std::string* pref = Details<std::string>(details).ptr(); if (pref && (local_state_set_->IsObserved(*pref) || user_pref_set_->IsObserved(*pref))) OnUpdateVisibility(); diff --git a/chrome/browser/managed_prefs_banner_base.h b/chrome/browser/managed_prefs_banner_base.h index 78a24a4..9baadc9f 100644 --- a/chrome/browser/managed_prefs_banner_base.h +++ b/chrome/browser/managed_prefs_banner_base.h @@ -36,14 +36,14 @@ class ManagedPrefsBannerBase : public NotificationObserver { bool DetermineVisibility() const; // Add a local state preference as visibility trigger. - void AddLocalStatePref(const wchar_t* pref); + void AddLocalStatePref(const char* pref); // Remove a local state preference from being a visibility trigger. - void RemoveLocalStatePref(const wchar_t* pref); + void RemoveLocalStatePref(const char* pref); // Add a user preference as visibility trigger. - void AddUserPref(const wchar_t* pref); + void AddUserPref(const char* pref); // Remove a user preference from being a visibility trigger. - void RemoveUserPref(const wchar_t* pref); + void RemoveUserPref(const char* pref); protected: // Update banner visibility. This is called whenever a preference change is diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index fb7f8a2..4b0db68 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -158,13 +158,13 @@ void MetricsLog::WritePluginStabilityElements(PrefService* pref) { } DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*iter); - std::wstring plugin_name; + std::string plugin_name; plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name); OPEN_ELEMENT_FOR_SCOPE("pluginstability"); // Use "filename" instead of "name", otherwise we need to update the // UMA servers. - WriteAttribute("filename", CreateBase64Hash(WideToUTF8(plugin_name))); + WriteAttribute("filename", CreateBase64Hash(plugin_name)); int launches = 0; plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches); @@ -352,7 +352,7 @@ void MetricsLog::RecordEnvironment( void MetricsLog::WriteAllProfilesMetrics( const DictionaryValue& all_profiles_metrics) { - const std::string profile_prefix(WideToUTF8(prefs::kProfilePrefix)); + const std::string profile_prefix(prefs::kProfilePrefix); for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys(); i != all_profiles_metrics.end_keys(); ++i) { const std::string& key_name = *i; diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 1dcc6df..df65772 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -1716,14 +1716,14 @@ void MetricsService::LogLoadComplete(NotificationType type, load_details->load_time()); } -void MetricsService::IncrementPrefValue(const wchar_t* path) { +void MetricsService::IncrementPrefValue(const char* path) { PrefService* pref = g_browser_process->local_state(); DCHECK(pref); int value = pref->GetInteger(path); pref->SetInteger(path, value + 1); } -void MetricsService::IncrementLongPrefsValue(const wchar_t* path) { +void MetricsService::IncrementLongPrefsValue(const char* path) { PrefService* pref = g_browser_process->local_state(); DCHECK(pref); int64 value = pref->GetInt64(path); @@ -1800,8 +1800,8 @@ static void CountBookmarks(const BookmarkNode* node, } void MetricsService::LogBookmarks(const BookmarkNode* node, - const wchar_t* num_bookmarks_key, - const wchar_t* num_folders_key) { + const char* num_bookmarks_key, + const char* num_folders_key) { DCHECK(node); int num_bookmarks = 0; int num_folders = 0; @@ -1847,18 +1847,20 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { } DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*value_iter); - std::wstring plugin_name; + std::string plugin_name; plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name); if (plugin_name.empty()) { NOTREACHED(); continue; } - if (child_process_stats_buffer_.find(plugin_name) == + // TODO(viettrungluu): remove conversions + if (child_process_stats_buffer_.find(UTF8ToWide(plugin_name)) == child_process_stats_buffer_.end()) continue; - ChildProcessStats stats = child_process_stats_buffer_[plugin_name]; + ChildProcessStats stats = + child_process_stats_buffer_[UTF8ToWide(plugin_name)]; if (stats.process_launches) { int launches = 0; plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches); @@ -1878,7 +1880,7 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { plugin_dict->SetInteger(prefs::kStabilityPluginInstances, instances); } - child_process_stats_buffer_.erase(plugin_name); + child_process_stats_buffer_.erase(UTF8ToWide(plugin_name)); } // Now go through and add dictionaries for plugins that didn't already have @@ -1892,7 +1894,8 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { if (ChildProcessInfo::PLUGIN_PROCESS != stats.process_type) continue; - std::wstring plugin_name = cache_iter->first; + // TODO(viettrungluu): remove conversion + std::string plugin_name = WideToUTF8(cache_iter->first); DictionaryValue* plugin_dict = new DictionaryValue; @@ -1917,7 +1920,7 @@ bool MetricsService::CanLogNotification(NotificationType type, return !BrowserList::IsOffTheRecordSessionActive(); } -void MetricsService::RecordBooleanPrefValue(const wchar_t* path, bool value) { +void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { DCHECK(IsSingleThreaded()); PrefService* pref = g_browser_process->local_state(); diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index 65f2af9..db402a5 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -334,11 +334,11 @@ class MetricsService : public NotificationObserver, const NotificationDetails& details); // Reads, increments and then sets the specified integer preference. - void IncrementPrefValue(const wchar_t* path); + void IncrementPrefValue(const char* path); // Reads, increments and then sets the specified long preference that is // stored as a string. - void IncrementLongPrefsValue(const wchar_t* path); + void IncrementLongPrefsValue(const char* path); // Records a renderer process crash. void LogRendererCrash(); @@ -353,8 +353,8 @@ class MetricsService : public NotificationObserver, // in node. The pref key for the number of bookmarks in num_bookmarks_key and // the pref key for number of folders in num_folders_key. void LogBookmarks(const BookmarkNode* node, - const wchar_t* num_bookmarks_key, - const wchar_t* num_folders_key); + const char* num_bookmarks_key, + const char* num_folders_key); // Sets preferences for the number of bookmarks in model. void LogBookmarks(BookmarkModel* model); @@ -392,7 +392,7 @@ class MetricsService : public NotificationObserver, const NotificationDetails& details); // Sets the value of the specified path in prefs and schedules a save. - void RecordBooleanPrefValue(const wchar_t* path, bool value); + void RecordBooleanPrefValue(const char* path, bool value); NotificationRegistrar registrar_; diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index 8e9b6ba..a67e506 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -662,7 +662,7 @@ void ChromeURLRequestContextGetter::Observe( CheckCurrentlyOnMainThread(); if (NotificationType::PREF_CHANGED == type) { - std::wstring* pref_name_in = Details<std::wstring>(details).ptr(); + std::string* pref_name_in = Details<std::string>(details).ptr(); PrefService* prefs = Source<PrefService>(source).ptr(); DCHECK(pref_name_in && prefs); if (*pref_name_in == prefs::kAcceptLanguages) { @@ -1019,7 +1019,7 @@ void ChromeURLRequestContextFactory::ApplyProfileParametersToContext( net::ProxyConfig* CreateProxyConfig(const PrefService* pref_service) { // Scan for all "enable" type proxy switches. - static const wchar_t* proxy_prefs[] = { + static const char* proxy_prefs[] = { prefs::kProxyPacUrl, prefs::kProxyServer, prefs::kProxyBypassList, diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 49610ef..47c7591 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -295,7 +295,7 @@ void DesktopNotificationService::Observe(NotificationType type, const NotificationDetails& details) { DCHECK(NotificationType::PREF_CHANGED == type); PrefService* prefs = profile_->GetPrefs(); - std::wstring* name = Details<std::wstring>(details).ptr(); + std::string* name = Details<std::string>(details).ptr(); if (0 == name->compare(prefs::kDesktopNotificationAllowedOrigins)) { std::vector<GURL> allowed_origins(GetAllowedOrigins()); diff --git a/chrome/browser/options_page_base.cc b/chrome/browser/options_page_base.cc index 260fb5b..5099aa9 100644 --- a/chrome/browser/options_page_base.cc +++ b/chrome/browser/options_page_base.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-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. @@ -32,5 +32,5 @@ void OptionsPageBase::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) - NotifyPrefChanged(Details<std::wstring>(details).ptr()); + NotifyPrefChanged(Details<std::string>(details).ptr()); } diff --git a/chrome/browser/options_page_base.h b/chrome/browser/options_page_base.h index 79229b6..0e6c756 100644 --- a/chrome/browser/options_page_base.h +++ b/chrome/browser/options_page_base.h @@ -50,7 +50,7 @@ class OptionsPageBase : public NotificationObserver { // the specific pref that changed, or NULL if all pref UI should be // validated. This should be called during setup, but with NULL as the // parameter to allow initial state to be set. - virtual void NotifyPrefChanged(const std::wstring* pref_name) { } + virtual void NotifyPrefChanged(const std::string* pref_name) {} private: // The Profile associated with this page. diff --git a/chrome/browser/options_util.cc b/chrome/browser/options_util.cc index 5ab7b06..fa9a229 100644 --- a/chrome/browser/options_util.cc +++ b/chrome/browser/options_util.cc @@ -21,7 +21,7 @@ void OptionsUtil::ResetToDefaults(Profile* profile) { // changes to any of the options pages doesn't require updating this list // manually. PrefService* prefs = profile->GetPrefs(); - const wchar_t* kUserPrefs[] = { + const char* kUserPrefs[] = { prefs::kAcceptLanguages, prefs::kAlternateErrorPagesEnabled, prefs::kClearSiteDataOnExit, @@ -82,7 +82,7 @@ void OptionsUtil::ResetToDefaults(Profile* profile) { // settings they'll either inadvertedly enable this logging or disable it. // One is undesirable for them, one is undesirable for us. For now, we just // don't reset it. - const wchar_t* kLocalStatePrefs[] = { + const char* kLocalStatePrefs[] = { prefs::kApplicationLocale, }; for (size_t i = 0; i < arraysize(kLocalStatePrefs); ++i) diff --git a/chrome/browser/policy/configuration_policy_pref_store.h b/chrome/browser/policy/configuration_policy_pref_store.h index df35238..a214ea2 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.h +++ b/chrome/browser/policy/configuration_policy_pref_store.h @@ -49,7 +49,7 @@ class ConfigurationPolicyPrefStore : public PrefStore, struct PolicyToPreferenceMapEntry { Value::ValueType value_type; PolicyType policy_type; - const wchar_t* preference_path; // A DictionaryValue path, not a file path. + const char* preference_path; // A DictionaryValue path, not a file path. }; static const PolicyToPreferenceMapEntry simple_policy_map_[]; diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index fa63845..ecb8fc4 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -17,74 +17,74 @@ class ConfigurationPolicyPrefStoreTest : public testing::Test { void ApplyStringPolicyValue( ConfigurationPolicyPrefStore* store, ConfigurationPolicyStore::PolicyType type, - const wchar_t* policy_value); + const char* policy_value); // The following three methods test a policy which controls a string // preference. // Checks that by default, it's an empty string. - void TestStringPolicyGetDefault(const wchar_t* pref_name); + void TestStringPolicyGetDefault(const char* pref_name); // Checks that values can be set. - void TestStringPolicySetValue(const wchar_t* pref_name, + void TestStringPolicySetValue(const char* pref_name, ConfigurationPolicyStore::PolicyType type); // A wrapper that calls the above two methods. - void TestStringPolicy(const wchar_t* pref_name, + void TestStringPolicy(const char* pref_name, ConfigurationPolicyStore::PolicyType type); // The following three methods test a policy which controls a boolean // preference. // Checks that there's no deafult. - void TestBooleanPolicyGetDefault(const wchar_t* pref_name); + void TestBooleanPolicyGetDefault(const char* pref_name); // Checks that values can be set. - void TestBooleanPolicySetValue(const wchar_t* pref_name, + void TestBooleanPolicySetValue(const char* pref_name, ConfigurationPolicyStore::PolicyType type); // A wrapper that calls the above two methods. - void TestBooleanPolicy(const wchar_t* pref_name, + void TestBooleanPolicy(const char* pref_name, ConfigurationPolicyStore::PolicyType type); // The following three methods test a policy which controls an integer // preference. // Checks that by default, it's 0. - void TestIntegerPolicyGetDefault(const wchar_t* pref_name); + void TestIntegerPolicyGetDefault(const char* pref_name); // Checks that values can be set. - void TestIntegerPolicySetValue(const wchar_t* pref_name, + void TestIntegerPolicySetValue(const char* pref_name, ConfigurationPolicyStore::PolicyType type); // A wrapper that calls the above two methods. - void TestIntegerPolicy(const wchar_t* pref_name, + void TestIntegerPolicy(const char* pref_name, ConfigurationPolicyStore::PolicyType type); }; void ConfigurationPolicyPrefStoreTest::ApplyStringPolicyValue( ConfigurationPolicyPrefStore* store, ConfigurationPolicyStore::PolicyType type, - const wchar_t* policy_value) { + const char* policy_value) { store->Apply(type, Value::CreateStringValue(policy_value)); } void ConfigurationPolicyPrefStoreTest::TestStringPolicyGetDefault( - const wchar_t* pref_name) { + const char* pref_name) { ConfigurationPolicyPrefStore store(NULL, NULL); - std::wstring result; + std::string result; store.prefs()->GetString(pref_name, &result); - EXPECT_EQ(result, L""); + EXPECT_EQ(result, ""); } void ConfigurationPolicyPrefStoreTest::TestStringPolicySetValue( - const wchar_t* pref_name, ConfigurationPolicyStore::PolicyType type) { + const char* pref_name, ConfigurationPolicyStore::PolicyType type) { ConfigurationPolicyPrefStore store(NULL, NULL); - ApplyStringPolicyValue(&store, type, L"http://chromium.org"); - std::wstring result; + ApplyStringPolicyValue(&store, type, "http://chromium.org"); + std::string result; store.prefs()->GetString(pref_name, &result); - EXPECT_EQ(result, L"http://chromium.org"); + EXPECT_EQ(result, "http://chromium.org"); } void ConfigurationPolicyPrefStoreTest::TestStringPolicy( - const wchar_t* pref_name, ConfigurationPolicyStore::PolicyType type) { + const char* pref_name, ConfigurationPolicyStore::PolicyType type) { TestStringPolicyGetDefault(pref_name); TestStringPolicySetValue(pref_name, type); } void ConfigurationPolicyPrefStoreTest::TestBooleanPolicyGetDefault( - const wchar_t* pref_name) { + const char* pref_name) { ConfigurationPolicyPrefStore store(NULL, NULL); bool result = false; store.prefs()->GetBoolean(pref_name, &result); @@ -95,7 +95,7 @@ void ConfigurationPolicyPrefStoreTest::TestBooleanPolicyGetDefault( } void ConfigurationPolicyPrefStoreTest::TestBooleanPolicySetValue( - const wchar_t* pref_name, ConfigurationPolicyStore::PolicyType type) { + const char* pref_name, ConfigurationPolicyStore::PolicyType type) { ConfigurationPolicyPrefStore store(NULL, NULL); store.Apply(type, Value::CreateBooleanValue(false)); bool result = true; @@ -109,13 +109,13 @@ void ConfigurationPolicyPrefStoreTest::TestBooleanPolicySetValue( } void ConfigurationPolicyPrefStoreTest::TestBooleanPolicy( - const wchar_t* pref_name, ConfigurationPolicyStore::PolicyType type) { + const char* pref_name, ConfigurationPolicyStore::PolicyType type) { TestBooleanPolicyGetDefault(pref_name); TestBooleanPolicySetValue(pref_name, type); } void ConfigurationPolicyPrefStoreTest::TestIntegerPolicyGetDefault( - const wchar_t* pref_name) { + const char* pref_name) { ConfigurationPolicyPrefStore store(NULL, NULL); int result = 0; store.prefs()->GetInteger(pref_name, &result); @@ -123,7 +123,7 @@ void ConfigurationPolicyPrefStoreTest::TestIntegerPolicyGetDefault( } void ConfigurationPolicyPrefStoreTest::TestIntegerPolicySetValue( - const wchar_t* pref_name, ConfigurationPolicyStore::PolicyType type) { + const char* pref_name, ConfigurationPolicyStore::PolicyType type) { ConfigurationPolicyPrefStore store(NULL, NULL); store.Apply(type, Value::CreateIntegerValue(2)); int result = 0; @@ -132,7 +132,7 @@ void ConfigurationPolicyPrefStoreTest::TestIntegerPolicySetValue( } void ConfigurationPolicyPrefStoreTest::TestIntegerPolicy( - const wchar_t* pref_name, ConfigurationPolicyStore::PolicyType type) { + const char* pref_name, ConfigurationPolicyStore::PolicyType type) { TestIntegerPolicyGetDefault(pref_name); TestIntegerPolicySetValue(pref_name, type); } @@ -209,15 +209,15 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestSettingsProxyConfig) { // Ensure that all traces of the command-line specified proxy // switches have been overriden. - std::wstring string_result; + std::string string_result; EXPECT_TRUE(store.prefs()->GetString(prefs::kProxyBypassList, &string_result)); - EXPECT_EQ(string_result, L"http://chromium3.org"); + EXPECT_EQ(string_result, "http://chromium3.org"); EXPECT_TRUE(store.prefs()->GetString(prefs::kProxyPacUrl, &string_result)); - EXPECT_EQ(string_result, L"http://chromium.org/test.pac"); + EXPECT_EQ(string_result, "http://chromium.org/test.pac"); EXPECT_TRUE(store.prefs()->GetString(prefs::kProxyServer, &string_result)); - EXPECT_EQ(string_result, L"http://chromium2.org"); + EXPECT_EQ(string_result, "http://chromium2.org"); bool bool_result; EXPECT_TRUE(store.prefs()->GetBoolean(prefs::kNoProxyServer, &bool_result)); EXPECT_TRUE(bool_result); @@ -244,7 +244,7 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfigManualOverride) { Value::CreateIntegerValue( ConfigurationPolicyStore::kPolicyManuallyConfiguredProxyMode)); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyBypassList, - Value::CreateStringValue(L"http://chromium.org/override")); + Value::CreateStringValue("http://chromium.org/override")); ConfigurationPolicyPrefStore store(&command_line, provider.release()); @@ -252,10 +252,10 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfigManualOverride) { // Ensure that all traces of the command-line specified proxy // switches have been overriden. - std::wstring string_result; + std::string string_result; EXPECT_TRUE(store.prefs()->GetString(prefs::kProxyBypassList, &string_result)); - EXPECT_EQ(string_result, L"http://chromium.org/override"); + EXPECT_EQ(string_result, "http://chromium.org/override"); EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyPacUrl, &string_result)); EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyServer, &string_result)); @@ -273,7 +273,7 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfigNoProxy) { scoped_ptr<MockConfigurationPolicyProvider> provider( new MockConfigurationPolicyProvider()); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyBypassList, - Value::CreateStringValue(L"http://chromium.org/override")); + Value::CreateStringValue("http://chromium.org/override")); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyServerMode, Value::CreateIntegerValue( ConfigurationPolicyStore::kPolicyNoProxyServerMode)); @@ -281,7 +281,7 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfigNoProxy) { ConfigurationPolicyPrefStore store(&command_line, provider.release()); EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE); - std::wstring string_result; + std::string string_result; EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyBypassList, &string_result)); @@ -305,12 +305,12 @@ TEST_F(ConfigurationPolicyPrefStoreTest, Value::CreateIntegerValue( ConfigurationPolicyStore::kPolicyNoProxyServerMode)); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyBypassList, - Value::CreateStringValue(L"http://chromium.org/override")); + Value::CreateStringValue("http://chromium.org/override")); ConfigurationPolicyPrefStore store(&command_line, provider.release()); EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE); - std::wstring string_result; + std::string string_result; EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyBypassList, &string_result)); @@ -330,7 +330,7 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfigAutoDetect) { scoped_ptr<MockConfigurationPolicyProvider> provider( new MockConfigurationPolicyProvider()); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyBypassList, - Value::CreateStringValue(L"http://chromium.org/override")); + Value::CreateStringValue("http://chromium.org/override")); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyServerMode, Value::CreateIntegerValue( ConfigurationPolicyStore::kPolicyAutoDetectProxyMode)); @@ -340,10 +340,10 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfigAutoDetect) { // Ensure that all traces of the command-line specified proxy // switches have been overriden. - std::wstring string_result; + std::string string_result; EXPECT_TRUE(store.prefs()->GetString(prefs::kProxyBypassList, &string_result)); - EXPECT_EQ(string_result, L"http://chromium.org/override"); + EXPECT_EQ(string_result, "http://chromium.org/override"); EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyPacUrl, &string_result)); EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyServer, &string_result)); @@ -361,7 +361,7 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfiguseSystem) { scoped_ptr<MockConfigurationPolicyProvider> provider( new MockConfigurationPolicyProvider()); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyBypassList, - Value::CreateStringValue(L"http://chromium.org/override")); + Value::CreateStringValue("http://chromium.org/override")); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyServerMode, Value::CreateIntegerValue( ConfigurationPolicyStore::kPolicyUseSystemProxyMode)); @@ -369,10 +369,10 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyProxyConfiguseSystem) { ConfigurationPolicyPrefStore store(&command_line, provider.release()); EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE); - std::wstring string_result; + std::string string_result; EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyBypassList, &string_result)); - EXPECT_EQ(string_result, L""); + EXPECT_EQ(string_result, ""); EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyPacUrl, &string_result)); EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyServer, &string_result)); @@ -392,15 +392,15 @@ TEST_F(ConfigurationPolicyPrefStoreTest, Value::CreateIntegerValue( ConfigurationPolicyStore::kPolicyUseSystemProxyMode)); provider->AddPolicy(ConfigurationPolicyStore::kPolicyProxyBypassList, - Value::CreateStringValue(L"http://chromium.org/override")); + Value::CreateStringValue("http://chromium.org/override")); ConfigurationPolicyPrefStore store(&command_line, provider.release()); EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE); - std::wstring string_result; + std::string string_result; EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyBypassList, &string_result)); - EXPECT_EQ(string_result, L""); + EXPECT_EQ(string_result, ""); EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyPacUrl, &string_result)); EXPECT_FALSE(store.prefs()->GetString(prefs::kProxyServer, &string_result)); @@ -420,7 +420,7 @@ TEST_F(ConfigurationPolicyPrefStoreTest, ConfigurationPolicyPrefStore store(&command_line, provider.release()); ApplyStringPolicyValue(&store, ConfigurationPolicyStore::kPolicyDisabledPlugins, - L"plugin1"); + "plugin1"); EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE); ListValue* plugin_blacklist = NULL; @@ -448,7 +448,7 @@ TEST_F(ConfigurationPolicyPrefStoreTest, ConfigurationPolicyPrefStore store(&command_line, provider.release()); ApplyStringPolicyValue(&store, ConfigurationPolicyStore::kPolicyDisabledPlugins, - L"plugin1,plugin2\\,"); + "plugin1,plugin2\\,"); EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE); ListValue* plugin_blacklist = NULL; diff --git a/chrome/browser/pref_member.cc b/chrome/browser/pref_member.cc index 9502022..3b42198 100644 --- a/chrome/browser/pref_member.cc +++ b/chrome/browser/pref_member.cc @@ -23,7 +23,7 @@ PrefMemberBase::~PrefMemberBase() { } -void PrefMemberBase::Init(const wchar_t* pref_name, PrefService* prefs, +void PrefMemberBase::Init(const char* pref_name, PrefService* prefs, NotificationObserver* observer) { DCHECK(pref_name); DCHECK(prefs); diff --git a/chrome/browser/pref_member.h b/chrome/browser/pref_member.h index 012d3a1..e9d3c53 100644 --- a/chrome/browser/pref_member.h +++ b/chrome/browser/pref_member.h @@ -41,7 +41,7 @@ class PrefMemberBase : public NotificationObserver { virtual ~PrefMemberBase(); // See PrefMember<> for description. - void Init(const wchar_t* pref_name, PrefService* prefs, + void Init(const char* pref_name, PrefService* prefs, NotificationObserver* observer); // See PrefMember<> for description. @@ -57,12 +57,12 @@ class PrefMemberBase : public NotificationObserver { // This methods is used to do the actual sync with pref of the specified type. virtual void UpdateValueFromPref() = 0; - const std::wstring& pref_name() const { return pref_name_; } + const std::string& pref_name() const { return pref_name_; } PrefService* prefs() { return prefs_; } // Ordered the members to compact the class instance. private: - std::wstring pref_name_; + std::string pref_name_; NotificationObserver* observer_; PrefService* prefs_; @@ -84,7 +84,7 @@ class PrefMember : public subtle::PrefMemberBase { // Do the actual initialization of the class. |observer| may be null if you // don't want any notifications of changes. - void Init(const wchar_t* pref_name, PrefService* prefs, + void Init(const char* pref_name, PrefService* prefs, NotificationObserver* observer) { subtle::PrefMemberBase::Init(pref_name, prefs, observer); } diff --git a/chrome/browser/pref_member_unittest.cc b/chrome/browser/pref_member_unittest.cc index b0379d6..e280c72 100644 --- a/chrome/browser/pref_member_unittest.cc +++ b/chrome/browser/pref_member_unittest.cc @@ -12,10 +12,10 @@ namespace { -static const wchar_t kBoolPref[] = L"bool"; -static const wchar_t kIntPref[] = L"int"; -static const wchar_t kRealPref[] = L"real"; -static const wchar_t kStringPref[] = L"string"; +static const char kBoolPref[] = "bool"; +static const char kIntPref[] = "int"; +static const char kRealPref[] = "real"; +static const char kStringPref[] = "string"; void RegisterTestPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(kBoolPref, false); @@ -37,7 +37,7 @@ class PrefMemberTestClass : public NotificationObserver { DCHECK(NotificationType::PREF_CHANGED == type); PrefService* prefs_in = Source<PrefService>(source).ptr(); EXPECT_EQ(prefs_in, prefs_); - std::wstring* pref_name_in = Details<std::wstring>(details).ptr(); + std::string* pref_name_in = Details<std::string>(details).ptr(); EXPECT_EQ(*pref_name_in, kStringPref); EXPECT_EQ(str_.GetValue(), prefs_->GetString(kStringPref)); ++observe_cnt_; diff --git a/chrome/browser/pref_service.cc b/chrome/browser/pref_service.cc index 1fa5e6b..2a7dbe9 100644 --- a/chrome/browser/pref_service.cc +++ b/chrome/browser/pref_service.cc @@ -169,82 +169,146 @@ void PrefService::ScheduleSavePersistentPrefs() { pref_value_store_->ScheduleWritePrefs(); } -void PrefService::RegisterBooleanPref(const wchar_t* path, +void PrefService::RegisterBooleanPref(const char* path, bool default_value) { Preference* pref = new Preference(pref_value_store_.get(), path, Value::CreateBooleanValue(default_value)); RegisterPreference(pref); } -void PrefService::RegisterIntegerPref(const wchar_t* path, - int default_value) { +// 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); } -void PrefService::RegisterRealPref(const wchar_t* path, - double default_value) { +// 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); } -void PrefService::RegisterStringPref(const wchar_t* path, +// 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, Value::CreateStringValue(default_value)); RegisterPreference(pref); } -void PrefService::RegisterFilePathPref(const wchar_t* path, +// 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, Value::CreateStringValue(default_value.value())); RegisterPreference(pref); } -void PrefService::RegisterListPref(const wchar_t* path) { +// 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); } -void PrefService::RegisterDictionaryPref(const wchar_t* path) { +// 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); } -void PrefService::RegisterLocalizedBooleanPref(const wchar_t* path, +// 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, CreateLocaleDefaultValue(Value::TYPE_BOOLEAN, locale_default_message_id)); RegisterPreference(pref); } -void PrefService::RegisterLocalizedIntegerPref(const wchar_t* path, +// 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, CreateLocaleDefaultValue(Value::TYPE_INTEGER, locale_default_message_id)); RegisterPreference(pref); } -void PrefService::RegisterLocalizedRealPref(const wchar_t* path, +// 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, CreateLocaleDefaultValue(Value::TYPE_REAL, locale_default_message_id)); RegisterPreference(pref); } -void PrefService::RegisterLocalizedStringPref(const wchar_t* path, +// 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, CreateLocaleDefaultValue(Value::TYPE_STRING, locale_default_message_id)); RegisterPreference(pref); } -bool PrefService::GetBoolean(const wchar_t* path) const { +// 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()); bool result = false; @@ -259,7 +323,12 @@ bool PrefService::GetBoolean(const wchar_t* path) const { return result; } -int PrefService::GetInteger(const wchar_t* path) const { +// 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()); int result = 0; @@ -274,7 +343,12 @@ int PrefService::GetInteger(const wchar_t* path) const { return result; } -double PrefService::GetReal(const wchar_t* path) const { +// 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()); double result = 0.0; @@ -289,7 +363,12 @@ double PrefService::GetReal(const wchar_t* path) const { return result; } -std::string PrefService::GetString(const wchar_t* path) const { +// 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()); std::string result; @@ -304,7 +383,12 @@ std::string PrefService::GetString(const wchar_t* path) const { return result; } -FilePath PrefService::GetFilePath(const wchar_t* path) const { +// 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()); FilePath::StringType result; @@ -323,19 +407,35 @@ FilePath PrefService::GetFilePath(const wchar_t* path) const { return FilePath(result); } -bool PrefService::HasPrefPath(const wchar_t* path) const { +// 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 wchar_t* pref_name) const { + const char* pref_name) const { DCHECK(CalledOnValidThread()); Preference p(NULL, pref_name, NULL); PreferenceSet::const_iterator it = prefs_.find(&p); return it == prefs_.end() ? NULL : *it; } -bool PrefService::IsManagedPreference(const wchar_t* pref_name) const { +// 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()) { return true; @@ -343,18 +443,23 @@ bool PrefService::IsManagedPreference(const wchar_t* pref_name) const { return false; } -void PrefService::FireObserversIfChanged(const wchar_t* path, +// 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)) FireObservers(path); } -void PrefService::FireObservers(const wchar_t* path) { +void PrefService::FireObservers(const char* path) { DCHECK(CalledOnValidThread()); - // Convert path to a std::wstring because the Details constructor requires a + // Convert path to a std::string because the Details constructor requires a // class. - std::wstring path_str(path); + std::string path_str(path); PrefObserverMap::iterator observer_iterator = pref_observers_.find(path_str); if (observer_iterator == pref_observers_.end()) return; @@ -364,11 +469,11 @@ void PrefService::FireObservers(const wchar_t* path) { while ((observer = it.GetNext()) != NULL) { observer->Observe(NotificationType::PREF_CHANGED, Source<PrefService>(this), - Details<std::wstring>(&path_str)); + Details<std::string>(&path_str)); } } -bool PrefService::PrefIsChanged(const wchar_t* path, +bool PrefService::PrefIsChanged(const char* path, const Value* old_value) { Value* new_value = NULL; pref_value_store_->GetValue(path, &new_value); @@ -376,7 +481,7 @@ bool PrefService::PrefIsChanged(const wchar_t* path, return (!new_value || !old_value->Equals(new_value)); } -const DictionaryValue* PrefService::GetDictionary(const wchar_t* path) const { +const DictionaryValue* PrefService::GetDictionary(const char* path) const { DCHECK(CalledOnValidThread()); const Preference* pref = FindPreference(path); @@ -390,7 +495,12 @@ const DictionaryValue* PrefService::GetDictionary(const wchar_t* path) const { return static_cast<const DictionaryValue*>(value); } -const ListValue* PrefService::GetList(const wchar_t* path) const { +// 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()); const Preference* pref = FindPreference(path); @@ -404,7 +514,12 @@ const ListValue* PrefService::GetList(const wchar_t* path) const { return static_cast<const ListValue*>(value); } -void PrefService::AddPrefObserver(const wchar_t* path, +// 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()); @@ -438,7 +553,13 @@ void PrefService::AddPrefObserver(const wchar_t* path, observer_list->AddObserver(obs); } -void PrefService::RemovePrefObserver(const wchar_t* path, +// 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()); @@ -451,6 +572,12 @@ void PrefService::RemovePrefObserver(const wchar_t* 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()); @@ -462,7 +589,7 @@ void PrefService::RegisterPreference(Preference* pref) { prefs_.insert(pref); } -void PrefService::ClearPref(const wchar_t* path) { +void PrefService::ClearPref(const char* path) { DCHECK(CalledOnValidThread()); const Preference* pref = FindPreference(path); @@ -478,7 +605,12 @@ void PrefService::ClearPref(const wchar_t* path) { FireObservers(path); } -void PrefService::Set(const wchar_t* path, const Value& value) { +// 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()); const Preference* pref = FindPreference(path); @@ -509,7 +641,12 @@ void PrefService::Set(const wchar_t* path, const Value& value) { FireObserversIfChanged(path, old_value.get()); } -void PrefService::SetBoolean(const wchar_t* path, bool value) { +// 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()); const Preference* pref = FindPreference(path); @@ -533,7 +670,12 @@ void PrefService::SetBoolean(const wchar_t* path, bool value) { FireObserversIfChanged(path, old_value.get()); } -void PrefService::SetInteger(const wchar_t* path, int value) { +// 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()); const Preference* pref = FindPreference(path); @@ -557,7 +699,12 @@ void PrefService::SetInteger(const wchar_t* path, int value) { FireObserversIfChanged(path, old_value.get()); } -void PrefService::SetReal(const wchar_t* path, double value) { +// 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()); const Preference* pref = FindPreference(path); @@ -581,7 +728,12 @@ void PrefService::SetReal(const wchar_t* path, double value) { FireObserversIfChanged(path, old_value.get()); } -void PrefService::SetString(const wchar_t* path, const std::string& value) { +// 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()); const Preference* pref = FindPreference(path); @@ -605,7 +757,12 @@ void PrefService::SetString(const wchar_t* path, const std::string& value) { FireObserversIfChanged(path, old_value.get()); } -void PrefService::SetFilePath(const wchar_t* path, const FilePath& value) { +// 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()); const Preference* pref = FindPreference(path); @@ -637,7 +794,12 @@ void PrefService::SetFilePath(const wchar_t* path, const FilePath& value) { FireObserversIfChanged(path, old_value.get()); } -void PrefService::SetInt64(const wchar_t* path, int64 value) { +// 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()); const Preference* pref = FindPreference(path); @@ -661,7 +823,12 @@ void PrefService::SetInt64(const wchar_t* path, int64 value) { FireObserversIfChanged(path, old_value.get()); } -int64 PrefService::GetInt64(const wchar_t* path) const { +// 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()); const Preference* pref = FindPreference(path); @@ -678,13 +845,23 @@ int64 PrefService::GetInt64(const wchar_t* path) const { return val; } -void PrefService::RegisterInt64Pref(const wchar_t* path, int64 default_value) { +// 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); } -DictionaryValue* PrefService::GetMutableDictionary(const wchar_t* path) { +// 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()); const Preference* pref = FindPreference(path); @@ -709,7 +886,12 @@ DictionaryValue* PrefService::GetMutableDictionary(const wchar_t* path) { return dict; } -ListValue* PrefService::GetMutableList(const wchar_t* path) { +// TODO(viettrungluu): deprecate: +DictionaryValue* PrefService::GetMutableDictionary(const wchar_t* path) { + return GetMutableDictionary(WideToUTF8(path).c_str()); +} + +ListValue* PrefService::GetMutableList(const char* path) { DCHECK(CalledOnValidThread()); const Preference* pref = FindPreference(path); @@ -733,7 +915,12 @@ ListValue* PrefService::GetMutableList(const wchar_t* path) { return list; } -Value* PrefService::GetPrefCopy(const wchar_t* path) { +// TODO(viettrungluu): deprecate: +ListValue* PrefService::GetMutableList(const wchar_t* path) { + return GetMutableList(WideToUTF8(path).c_str()); +} + +Value* PrefService::GetPrefCopy(const char* path) { DCHECK(CalledOnValidThread()); const Preference* pref = FindPreference(path); @@ -745,7 +932,7 @@ Value* PrefService::GetPrefCopy(const wchar_t* path) { // PrefService::Preference PrefService::Preference::Preference(PrefValueStore* pref_value_store, - const wchar_t* name, + const char* name, Value* default_value) : type_(Value::TYPE_NULL), name_(name), @@ -811,7 +998,7 @@ void PrefService::FireObserversForRefreshedManagedPrefs( for (current = changed_prefs_paths.begin(); current != changed_prefs_paths.end(); ++current) { - FireObservers(UTF8ToWide(current->data()).data()); + FireObservers(current->c_str()); } } diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h index e15c5f5..58e5ea9 100644 --- a/chrome/browser/pref_service.h +++ b/chrome/browser/pref_service.h @@ -34,7 +34,6 @@ class ScopedPrefUpdate; class PrefService : public NonThreadSafe, public NotificationObserver { public: - // A helper class to store all the information associated with a preference. class Preference { public: @@ -45,7 +44,7 @@ class PrefService : public NonThreadSafe, // your own, use the PrefService::Register*Pref methods instead. // |default_value| will be owned by the Preference object. Preference(PrefValueStore* pref_value_store, - const wchar_t* name, + const char* name, Value* default_value); ~Preference() {} @@ -53,7 +52,7 @@ class PrefService : public NonThreadSafe, // Returns the name of the Preference (i.e., the key, e.g., // browser.window_placement). - const std::wstring name() const { return name_; } + const std::string name() const { return name_; } // Returns the value of the Preference. If there is no user specified // value, it returns the default value. @@ -92,7 +91,7 @@ class PrefService : public NonThreadSafe, friend class PrefService; Value::ValueType type_; - std::wstring name_; + std::string name_; scoped_ptr<Value> default_value_; // A reference to the pref service's pref_value_store_. @@ -128,7 +127,8 @@ class PrefService : public NonThreadSafe, // Returns true if the preference for the given preference name is available // and is managed. - bool IsManagedPreference(const wchar_t* pref_name) const; + 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 @@ -141,66 +141,103 @@ class PrefService : public NonThreadSafe, void ScheduleSavePersistentPrefs(); // Make the PrefService aware of a pref. - void RegisterBooleanPref(const wchar_t* path, - bool default_value); - void RegisterIntegerPref(const wchar_t* path, - int default_value); - void RegisterRealPref(const wchar_t* path, - double default_value); - void RegisterStringPref(const wchar_t* path, - const std::string& default_value); - void RegisterFilePathPref(const wchar_t* path, - const FilePath& default_value); - void RegisterListPref(const wchar_t* path); - void RegisterDictionaryPref(const wchar_t* path); + void RegisterBooleanPref(const char* path, bool default_value); + void RegisterIntegerPref(const char* path, int default_value); + void RegisterRealPref(const char* path, double default_value); + void RegisterStringPref(const char* path, const std::string& default_value); + 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 wchar_t* path, + void RegisterLocalizedBooleanPref(const char* path, int locale_default_message_id); - void RegisterLocalizedIntegerPref(const wchar_t* path, + void RegisterLocalizedIntegerPref(const char* path, int locale_default_message_id); - void RegisterLocalizedRealPref(const wchar_t* path, + void RegisterLocalizedRealPref(const char* path, int locale_default_message_id); - void RegisterLocalizedStringPref(const wchar_t* path, + 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 // value (set when the pref was registered) will be returned. - bool GetBoolean(const wchar_t* path) const; - int GetInteger(const wchar_t* path) const; - double GetReal(const wchar_t* path) const; - std::string GetString(const wchar_t* path) const; - FilePath GetFilePath(const wchar_t* path) const; + bool GetBoolean(const char* path) const; + int GetInteger(const char* path) const; + 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 wchar_t* path) const; - const ListValue* GetList(const wchar_t* path) const; + 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 wchar_t* path, NotificationObserver* obs); - void RemovePrefObserver(const wchar_t* path, NotificationObserver* obs); + 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 wchar_t* path); + 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. - void Set(const wchar_t* path, const Value& value); - void SetBoolean(const wchar_t* path, bool value); - void SetInteger(const wchar_t* path, int value); - void SetReal(const wchar_t* path, double value); - void SetString(const wchar_t* path, const std::string& value); - void SetFilePath(const wchar_t* path, const FilePath& value); + void Set(const char* path, const Value& value); + void SetBoolean(const char* path, bool value); + void SetInteger(const char* path, int value); + 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 // Value type will be TYPE_STRING. - void SetInt64(const wchar_t* path, int64 value); - int64 GetInt64(const wchar_t* path) const; - void RegisterInt64Pref(const wchar_t* path, int64 default_value); + 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. @@ -209,14 +246,17 @@ class PrefService : public NonThreadSafe, // WARNING: Changes to the dictionary or list will not automatically notify // pref observers. // Use a ScopedPrefUpdate to update observers on changes. - DictionaryValue* GetMutableDictionary(const wchar_t* path); - ListValue* GetMutableList(const wchar_t* path); + 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 wchar_t* path) const; + bool HasPrefPath(const char* path) const; + /*DEPRECATED*/bool HasPrefPath(const wchar_t* path) const; class PreferencePathComparator { public: @@ -229,22 +269,24 @@ 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 wchar_t* pref_name) const; + 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 // unit test. - virtual void FireObserversIfChanged(const wchar_t* pref_name, + virtual void FireObserversIfChanged(const char* pref_name, const Value* old_value); bool read_only() const { return pref_value_store_->ReadOnly(); } protected: // For the given pref_name, fire any observer of the pref. - void FireObservers(const wchar_t* pref_name); + void FireObservers(const char* pref_name); // This should only be accessed by subclasses for unit-testing. - bool PrefIsChanged(const wchar_t* path, const Value* old_value); + bool PrefIsChanged(const char* path, const Value* old_value); private: // Add a preference to the PreferenceMap. If the pref already exists, return @@ -253,7 +295,7 @@ class PrefService : public NonThreadSafe, // Returns a copy of the current pref value. The caller is responsible for // deleting the returned object. - Value* GetPrefCopy(const wchar_t* pref_name); + Value* GetPrefCopy(const char* pref_name); // Load from disk. Returns a non-zero error code on failure. PrefStore::PrefReadError LoadPersistentPrefs(); @@ -292,7 +334,7 @@ class PrefService : public NonThreadSafe, // A map from pref names to a list of observers. Observers get fired in the // order they are added. typedef ObserverList<NotificationObserver> NotificationObserverList; - typedef base::hash_map<std::wstring, NotificationObserverList*> + typedef base::hash_map<std::string, NotificationObserverList*> PrefObserverMap; PrefObserverMap pref_observers_; diff --git a/chrome/browser/pref_service_uitest.cc b/chrome/browser/pref_service_uitest.cc index 2f8f4e0..9712481 100644 --- a/chrome/browser/pref_service_uitest.cc +++ b/chrome/browser/pref_service_uitest.cc @@ -103,23 +103,23 @@ TEST_F(PreferenceServiceTest, PreservedWindowPlacementIsLoaded) { // Retrieve the expected rect values from "Preferences" int bottom = 0; - std::wstring kBrowserWindowPlacement(prefs::kBrowserWindowPlacement); - EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + L".bottom", + std::string kBrowserWindowPlacement(prefs::kBrowserWindowPlacement); + EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".bottom", &bottom)); EXPECT_EQ(bottom, bounds.y() + bounds.height()); int top = 0; - EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + L".top", + EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".top", &top)); EXPECT_EQ(top, bounds.y()); int left = 0; - EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + L".left", + EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".left", &left)); EXPECT_EQ(left, bounds.x()); int right = 0; - EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + L".right", + EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".right", &right)); EXPECT_EQ(right, bounds.x() + bounds.width()); @@ -127,7 +127,7 @@ TEST_F(PreferenceServiceTest, PreservedWindowPlacementIsLoaded) { bool is_window_maximized = false; ASSERT_TRUE(window->IsMaximized(&is_window_maximized)); bool is_maximized = false; - EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + L".maximized", + EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", &is_maximized)); EXPECT_EQ(is_maximized, is_window_maximized); } diff --git a/chrome/browser/pref_service_unittest.cc b/chrome/browser/pref_service_unittest.cc index 967c0cb..1f68e41 100644 --- a/chrome/browser/pref_service_unittest.cc +++ b/chrome/browser/pref_service_unittest.cc @@ -26,7 +26,7 @@ using testing::Property; class TestPrefObserver : public NotificationObserver { public: TestPrefObserver(const PrefService* prefs, - const std::wstring& pref_name, + const std::string& pref_name, const std::string& new_pref_value) : observer_fired_(false), prefs_(prefs), @@ -41,9 +41,9 @@ class TestPrefObserver : public NotificationObserver { EXPECT_EQ(type.value, NotificationType::PREF_CHANGED); PrefService* prefs_in = Source<PrefService>(source).ptr(); EXPECT_EQ(prefs_in, prefs_); - std::wstring* pref_name_in = Details<std::wstring>(details).ptr(); + std::string* pref_name_in = Details<std::string>(details).ptr(); EXPECT_EQ(*pref_name_in, pref_name_); - EXPECT_EQ(new_pref_value_, prefs_in->GetString(L"homepage")); + EXPECT_EQ(new_pref_value_, prefs_in->GetString("homepage")); observer_fired_ = true; } @@ -57,7 +57,7 @@ class TestPrefObserver : public NotificationObserver { private: bool observer_fired_; const PrefService* prefs_; - const std::wstring pref_name_; + const std::string pref_name_; std::string new_pref_value_; }; @@ -65,9 +65,9 @@ class TestPrefObserver : public NotificationObserver { #if defined(OS_WIN) TEST(PrefServiceTest, LocalizedPrefs) { TestingPrefService prefs; - const wchar_t kBoolean[] = L"boolean"; - const wchar_t kInteger[] = L"integer"; - const wchar_t kString[] = L"string"; + const char kBoolean[] = "boolean"; + const char kInteger[] = "integer"; + const char kString[] = "string"; prefs.RegisterLocalizedBooleanPref(kBoolean, IDS_LOCALE_BOOL); prefs.RegisterLocalizedIntegerPref(kInteger, IDS_LOCALE_INT); prefs.RegisterLocalizedStringPref(kString, IDS_LOCALE_STRING); @@ -89,7 +89,7 @@ TEST(PrefServiceTest, LocalizedPrefs) { TEST(PrefServiceTest, NoObserverFire) { TestingPrefService prefs; - const wchar_t pref_name[] = L"homepage"; + const char pref_name[] = "homepage"; prefs.RegisterStringPref(pref_name, ""); const std::string new_pref_value("http://www.google.com/"); @@ -124,7 +124,7 @@ TEST(PrefServiceTest, NoObserverFire) { TEST(PrefServiceTest, HasPrefPath) { TestingPrefService prefs; - const wchar_t path[] = L"fake.path"; + const char path[] = "fake.path"; // Shouldn't initially have a path. EXPECT_FALSE(prefs.HasPrefPath(path)); @@ -140,10 +140,10 @@ TEST(PrefServiceTest, HasPrefPath) { } TEST(PrefServiceTest, Observers) { - const wchar_t pref_name[] = L"homepage"; + const char pref_name[] = "homepage"; TestingPrefService prefs; - prefs.SetUserPref(pref_name, Value::CreateStringValue(L"http://www.cnn.com")); + prefs.SetUserPref(pref_name, Value::CreateStringValue("http://www.cnn.com")); prefs.RegisterStringPref(pref_name, ""); const std::string new_pref_value("http://www.google.com/"); @@ -180,7 +180,7 @@ TEST(PrefServiceTest, Observers) { class PrefServiceSetValueTest : public testing::Test { protected: - static const wchar_t name_[]; + static const char name_[]; static const char value_[]; PrefServiceSetValueTest() @@ -194,17 +194,17 @@ class PrefServiceSetValueTest : public testing::Test { void SetExpectPrefChanged() { EXPECT_CALL(observer_, Observe(NotificationType(NotificationType::PREF_CHANGED), _, - Property(&Details<std::wstring>::ptr, + Property(&Details<std::string>::ptr, Pointee(name_string_)))); } TestingPrefService prefs_; - std::wstring name_string_; + std::string name_string_; scoped_ptr<Value> null_value_; NotificationObserverMock observer_; }; -const wchar_t PrefServiceSetValueTest::name_[] = L"name"; +const char PrefServiceSetValueTest::name_[] = "name"; const char PrefServiceSetValueTest::value_[] = "value"; TEST_F(PrefServiceSetValueTest, SetStringValue) { diff --git a/chrome/browser/pref_set_observer.cc b/chrome/browser/pref_set_observer.cc index 1e9f904..fb08a9b 100644 --- a/chrome/browser/pref_set_observer.cc +++ b/chrome/browser/pref_set_observer.cc @@ -18,19 +18,19 @@ PrefSetObserver::~PrefSetObserver() { pref_service_->RemovePrefObserver(i->c_str(), this); } -void PrefSetObserver::AddPref(const std::wstring& pref) { +void PrefSetObserver::AddPref(const std::string& pref) { if (!prefs_.count(pref) && pref_service_->FindPreference(pref.c_str())) { prefs_.insert(pref); pref_service_->AddPrefObserver(pref.c_str(), this); } } -void PrefSetObserver::RemovePref(const std::wstring& pref) { +void PrefSetObserver::RemovePref(const std::string& pref) { if (prefs_.erase(pref)) pref_service_->RemovePrefObserver(pref.c_str(), this); } -bool PrefSetObserver::IsObserved(const std::wstring& pref) { +bool PrefSetObserver::IsObserved(const std::string& pref) { return prefs_.count(pref) > 0; } diff --git a/chrome/browser/pref_set_observer.h b/chrome/browser/pref_set_observer.h index 33813fc..787c078f 100644 --- a/chrome/browser/pref_set_observer.h +++ b/chrome/browser/pref_set_observer.h @@ -22,12 +22,12 @@ class PrefSetObserver : public NotificationObserver { virtual ~PrefSetObserver(); // Add a |pref| to the set of preferences to observe. - void AddPref(const std::wstring& pref); + void AddPref(const std::string& pref); // Remove |pref| from the set of observed peferences. - void RemovePref(const std::wstring& pref); + void RemovePref(const std::string& pref); // Check whether |pref| is in the set of observed preferences. - bool IsObserved(const std::wstring& pref); + bool IsObserved(const std::string& pref); // Check whether any of the observed preferences has the managed bit set. bool IsManaged(); @@ -42,7 +42,7 @@ class PrefSetObserver : public NotificationObserver { const NotificationSource& source, const NotificationDetails& details); - typedef std::set<std::wstring> PrefSet; + typedef std::set<std::string> PrefSet; PrefSet prefs_; PrefService* pref_service_; diff --git a/chrome/browser/pref_set_observer_unittest.cc b/chrome/browser/pref_set_observer_unittest.cc index ddb4d54..4426da2 100644 --- a/chrome/browser/pref_set_observer_unittest.cc +++ b/chrome/browser/pref_set_observer_unittest.cc @@ -53,8 +53,7 @@ TEST_F(PrefSetObserverTest, IsManaged) { } MATCHER_P(PrefNameDetails, name, "details references named preference") { - std::wstring* pstr = - reinterpret_cast<const Details<std::wstring>&>(arg).ptr(); + std::string* pstr = reinterpret_cast<const Details<std::string>&>(arg).ptr(); return pstr && *pstr == name; } diff --git a/chrome/browser/pref_value_store.cc b/chrome/browser/pref_value_store.cc index 70837f0..47b01e0 100644 --- a/chrome/browser/pref_value_store.cc +++ b/chrome/browser/pref_value_store.cc @@ -42,7 +42,7 @@ PrefValueStore* PrefValueStore::CreatePrefValueStore( PrefValueStore::~PrefValueStore() {} -bool PrefValueStore::GetValue(const std::wstring& name, +bool PrefValueStore::GetValue(const std::string& name, Value** out_value) const { // Check the |PrefStore|s in order of their priority from highest to lowest // to find the value of the preference described by the given preference name. @@ -87,9 +87,9 @@ PrefStore::PrefReadError PrefValueStore::ReadPrefs() { return result; } -bool PrefValueStore::HasPrefPath(const wchar_t* path) const { +bool PrefValueStore::HasPrefPath(const char* path) const { Value* tmp_value = NULL; - const std::wstring name(path); + const std::string name(path); bool rv = GetValue(name, &tmp_value); return rv; } @@ -97,7 +97,7 @@ bool PrefValueStore::HasPrefPath(const wchar_t* path) const { // Note the |DictionaryValue| referenced by the |PrefStore| user_prefs_ // (returned by the method prefs()) takes the ownership of the Value referenced // by in_value. -void PrefValueStore::SetUserPrefValue(const wchar_t* name, Value* in_value) { +void PrefValueStore::SetUserPrefValue(const char* name, Value* in_value) { pref_stores_[USER]->prefs()->Set(name, in_value); } @@ -105,38 +105,38 @@ bool PrefValueStore::ReadOnly() { return pref_stores_[USER]->ReadOnly(); } -void PrefValueStore::RemoveUserPrefValue(const wchar_t* name) { +void PrefValueStore::RemoveUserPrefValue(const char* name) { if (pref_stores_[USER].get()) { pref_stores_[USER]->prefs()->Remove(name, NULL); } } -bool PrefValueStore::PrefValueInManagedStore(const wchar_t* name) { +bool PrefValueStore::PrefValueInManagedStore(const char* name) { return PrefValueInStore(name, MANAGED); } -bool PrefValueStore::PrefValueInExtensionStore(const wchar_t* name) { +bool PrefValueStore::PrefValueInExtensionStore(const char* name) { return PrefValueInStore(name, EXTENSION); } -bool PrefValueStore::PrefValueInUserStore(const wchar_t* name) { +bool PrefValueStore::PrefValueInUserStore(const char* name) { return PrefValueInStore(name, USER); } -bool PrefValueStore::PrefValueFromExtensionStore(const wchar_t* name) { +bool PrefValueStore::PrefValueFromExtensionStore(const char* name) { return ControllingPrefStoreForPref(name) == EXTENSION; } -bool PrefValueStore::PrefValueFromUserStore(const wchar_t* name) { +bool PrefValueStore::PrefValueFromUserStore(const char* name) { return ControllingPrefStoreForPref(name) == USER; } -bool PrefValueStore::PrefValueUserModifiable(const wchar_t* name) { +bool PrefValueStore::PrefValueUserModifiable(const char* name) { PrefStoreType effective_store = ControllingPrefStoreForPref(name); return effective_store >= USER || effective_store == INVALID; } -bool PrefValueStore::PrefValueInStore(const wchar_t* name, PrefStoreType type) { +bool PrefValueStore::PrefValueInStore(const char* name, PrefStoreType type) { if (!pref_stores_[type].get()) { // No store of that type set, so this pref can't be in it. return false; @@ -146,7 +146,7 @@ bool PrefValueStore::PrefValueInStore(const wchar_t* name, PrefStoreType type) { } PrefValueStore::PrefStoreType PrefValueStore::ControllingPrefStoreForPref( - const wchar_t* name) { + const char* name) { for (int i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { if (PrefValueInStore(name, static_cast<PrefStoreType>(i))) return static_cast<PrefStoreType>(i); diff --git a/chrome/browser/pref_value_store.h b/chrome/browser/pref_value_store.h index adb51a9..9dfa56e 100644 --- a/chrome/browser/pref_value_store.h +++ b/chrome/browser/pref_value_store.h @@ -55,7 +55,7 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { // Get the preference value for the given preference name. // Return true if a value for the given preference name was found. - bool GetValue(const std::wstring& name, Value** out_value) const; + bool GetValue(const std::string& name, Value** out_value) const; // Read preference values into the three PrefStores so that they are available // through the GetValue method. Return the first error that occurs (but @@ -72,7 +72,7 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { void ScheduleWritePrefs(); // Returns true if the PrefValueStore contains the given preference. - bool HasPrefPath(const wchar_t* name) const; + bool HasPrefPath(const char* name) const; // Returns true if the PrefValueStore is read-only. // Because the managed and recommended PrefStores are always read-only, the @@ -87,28 +87,28 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { // of the preference. Note that the PrefValueStore takes the ownership of // the value referenced by |in_value|. It is an error to call this when no // user PrefStore has been set. - void SetUserPrefValue(const wchar_t* name, Value* in_value); + void SetUserPrefValue(const char* name, Value* in_value); // Removes a value from the PrefValueStore. If a preference is managed // or recommended this function should have no effect. - void RemoveUserPrefValue(const wchar_t* name); + void RemoveUserPrefValue(const char* name); // These methods return true if a preference with the given name is in the // indicated pref store, even if that value is currently being overridden by // a higher-priority source. - bool PrefValueInManagedStore(const wchar_t* name); - bool PrefValueInExtensionStore(const wchar_t* name); - bool PrefValueInUserStore(const wchar_t* name); + bool PrefValueInManagedStore(const char* name); + bool PrefValueInExtensionStore(const char* name); + bool PrefValueInUserStore(const char* name); // These methods return true if a preference with the given name is actually // being controlled by the indicated pref store and not being overridden by // a higher-priority source. - bool PrefValueFromExtensionStore(const wchar_t* name); - bool PrefValueFromUserStore(const wchar_t* name); + bool PrefValueFromExtensionStore(const char* name); + bool PrefValueFromUserStore(const char* name); // Check whether a Preference value is modifiable by the user, i.e. whether // there is no higher-priority source controlling it. - bool PrefValueUserModifiable(const wchar_t* name); + bool PrefValueUserModifiable(const char* name); // Signature of callback triggered after policy refresh. Parameter is not // passed as reference to prevent passing along a pointer to a set whose @@ -166,12 +166,12 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { scoped_ptr<PrefStore> pref_stores_[PREF_STORE_TYPE_MAX + 1]; - bool PrefValueInStore(const wchar_t* name, PrefStoreType type); + bool PrefValueInStore(const char* name, PrefStoreType type); // Returns the pref store type identifying the source that controls the // Preference identified by |name|. If none of the sources has a value, // INVALID is returned. - PrefStoreType ControllingPrefStoreForPref(const wchar_t* name); + PrefStoreType ControllingPrefStoreForPref(const char* name); // Called during policy refresh after ReadPrefs completes on the thread // that initiated the policy refresh. RefreshPolicyPrefsCompletion takes diff --git a/chrome/browser/pref_value_store_unittest.cc b/chrome/browser/pref_value_store_unittest.cc index a4af696..42033fb 100644 --- a/chrome/browser/pref_value_store_unittest.cc +++ b/chrome/browser/pref_value_store_unittest.cc @@ -18,18 +18,18 @@ using testing::Mock; // Names of the preferences used in this test program. namespace prefs { - const wchar_t kCurrentThemeID[] = L"extensions.theme.id"; - const wchar_t kDeleteCache[] = L"browser.clear_data.cache"; - const wchar_t kHomepage[] = L"homepage"; - const wchar_t kMaxTabs[] = L"tabs.max_tabs"; - const wchar_t kMissingPref[] = L"this.pref.does_not_exist"; - const wchar_t kRecommendedPref[] = L"this.pref.recommended_value_only"; - const wchar_t kSampleDict[] = L"sample.dict"; - const wchar_t kSampleList[] = L"sample.list"; + const char kCurrentThemeID[] = "extensions.theme.id"; + const char kDeleteCache[] = "browser.clear_data.cache"; + const char kHomepage[] = "homepage"; + const char kMaxTabs[] = "tabs.max_tabs"; + const char kMissingPref[] = "this.pref.does_not_exist"; + const char kRecommendedPref[] = "this.pref.recommended_value_only"; + const char kSampleDict[] = "sample.dict"; + const char kSampleList[] = "sample.list"; // This must match the actual pref name so the command-line store knows about // it. - const wchar_t kApplicationLocale[] = L"intl.app_locale"; + const char kApplicationLocale[] = "intl.app_locale"; } // Potentailly expected values of all preferences used in this test program. @@ -38,24 +38,24 @@ namespace prefs { namespace user_pref { const int kMaxTabsValue = 31; const bool kDeleteCacheValue = true; - const std::wstring kCurrentThemeIDValue = L"abcdefg"; - const std::wstring kHomepageValue = L"http://www.google.com"; - const std::wstring kApplicationLocaleValue = L"is-WRONG"; + const char kCurrentThemeIDValue[] = "abcdefg"; + const char kHomepageValue[] = "http://www.google.com"; + const char kApplicationLocaleValue[] = "is-WRONG"; } namespace enforced_pref { - const std::wstring kHomepageValue = L"http://www.topeka.com"; + const std::string kHomepageValue = "http://www.topeka.com"; } namespace extension_pref { - const std::wstring kCurrentThemeIDValue = L"set by extension"; - const std::wstring kHomepageValue = L"http://www.chromium.org"; + const char kCurrentThemeIDValue[] = "set by extension"; + const char kHomepageValue[] = "http://www.chromium.org"; } namespace command_line_pref { - const std::wstring kApplicationLocaleValue = L"hi-MOM"; - const std::wstring kCurrentThemeIDValue = L"zyxwvut"; - const std::wstring kHomepageValue = L"http://www.ferretcentral.org"; + const char kApplicationLocaleValue[] = "hi-MOM"; + const char kCurrentThemeIDValue[] = "zyxwvut"; + const char kHomepageValue[] = "http://www.ferretcentral.org"; } namespace recommended_pref { @@ -115,7 +115,7 @@ class PrefValueStoreTest : public testing::Test { DictionaryValue* CreateEnforcedPrefs() { DictionaryValue* enforced_prefs = new DictionaryValue(); enforced_prefs->SetString(prefs::kHomepage, enforced_pref::kHomepageValue); - expected_differing_paths_.push_back(WideToUTF8(prefs::kHomepage)); + expected_differing_paths_.push_back(prefs::kHomepage); return enforced_prefs; } @@ -150,10 +150,10 @@ class PrefValueStoreTest : public testing::Test { // Expected differing paths must be added in lexicographic order // to work properly expected_differing_paths_.push_back("tabs"); - expected_differing_paths_.push_back(WideToUTF8(prefs::kMaxTabs)); + expected_differing_paths_.push_back(prefs::kMaxTabs); expected_differing_paths_.push_back("this"); expected_differing_paths_.push_back("this.pref"); - expected_differing_paths_.push_back(WideToUTF8(prefs::kRecommendedPref)); + expected_differing_paths_.push_back(prefs::kRecommendedPref); return recommended_prefs; } DictionaryValue* CreateSampleDictValue() { @@ -225,7 +225,7 @@ TEST_F(PrefValueStoreTest, GetValue) { // extension-defined value. value = NULL; ASSERT_TRUE(pref_value_store_->GetValue(prefs::kHomepage, &value)); - std::wstring actual_str_value; + std::string actual_str_value; EXPECT_TRUE(value->GetAsString(&actual_str_value)); EXPECT_EQ(enforced_pref::kHomepageValue, actual_str_value); @@ -308,7 +308,7 @@ TEST_F(PrefValueStoreTest, SetUserPrefValue) { pref_value_store_->SetUserPrefValue(prefs::kHomepage, new_value); ASSERT_TRUE(pref_value_store_->GetValue(prefs::kHomepage, &actual_value)); - std::wstring value_str; + std::string value_str; actual_value->GetAsString(&value_str); ASSERT_EQ(enforced_pref::kHomepageValue, value_str); @@ -331,7 +331,7 @@ TEST_F(PrefValueStoreTest, SetUserPrefValue) { pref_value_store_->SetUserPrefValue(prefs::kSampleDict, expected_dict_value); actual_value = NULL; - std::wstring key(prefs::kSampleDict); + std::string key(prefs::kSampleDict); pref_value_store_->GetValue(key , &actual_value); ASSERT_EQ(expected_dict_value, actual_value); diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc index 63269b2..9cfc4a2 100644 --- a/chrome/browser/profile_impl.cc +++ b/chrome/browser/profile_impl.cc @@ -1121,7 +1121,7 @@ void ProfileImpl::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (NotificationType::PREF_CHANGED == type) { - std::wstring* pref_name_in = Details<std::wstring>(details).ptr(); + std::string* pref_name_in = Details<std::string>(details).ptr(); PrefService* prefs = Source<PrefService>(source).ptr(); DCHECK(pref_name_in && prefs); if (*pref_name_in == prefs::kSpellCheckDictionary || diff --git a/chrome/browser/scoped_pref_update.cc b/chrome/browser/scoped_pref_update.cc index 6a18bf6..5e74ee3 100644 --- a/chrome/browser/scoped_pref_update.cc +++ b/chrome/browser/scoped_pref_update.cc @@ -2,13 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/utf_string_conversions.h" // TODO(viettrungluu): remove #include "chrome/browser/pref_service.h" #include "chrome/browser/scoped_pref_update.h" -ScopedPrefUpdate::ScopedPrefUpdate(PrefService* service, const wchar_t* path) +ScopedPrefUpdate::ScopedPrefUpdate(PrefService* service, const char* path) : service_(service), path_(path) {} +// TODO(viettrungluu): deprecate and remove #include +ScopedPrefUpdate::ScopedPrefUpdate(PrefService* service, const wchar_t* path) + : service_(service), + path_(WideToUTF8(path)) {} + ScopedPrefUpdate::~ScopedPrefUpdate() { service_->FireObservers(path_.c_str()); } diff --git a/chrome/browser/scoped_pref_update.h b/chrome/browser/scoped_pref_update.h index 9afa2c8..518219a 100644 --- a/chrome/browser/scoped_pref_update.h +++ b/chrome/browser/scoped_pref_update.h @@ -13,12 +13,14 @@ class ScopedPrefUpdate { public: + ScopedPrefUpdate(PrefService* service, const char* path); + // TODO(viettrungluu): deprecate: ScopedPrefUpdate(PrefService* service, const wchar_t* path); ~ScopedPrefUpdate(); private: PrefService* service_; - std::wstring path_; + std::string path_; }; #endif // CHROME_BROWSER_SCOPED_PREF_UPDATE_H_ diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index 469fcbd..46c05a9 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -17,6 +17,7 @@ #include "base/scoped_comptr_win.h" #include "base/string_util.h" #include "base/task.h" +#include "base/utf_string_conversions.h" #include "base/win_util.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/web_applications/web_app.h" @@ -224,8 +225,8 @@ bool MigrateChromiumShortcutsTask::GetExpectedAppId( std::wstring app_name; if (command_line.HasSwitch(switches::kApp)) { - app_name = web_app::GenerateApplicationNameFromURL( - GURL(command_line.GetSwitchValueASCII(switches::kApp))); + app_name = UTF8ToWide(web_app::GenerateApplicationNameFromURL( + GURL(command_line.GetSwitchValueASCII(switches::kApp)))); } else { app_name = BrowserDistribution::GetDistribution()->GetBrowserAppId(); } diff --git a/chrome/browser/sync/glue/preference_change_processor.cc b/chrome/browser/sync/glue/preference_change_processor.cc index 2b8a6fe..76338d1 100644 --- a/chrome/browser/sync/glue/preference_change_processor.cc +++ b/chrome/browser/sync/glue/preference_change_processor.cc @@ -43,7 +43,7 @@ void PreferenceChangeProcessor::Observe(NotificationType type, DCHECK(NotificationType::PREF_CHANGED == type); DCHECK_EQ(pref_service_, Source<PrefService>(source).ptr()); - std::wstring* name = Details<std::wstring>(details).ptr(); + std::string* name = Details<std::string>(details).ptr(); const PrefService::Preference* preference = pref_service_->FindPreference((*name).c_str()); DCHECK(preference); @@ -71,8 +71,7 @@ void PreferenceChangeProcessor::Observe(NotificationType type, return; } - std::string tag = WideToUTF8(*name); - if (!node.InitUniqueByCreation(syncable::PREFERENCES, root, tag)) { + if (!node.InitUniqueByCreation(syncable::PREFERENCES, root, *name)) { error_handler()->OnUnrecoverableError( FROM_HERE, "Failed to create preference sync node."); @@ -127,7 +126,7 @@ void PreferenceChangeProcessor::ApplyChangesFromSyncModel( } DCHECK(syncable::PREFERENCES == node.GetModelType()); - std::wstring name; + std::string name; scoped_ptr<Value> value(ReadPreference(&node, &name)); // Skip values we can't deserialize. if (!value.get()) @@ -138,7 +137,7 @@ void PreferenceChangeProcessor::ApplyChangesFromSyncModel( // client and a Windows client, the Windows client does not // support kShowPageOptionsButtons. Ignore updates from these // preferences. - const wchar_t* pref_name = name.c_str(); + const char* pref_name = name.c_str(); if (model_associator_->synced_preferences().count(pref_name) == 0) continue; @@ -171,7 +170,7 @@ void PreferenceChangeProcessor::ApplyChangesFromSyncModel( Value* PreferenceChangeProcessor::ReadPreference( sync_api::ReadNode* node, - std::wstring* name) { + std::string* name) { const sync_pb::PreferenceSpecifics& preference( node->GetPreferenceSpecifics()); base::JSONReader reader; @@ -182,7 +181,7 @@ Value* PreferenceChangeProcessor::ReadPreference( error_handler()->OnUnrecoverableError(FROM_HERE, err); return NULL; } - *name = UTF8ToWide(preference.name()); + *name = preference.name(); return value.release(); } @@ -201,7 +200,7 @@ void PreferenceChangeProcessor::StopImpl() { void PreferenceChangeProcessor::StartObserving() { DCHECK(pref_service_); - for (std::set<std::wstring>::const_iterator it = + for (std::set<std::string>::const_iterator it = model_associator_->synced_preferences().begin(); it != model_associator_->synced_preferences().end(); ++it) { pref_service_->AddPrefObserver((*it).c_str(), this); @@ -210,7 +209,7 @@ void PreferenceChangeProcessor::StartObserving() { void PreferenceChangeProcessor::StopObserving() { DCHECK(pref_service_); - for (std::set<std::wstring>::const_iterator it = + for (std::set<std::string>::const_iterator it = model_associator_->synced_preferences().begin(); it != model_associator_->synced_preferences().end(); ++it) { pref_service_->RemovePrefObserver((*it).c_str(), this); diff --git a/chrome/browser/sync/glue/preference_change_processor.h b/chrome/browser/sync/glue/preference_change_processor.h index df23227..ae02708 100644 --- a/chrome/browser/sync/glue/preference_change_processor.h +++ b/chrome/browser/sync/glue/preference_change_processor.h @@ -47,7 +47,7 @@ class PreferenceChangeProcessor : public ChangeProcessor, virtual void StopImpl(); private: - Value* ReadPreference(sync_api::ReadNode* node, std::wstring* name); + Value* ReadPreference(sync_api::ReadNode* node, std::string* name); void StartObserving(); void StopObserving(); diff --git a/chrome/browser/sync/glue/preference_model_associator.cc b/chrome/browser/sync/glue/preference_model_associator.cc index 5dad397..013696b 100644 --- a/chrome/browser/sync/glue/preference_model_associator.cc +++ b/chrome/browser/sync/glue/preference_model_associator.cc @@ -64,11 +64,11 @@ bool PreferenceModelAssociator::AssociateModels() { } base::JSONReader reader; - for (std::set<std::wstring>::iterator it = synced_preferences_.begin(); + for (std::set<std::string>::iterator it = synced_preferences_.begin(); it != synced_preferences_.end(); ++it) { - std::string tag = WideToUTF8(*it); + const std::string& tag = *it; const PrefService::Preference* pref = - pref_service->FindPreference((*it).c_str()); + pref_service->FindPreference(tag.c_str()); DCHECK(pref); sync_api::WriteNode node(&trans); @@ -81,7 +81,7 @@ bool PreferenceModelAssociator::AssociateModels() { if (pref->IsUserModifiable()) { scoped_ptr<Value> value( reader.JsonToValue(preference.value(), false, false)); - std::wstring pref_name = UTF8ToWide(preference.name()); + std::string pref_name = preference.name(); if (!value.get()) { LOG(ERROR) << "Failed to deserialize preference value: " << reader.GetErrorMessage(); @@ -156,7 +156,7 @@ bool PreferenceModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { } int64 PreferenceModelAssociator::GetSyncIdFromChromeId( - const std::wstring preference_name) { + const std::string preference_name) { PreferenceNameToSyncIdMap::const_iterator iter = id_map_.find(preference_name); return iter == id_map_.end() ? sync_api::kInvalidId : iter->second; @@ -195,14 +195,15 @@ bool PreferenceModelAssociator::GetSyncIdForTaggedNode(const std::string& tag, Value* PreferenceModelAssociator::MergePreference( const PrefService::Preference& local_pref, const Value& server_value) { - if (local_pref.name() == prefs::kURLsToRestoreOnStartup || - local_pref.name() == prefs::kDesktopNotificationAllowedOrigins || - local_pref.name() == prefs::kDesktopNotificationDeniedOrigins) { + const std::string& name(local_pref.name()); + if (name == prefs::kURLsToRestoreOnStartup || + name == prefs::kDesktopNotificationAllowedOrigins || + name == prefs::kDesktopNotificationDeniedOrigins) { return MergeListValues(*local_pref.GetValue(), server_value); } - if (local_pref.name() == prefs::kContentSettingsPatterns || - local_pref.name() == prefs::kGeolocationContentSettings) { + if (name == prefs::kContentSettingsPatterns || + name == prefs::kGeolocationContentSettings) { return MergeDictionaryValues(*local_pref.GetValue(), server_value); } @@ -211,7 +212,7 @@ Value* PreferenceModelAssociator::MergePreference( } bool PreferenceModelAssociator::WritePreferenceToNode( - const std::wstring& name, + const std::string& name, const Value& value, sync_api::WriteNode* node) { std::string serialized; @@ -222,10 +223,11 @@ bool PreferenceModelAssociator::WritePreferenceToNode( } sync_pb::PreferenceSpecifics preference; - preference.set_name(WideToUTF8(name)); + preference.set_name(name); preference.set_value(serialized); node->SetPreferenceSpecifics(preference); - node->SetTitle(name); + // TODO(viettrungluu): eliminate conversion (it's temporary) + node->SetTitle(UTF8ToWide(name)); return true; } @@ -290,7 +292,7 @@ Value* PreferenceModelAssociator::MergeDictionaryValues( } void PreferenceModelAssociator::AfterUpdateOperations( - const std::wstring& pref_name) { + const std::string& pref_name) { // The bookmark bar visibility preference requires a special // notification to update the UI. if (0 == pref_name.compare(prefs::kShowBookmarkBar)) { diff --git a/chrome/browser/sync/glue/preference_model_associator.h b/chrome/browser/sync/glue/preference_model_associator.h index ca170ac..fd2915c 100644 --- a/chrome/browser/sync/glue/preference_model_associator.h +++ b/chrome/browser/sync/glue/preference_model_associator.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. @@ -33,7 +33,7 @@ static const char kPreferencesTag[] = "google_chrome_preferences"; // * Algorithm to associate preferences model and sync model. class PreferenceModelAssociator : public PerDataTypeAssociatorInterface<PrefService::Preference, - std::wstring> { + std::string> { public: static syncable::ModelType model_type() { return syncable::PREFERENCES; } explicit PreferenceModelAssociator(ProfileSyncService* sync_service); @@ -42,7 +42,7 @@ class PreferenceModelAssociator // Returns the list of preference names that should be monitored for // changes. Only preferences that are registered will be in this // list. - const std::set<std::wstring>& synced_preferences() { + const std::set<std::string>& synced_preferences() { return synced_preferences_; } @@ -70,14 +70,14 @@ class PreferenceModelAssociator } // Not implemented. - virtual bool InitSyncNodeFromChromeId(std::wstring node_id, + virtual bool InitSyncNodeFromChromeId(std::string node_id, sync_api::BaseNode* sync_node) { return false; } // Returns the sync id for the given preference name, or sync_api::kInvalidId // if the preference name is not associated to any sync id. - virtual int64 GetSyncIdFromChromeId(std::wstring node_id); + virtual int64 GetSyncIdFromChromeId(std::string node_id); // Associates the given preference name with the given sync id. virtual void Associate(const PrefService::Preference* node, int64 sync_id); @@ -100,28 +100,28 @@ class PreferenceModelAssociator // Writes the value of pref into the specified node. Returns true // upon success. - static bool WritePreferenceToNode(const std::wstring& name, + static bool WritePreferenceToNode(const std::string& name, const Value& value, sync_api::WriteNode* node); // Perform any additional operations that need to happen after a preference // has been updated. - void AfterUpdateOperations(const std::wstring& pref_name); + void AfterUpdateOperations(const std::string& pref_name); protected: // Returns sync service instance. ProfileSyncService* sync_service() { return sync_service_; } private: - typedef std::map<std::wstring, int64> PreferenceNameToSyncIdMap; - typedef std::map<int64, std::wstring> SyncIdToPreferenceNameMap; + typedef std::map<std::string, int64> PreferenceNameToSyncIdMap; + typedef std::map<int64, std::string> SyncIdToPreferenceNameMap; static Value* MergeListValues(const Value& from_value, const Value& to_value); static Value* MergeDictionaryValues(const Value& from_value, const Value& to_value); ProfileSyncService* sync_service_; - std::set<std::wstring> synced_preferences_; + std::set<std::string> synced_preferences_; int64 preferences_node_id_; PreferenceNameToSyncIdMap id_map_; diff --git a/chrome/browser/sync/glue/preference_model_associator_unittest.cc b/chrome/browser/sync/glue/preference_model_associator_unittest.cc index 032f0ea..2939db4 100644 --- a/chrome/browser/sync/glue/preference_model_associator_unittest.cc +++ b/chrome/browser/sync/glue/preference_model_associator_unittest.cc @@ -18,8 +18,8 @@ class AbstractPreferenceMergeTest : public testing::Test { } void SetContentPattern(DictionaryValue* patterns_dict, - const std::wstring& expression, - const std::wstring& content_type, + const std::string& expression, + const std::string& content_type, int setting) { DictionaryValue* expression_dict; bool found = @@ -34,12 +34,12 @@ class AbstractPreferenceMergeTest : public testing::Test { Value::CreateIntegerValue(setting)); } - void SetPrefToNull(const std::wstring& pref_name) { + void SetPrefToNull(const std::string& pref_name) { scoped_ptr<Value> null_value(Value::CreateNullValue()); pref_service_->Set(pref_name.c_str(), *null_value); } - void SetPrefToEmpty(const std::wstring& pref_name) { + void SetPrefToEmpty(const std::string& pref_name) { scoped_ptr<Value> empty_value; const PrefService::Preference* pref = pref_service_->FindPreference(pref_name.c_str()); @@ -198,11 +198,11 @@ TEST_F(ListPreferenceMergeTest, Equals) { class DictionaryPreferenceMergeTest : public AbstractPreferenceMergeTest { protected: DictionaryPreferenceMergeTest() : - expression0_(L"expression0"), - expression1_(L"expression1"), - expression2_(L"expression2"), - content_type0_(L"content_type0"), - content_type1_(L"content_type1") {} + expression0_("expression0"), + expression1_("expression1"), + expression2_("expression2"), + content_type0_("content_type0"), + content_type1_("content_type1") {} virtual void SetUp() { AbstractPreferenceMergeTest::SetUp(); @@ -211,11 +211,11 @@ class DictionaryPreferenceMergeTest : public AbstractPreferenceMergeTest { SetContentPattern(&server_patterns_, expression1_, content_type0_, 1); } - std::wstring expression0_; - std::wstring expression1_; - std::wstring expression2_; - std::wstring content_type0_; - std::wstring content_type1_; + std::string expression0_; + std::string expression1_; + std::string expression2_; + std::string content_type0_; + std::string content_type1_; DictionaryValue server_patterns_; }; @@ -340,11 +340,11 @@ TEST_F(DictionaryPreferenceMergeTest, ConflictButServerWins) { class IndividualPreferenceMergeTest : public AbstractPreferenceMergeTest { protected: IndividualPreferenceMergeTest() : - url0_(L"http://example.com/server0"), - url1_(L"http://example.com/server1"), - expression0_(L"expression0"), - expression1_(L"expression1"), - content_type0_(L"content_type0") {} + url0_("http://example.com/server0"), + url1_("http://example.com/server1"), + expression0_("expression0"), + expression1_("expression1"), + content_type0_("content_type0") {} virtual void SetUp() { AbstractPreferenceMergeTest::SetUp(); @@ -352,7 +352,7 @@ class IndividualPreferenceMergeTest : public AbstractPreferenceMergeTest { SetContentPattern(&server_patterns_, expression0_, content_type0_, 1); } - bool MergeListPreference(const wchar_t* pref) { + bool MergeListPreference(const char* pref) { ListValue* local_list_value = pref_service_->GetMutableList(pref); local_list_value->Append(Value::CreateStringValue(url1_)); @@ -366,7 +366,7 @@ class IndividualPreferenceMergeTest : public AbstractPreferenceMergeTest { return merged_value->Equals(&expected); } - bool MergeDictionaryPreference(const wchar_t* pref) { + bool MergeDictionaryPreference(const char* pref) { DictionaryValue* local_dict_value = pref_service_->GetMutableDictionary(pref); SetContentPattern(local_dict_value, expression1_, content_type0_, 1); @@ -381,11 +381,11 @@ class IndividualPreferenceMergeTest : public AbstractPreferenceMergeTest { return merged_value->Equals(&expected); } - std::wstring url0_; - std::wstring url1_; - std::wstring expression0_; - std::wstring expression1_; - std::wstring content_type0_; + std::string url0_; + std::string url1_; + std::string expression0_; + std::string expression1_; + std::string content_type0_; ListValue server_url_list_; DictionaryValue server_patterns_; }; diff --git a/chrome/browser/sync/glue/synchronized_preferences.h b/chrome/browser/sync/glue/synchronized_preferences.h index 263d471..ac09e1d 100644 --- a/chrome/browser/sync/glue/synchronized_preferences.h +++ b/chrome/browser/sync/glue/synchronized_preferences.h @@ -14,7 +14,7 @@ namespace browser_sync { -static const wchar_t* kSynchronizedPreferences[] = { +static const char* kSynchronizedPreferences[] = { // Options dialog: Basics tab. prefs::kRestoreOnStartup, prefs::kURLsToRestoreOnStartup, diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index c6fd726..13e0d42 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -389,7 +389,7 @@ void ProfileSyncService::UpdateLastSyncedTime() { } // static -const wchar_t* ProfileSyncService::GetPrefNameForDataType( +const char* ProfileSyncService::GetPrefNameForDataType( syncable::ModelType data_type) { switch (data_type) { case syncable::BOOKMARKS: @@ -664,7 +664,7 @@ void ProfileSyncService::ChangePreferredDataTypes( syncable::ModelType model_type = syncable::ModelTypeFromInt(i); if (!registered_types.count(model_type)) continue; - const wchar_t* pref_name = GetPrefNameForDataType(model_type); + const char* pref_name = GetPrefNameForDataType(model_type); if (!pref_name) continue; profile_->GetPrefs()->SetBoolean(pref_name, @@ -689,7 +689,7 @@ void ProfileSyncService::GetPreferredDataTypes( syncable::ModelType model_type = syncable::ModelTypeFromInt(i); if (!registered_types.count(model_type)) continue; - const wchar_t* pref_name = GetPrefNameForDataType(model_type); + const char* pref_name = GetPrefNameForDataType(model_type); if (!pref_name) continue; if (profile_->GetPrefs()->GetBoolean(pref_name)) @@ -795,7 +795,7 @@ void ProfileSyncService::Observe(NotificationType type, break; } case NotificationType::PREF_CHANGED: { - std::wstring* pref_name = Details<std::wstring>(details).ptr(); + std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kSyncManaged) { FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); if (*pref_sync_managed_) diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index d3f8e79..9f89a19 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -360,7 +360,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // Sets the last synced time to the current time. void UpdateLastSyncedTime(); - static const wchar_t* GetPrefNameForDataType(syncable::ModelType data_type); + static const char* GetPrefNameForDataType(syncable::ModelType data_type); // Time at which we begin an attempt a GAIA authorization. base::TimeTicks auth_start_time_; diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc index 94ae735..454d56c 100644 --- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc @@ -8,6 +8,7 @@ #include "base/json/json_reader.h" #include "base/stl_util-inl.h" #include "base/task.h" +#include "base/utf_string_conversions.h" // TODO(viettrungluu): remove #include "chrome/browser/sync/abstract_profile_sync_service_test.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/preference_change_processor.h" @@ -33,7 +34,7 @@ using sync_api::SyncManager; using testing::_; using testing::Return; -typedef std::map<const std::wstring, const Value*> PreferenceValues; +typedef std::map<const std::string, const Value*> PreferenceValues; class ProfileSyncServicePreferenceTest : public AbstractProfileSyncServiceTest { @@ -42,7 +43,7 @@ class ProfileSyncServicePreferenceTest : example_url0_("http://example.com/0"), example_url1_("http://example.com/1"), example_url2_("http://example.com/2"), - not_synced_preference_name_(L"nonsense_pref_name"), + not_synced_preference_name_("nonsense_pref_name"), not_synced_preference_default_value_("default"), non_default_charset_value_("foo") {} @@ -92,14 +93,14 @@ class ProfileSyncServicePreferenceTest SyncBackendHost* backend() { return service_->backend_.get(); } - const Value& GetPreferenceValue(const std::wstring& name) { + const Value& GetPreferenceValue(const std::string& name) { const PrefService::Preference* preference = prefs_->FindPreference(name.c_str()); return *preference->GetValue(); } // Caller gets ownership of the returned value. - const Value* GetSyncedValue(const std::wstring& name) { + const Value* GetSyncedValue(const std::string& name) { sync_api::ReadTransaction trans(service_->backend()->GetUserShareHandle()); sync_api::ReadNode node(&trans); @@ -116,7 +117,7 @@ class ProfileSyncServicePreferenceTest return reader.JsonToValue(specifics.value(), false, false); } - int64 SetSyncedValue(const std::wstring& name, const Value& value) { + int64 SetSyncedValue(const std::string& name, const Value& value) { sync_api::WriteTransaction trans(backend()->GetUserShareHandle()); sync_api::ReadNode root(&trans); if (!root.InitByTagLookup(browser_sync::kPreferencesTag)) @@ -128,7 +129,7 @@ class ProfileSyncServicePreferenceTest if (node_id == sync_api::kInvalidId) { if (!node.InitUniqueByCreation(syncable::PREFERENCES, root, - WideToUTF8(name))) { + name)) { return sync_api::kInvalidId; } } else { @@ -142,15 +143,16 @@ class ProfileSyncServicePreferenceTest EXPECT_TRUE(json.Serialize(value)); sync_pb::PreferenceSpecifics preference; - preference.set_name(WideToUTF8(name)); + preference.set_name(name); preference.set_value(serialized); node.SetPreferenceSpecifics(preference); - node.SetTitle(name); + // TODO(viettrungluu): remove conversion and header + node.SetTitle(UTF8ToWide(name)); return node.GetId(); } - SyncManager::ChangeRecord* MakeChangeRecord(const std::wstring& name, + SyncManager::ChangeRecord* MakeChangeRecord(const std::string& name, SyncManager::ChangeRecord) { int64 node_id = model_associator_->GetSyncIdFromChromeId(name); SyncManager::ChangeRecord* record = new SyncManager::ChangeRecord(); @@ -159,7 +161,7 @@ class ProfileSyncServicePreferenceTest return record; } - bool IsSynced(const std::wstring& pref_name) { + bool IsSynced(const std::string& pref_name) { return model_associator_->synced_preferences().count(pref_name) > 0; } @@ -180,7 +182,7 @@ class ProfileSyncServicePreferenceTest std::string example_url0_; std::string example_url1_; std::string example_url2_; - std::wstring not_synced_preference_name_; + std::string not_synced_preference_name_; std::string not_synced_preference_default_value_; std::string non_default_charset_value_; }; @@ -222,13 +224,13 @@ TEST_F(ProfileSyncServicePreferenceTest, WritePreferenceToNode) { sync_api::WriteTransaction trans(service_->backend()->GetUserShareHandle()); sync_api::WriteNode node(&trans); EXPECT_TRUE(node.InitByClientTagLookup(syncable::PREFERENCES, - WideToUTF8(prefs::kHomePage))); + prefs::kHomePage)); EXPECT_TRUE(PreferenceModelAssociator::WritePreferenceToNode( pref->name(), *pref->GetValue(), &node)); - EXPECT_EQ(std::wstring(prefs::kHomePage), node.GetTitle()); + EXPECT_EQ(UTF8ToWide(prefs::kHomePage), node.GetTitle()); const sync_pb::PreferenceSpecifics& specifics(node.GetPreferenceSpecifics()); - EXPECT_EQ(WideToUTF8(prefs::kHomePage), specifics.name()); + EXPECT_EQ(std::string(prefs::kHomePage), specifics.name()); base::JSONReader reader; scoped_ptr<Value> value(reader.JsonToValue(specifics.value(), false, false)); @@ -398,7 +400,7 @@ TEST_F(ProfileSyncServicePreferenceTest, UpdatedSyncNodeUnknownPreference) { ASSERT_TRUE(task.success()); scoped_ptr<Value> expected(Value::CreateStringValue(example_url0_)); - int64 node_id = SetSyncedValue(L"unknown preference", *expected); + int64 node_id = SetSyncedValue("unknown preference", *expected); ASSERT_NE(node_id, sync_api::kInvalidId); scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord); record->action = SyncManager::ChangeRecord::ACTION_ADD; @@ -415,7 +417,7 @@ TEST_F(ProfileSyncServicePreferenceTest, UpdatedSyncNodeUnknownPreference) { TEST_F(ProfileSyncServicePreferenceTest, ManagedPreferences) { // Make the homepage preference managed. scoped_ptr<Value> managed_value( - Value::CreateStringValue(L"http://example.com")); + Value::CreateStringValue("http://example.com")); prefs_->SetManagedPref(prefs::kHomePage, managed_value->DeepCopy()); CreateRootTask task(this, syncable::PREFERENCES); @@ -424,13 +426,13 @@ TEST_F(ProfileSyncServicePreferenceTest, ManagedPreferences) { // Changing the homepage preference should not sync anything. scoped_ptr<Value> user_value( - Value::CreateStringValue(L"http://chromium..com")); + Value::CreateStringValue("http://chromium..com")); prefs_->SetUserPref(prefs::kHomePage, user_value->DeepCopy()); EXPECT_EQ(NULL, GetSyncedValue(prefs::kHomePage)); // An incoming sync transaction shouldn't change the user value. scoped_ptr<Value> sync_value( - Value::CreateStringValue(L"http://crbug.com")); + Value::CreateStringValue("http://crbug.com")); int64 node_id = SetSyncedValue(prefs::kHomePage, *sync_value); ASSERT_NE(node_id, sync_api::kInvalidId); scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord); @@ -440,6 +442,8 @@ TEST_F(ProfileSyncServicePreferenceTest, ManagedPreferences) { sync_api::WriteTransaction trans(backend()->GetUserShareHandle()); change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1); } - EXPECT_TRUE(managed_value->Equals(prefs_->GetManagedPref(prefs::kHomePage))); - EXPECT_TRUE(user_value->Equals(prefs_->GetUserPref(prefs::kHomePage))); + EXPECT_TRUE(managed_value->Equals( + prefs_->GetManagedPref(prefs::kHomePage))); + EXPECT_TRUE(user_value->Equals( + prefs_->GetUserPref(prefs::kHomePage))); } diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 3e43c8f..42da773 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -162,7 +162,7 @@ const float kMaxHeightFactor = 0.6; const int kJavascriptMessageExpectedDelay = 1000; // The list of prefs we want to observe. -const wchar_t* kPrefsToObserve[] = { +const char* kPrefsToObserve[] = { prefs::kAlternateErrorPagesEnabled, prefs::kWebKitJavaEnabled, prefs::kWebKitJavascriptEnabled, @@ -3072,12 +3072,12 @@ void TabContents::Observe(NotificationType type, break; } case NotificationType::PREF_CHANGED: { - std::wstring* pref_name_in = Details<std::wstring>(details).ptr(); + std::string* pref_name_in = Details<std::string>(details).ptr(); DCHECK(Source<PrefService>(source).ptr() == profile()->GetPrefs()); if (*pref_name_in == prefs::kAlternateErrorPagesEnabled) { UpdateAlternateErrorPageURL(); } else if (*pref_name_in == prefs::kDefaultCharset || - StartsWithASCII(WideToUTF8(*pref_name_in), "webkit.webprefs.", true) + StartsWithASCII(*pref_name_in, "webkit.webprefs.", true) ) { UpdateWebPreferences(); } else { diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index b34a81d..52a4873 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -208,8 +208,8 @@ class TabContentsTest : public RenderViewHostTestHarness { Value::CreateBooleanValue(true)); pref_services->SetUserPref(prefs::kWebKitStandardFontIsSerif, Value::CreateBooleanValue(true)); - pref_services->SetUserPref(L"webkit.webprefs.foo", - Value::CreateStringValue(L"bar")); + pref_services->SetUserPref("webkit.webprefs.foo", + Value::CreateStringValue("bar")); RenderViewHostTestHarness::SetUp(); } 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); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index d8ab622..3034a38 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -1321,7 +1321,7 @@ void BrowserView::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED && - *Details<std::wstring>(details).ptr() == prefs::kShowBookmarkBar) { + *Details<std::string>(details).ptr() == prefs::kShowBookmarkBar) { if (MaybeShowBookmarkBar(browser_->GetSelectedTabContents())) Layout(); } else { @@ -1503,7 +1503,7 @@ bool BrowserView::ExecuteWindowsCommand(int command_id) { } std::wstring BrowserView::GetWindowName() const { - return browser_->GetWindowPlacementKey(); + return UTF8ToWide(browser_->GetWindowPlacementKey()); } void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds, diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc index e40a704..ad9c6c3 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -9,6 +9,7 @@ #include "app/l10n_util.h" #include "base/stl_util-inl.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/search_engines/template_url.h" @@ -129,7 +130,7 @@ std::wstring KeywordEditorView::GetWindowTitle() const { } std::wstring KeywordEditorView::GetWindowName() const { - return prefs::kKeywordEditorWindowPlacement; + return UTF8ToWide(prefs::kKeywordEditorWindowPlacement); } int KeywordEditorView::GetDialogButtons() const { diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 3dc31e5..f6869db 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -437,7 +437,7 @@ class PrivacySection : public AdvancedSection, protected: // OptionsPageView overrides: virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: // Controls for this section: @@ -644,7 +644,7 @@ void PrivacySection::InitControlLayout() { #endif } -void PrivacySection::NotifyPrefChanged(const std::wstring* pref_name) { +void PrivacySection::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kAlternateErrorPagesEnabled) { enable_link_doctor_checkbox_->SetChecked( alternate_error_pages_.GetValue()); @@ -787,7 +787,7 @@ class SecuritySection : public AdvancedSection, protected: // OptionsPageView overrides: virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: // Controls for this section: @@ -883,7 +883,7 @@ void SecuritySection::InitControlLayout() { } // This method is called with a null pref_name when the dialog is initialized. -void SecuritySection::NotifyPrefChanged(const std::wstring* pref_name) { +void SecuritySection::NotifyPrefChanged(const std::string* pref_name) { // These SSL options are system settings and stored in the OS. if (!pref_name) { net::SSLConfig config; @@ -947,7 +947,7 @@ class NetworkSection : public AdvancedSection, protected: // OptionsPageView overrides: virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: // Controls for this section: @@ -1008,7 +1008,7 @@ void NetworkSection::InitControlLayout() { NotifyPrefChanged(NULL); } -void NetworkSection::NotifyPrefChanged(const std::wstring* pref_name) { +void NetworkSection::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || proxy_prefs_->IsObserved(*pref_name)) { change_proxies_button_->SetEnabled(!proxy_prefs_->IsManaged()); } @@ -1040,7 +1040,7 @@ class DownloadSection : public AdvancedSection, protected: // OptionsPageView overrides. virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: // Controls for this section. @@ -1189,7 +1189,7 @@ void DownloadSection::InitControlLayout() { this); } -void DownloadSection::NotifyPrefChanged(const std::wstring* pref_name) { +void DownloadSection::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) UpdateDownloadDirectoryDisplay(); @@ -1226,7 +1226,7 @@ class TranslateSection : public AdvancedSection, protected: // OptionsPageView overrides: virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: // Control for this section: @@ -1272,7 +1272,7 @@ void TranslateSection::InitControlLayout() { enable_translate_.Init(prefs::kEnableTranslate, profile()->GetPrefs(), this); } -void TranslateSection::NotifyPrefChanged(const std::wstring* pref_name) { +void TranslateSection::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kEnableTranslate) enable_translate_checkbox_->SetChecked(enable_translate_.GetValue()); } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index 0b14992..6775232 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -228,7 +228,7 @@ void ContentPageView::InitControlLayout() { show_passwords_button_->SetEnabled(enablePasswordManagerElements); } -void ContentPageView::NotifyPrefChanged(const std::wstring* pref_name) { +void ContentPageView::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kPasswordManagerEnabled) { if (ask_to_save_passwords_.GetValue()) { passwords_asktosave_radio_->SetChecked(true); diff --git a/chrome/browser/views/options/content_page_view.h b/chrome/browser/views/options/content_page_view.h index 5dfe969..06f0a3f 100644 --- a/chrome/browser/views/options/content_page_view.h +++ b/chrome/browser/views/options/content_page_view.h @@ -52,7 +52,7 @@ class ContentPageView : public OptionsPageView, protected: // OptionsPageView implementation: virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // views::View overrides: virtual void Layout(); diff --git a/chrome/browser/views/options/cookie_filter_page_view.cc b/chrome/browser/views/options/cookie_filter_page_view.cc index 7aaa7c8..320445c 100644 --- a/chrome/browser/views/options/cookie_filter_page_view.cc +++ b/chrome/browser/views/options/cookie_filter_page_view.cc @@ -83,7 +83,7 @@ void CookieFilterPageView::InitControlLayout() { /////////////////////////////////////////////////////////////////////////////// // CookieFilterPageView, OptionsPageView implementation: -void CookieFilterPageView::NotifyPrefChanged(const std::wstring* pref_name) { +void CookieFilterPageView::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kClearSiteDataOnExit) { clear_on_close_check_->SetChecked( clear_site_data_on_exit_.GetValue()); diff --git a/chrome/browser/views/options/cookie_filter_page_view.h b/chrome/browser/views/options/cookie_filter_page_view.h index 61c138a..688b8d3 100644 --- a/chrome/browser/views/options/cookie_filter_page_view.h +++ b/chrome/browser/views/options/cookie_filter_page_view.h @@ -28,7 +28,7 @@ class CookieFilterPageView : public ContentFilterPageView, virtual void InitControlLayout(); // OptionsPageView implementation: - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // views::ButtonListener implementation: virtual void ButtonPressed(views::Button* sender, const views::Event& event); diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index 4b995cf..7ad53e3 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -294,7 +294,7 @@ void FontsPageView::InitControlLayout() { layout->AddView(encoding_contents_); } -void FontsPageView::NotifyPrefChanged(const std::wstring* pref_name) { +void FontsPageView::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kWebKitFixedFontFamily) { fixed_width_font_size_pixel_ = fixed_width_size_.GetValue(); fixed_width_font_display_view_->SetFontType( diff --git a/chrome/browser/views/options/fonts_page_view.h b/chrome/browser/views/options/fonts_page_view.h index c9813b7..283ec7b 100644 --- a/chrome/browser/views/options/fonts_page_view.h +++ b/chrome/browser/views/options/fonts_page_view.h @@ -55,7 +55,7 @@ class FontsPageView : public OptionsPageView, protected: // OptionsPageView implementation: virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); private: enum FontTypeBeingChanged { diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index afe4ae7..1c43f0e 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -348,7 +348,7 @@ void GeneralPageView::InitControlLayout() { show_home_button_.Init(prefs::kShowHomeButton, profile()->GetPrefs(), this); } -void GeneralPageView::NotifyPrefChanged(const std::wstring* pref_name) { +void GeneralPageView::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kRestoreOnStartup) { PrefService* prefs = profile()->GetPrefs(); const SessionStartupPref startup_pref = diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h index 2b05c70a..1c6216d 100644 --- a/chrome/browser/views/options/general_page_view.h +++ b/chrome/browser/views/options/general_page_view.h @@ -60,7 +60,7 @@ class GeneralPageView : public OptionsPageView, // OptionsPageView implementation: virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); virtual void HighlightGroup(OptionsGroup highlight_group); private: diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index 0a2bc589..8a2df06 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -14,7 +14,7 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/string_util.h" -#include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/language_combobox_model.h" #include "chrome/browser/language_order_table_model.h" @@ -398,14 +398,14 @@ void LanguagesPageView::InitControlLayout() { profile()->GetPrefs(), this); } -void LanguagesPageView::NotifyPrefChanged(const std::wstring* pref_name) { +void LanguagesPageView::NotifyPrefChanged(const std::string* pref_name) { if (!pref_name || *pref_name == prefs::kAcceptLanguages) { language_order_table_model_->SetAcceptLanguagesString( accept_languages_.GetValue()); } if (!pref_name || *pref_name == prefs::kApplicationLocale) { int index = ui_language_model_->GetSelectedLanguageIndex( - prefs::kApplicationLocale); + UTF8ToWide(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::wstring* pref_name) { } if (!pref_name || *pref_name == prefs::kSpellCheckDictionary) { int index = dictionary_language_model_->GetSelectedLanguageIndex( - prefs::kSpellCheckDictionary); + UTF8ToWide(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::wstring* pref_name) { dictionary_language_.SetValue( SpellCheckCommon::GetLanguageFromLanguageRegion(lang_region)); index = dictionary_language_model_->GetSelectedLanguageIndex( - prefs::kSpellCheckDictionary); + UTF8ToWide(prefs::kSpellCheckDictionary)); } change_dictionary_language_combobox_->SetSelectedItem(index); diff --git a/chrome/browser/views/options/languages_page_view.h b/chrome/browser/views/options/languages_page_view.h index d4ab082..e5ab3e6 100644 --- a/chrome/browser/views/options/languages_page_view.h +++ b/chrome/browser/views/options/languages_page_view.h @@ -52,7 +52,7 @@ class LanguagesPageView : public OptionsPageView, protected: // OptionsPageView implementation: virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::wstring* pref_name); + virtual void NotifyPrefChanged(const std::string* pref_name); // views::Combobox::Listener implementation: virtual void ItemChanged(views::Combobox* sender, diff --git a/chrome/browser/views/page_info_window_view.cc b/chrome/browser/views/page_info_window_view.cc index ea573d8..b962acf 100644 --- a/chrome/browser/views/page_info_window_view.cc +++ b/chrome/browser/views/page_info_window_view.cc @@ -240,7 +240,7 @@ std::wstring PageInfoWindowView::GetWindowTitle() const { } std::wstring PageInfoWindowView::GetWindowName() const { - return prefs::kPageInfoWindowPlacement; + return UTF8ToWide(prefs::kPageInfoWindowPlacement); } views::View* PageInfoWindowView::GetContentsView() { diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/views/task_manager_view.cc index 4739be6..b83c42b 100644 --- a/chrome/browser/views/task_manager_view.cc +++ b/chrome/browser/views/task_manager_view.cc @@ -553,7 +553,7 @@ std::wstring TaskManagerView::GetWindowTitle() const { } std::wstring TaskManagerView::GetWindowName() const { - return prefs::kTaskManagerWindowPlacement; + return UTF8ToWide(prefs::kTaskManagerWindowPlacement); } int TaskManagerView::GetDialogButtons() const { diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index bfd9e3b..929ea6e 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -333,7 +333,7 @@ void ToolbarView::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::PREF_CHANGED) { - std::wstring* pref_name = Details<std::wstring>(details).ptr(); + std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kShowHomeButton) { Layout(); SchedulePaint(); diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index dea6f74..c79527c 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -373,7 +373,7 @@ bool CreateShortcutTask::CreateShortcut() { // Generates app id from web app url and profile path. std::wstring app_id = ShellIntegration::GetAppId( - web_app::GenerateApplicationNameFromURL(shortcut_info_.url), + UTF8ToWide(web_app::GenerateApplicationNameFromURL(shortcut_info_.url)), profile_path_); FilePath shortcut_to_pin; @@ -630,7 +630,7 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { if (!shortcut_files_.empty()) { // Generates app id from web app url and profile path. std::wstring app_id = ShellIntegration::GetAppId( - web_app::GenerateApplicationNameFromURL(shortcut_info_.url), + UTF8ToWide(web_app::GenerateApplicationNameFromURL(shortcut_info_.url)), profile_path_); // Sanitize description @@ -681,12 +681,12 @@ DISABLE_RUNNABLE_METHOD_REFCOUNT(UpdateShortcutWorker); namespace web_app { -std::wstring GenerateApplicationNameFromURL(const GURL& url) { +std::string GenerateApplicationNameFromURL(const GURL& url) { std::string t; t.append(url.host()); t.append("_"); t.append(url.path()); - return UTF8ToWide(t); + return t; } void CreateShortcut( diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index ddacac8..c451e85 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -22,7 +22,7 @@ namespace web_app { // Compute a deterministic name based on the URL. We use this pseudo name // as a key to store window location per application URLs in Browser and // as app id for BrowserWindow, shortcut and jump list. -std::wstring GenerateApplicationNameFromURL(const GURL& url); +std::string GenerateApplicationNameFromURL(const GURL& url); // Callback after user dismisses CreateShortcutView. "true" indicates // shortcut is created successfully. Otherwise, it is false. diff --git a/chrome/browser/window_sizer.cc b/chrome/browser/window_sizer.cc index 74e1af4..724d721 100644 --- a/chrome/browser/window_sizer.cc +++ b/chrome/browser/window_sizer.cc @@ -16,7 +16,7 @@ // and persistent state from the browser window and the user's profile. class DefaultStateProvider : public WindowSizer::StateProvider { public: - explicit DefaultStateProvider(const std::wstring& app_name, Browser* browser) + explicit DefaultStateProvider(const std::string& app_name, Browser* browser) : app_name_(app_name), browser_(browser) { } @@ -27,9 +27,9 @@ class DefaultStateProvider : public WindowSizer::StateProvider { gfx::Rect* work_area) const { DCHECK(bounds && maximized); - std::wstring key(prefs::kBrowserWindowPlacement); + std::string key(prefs::kBrowserWindowPlacement); if (!app_name_.empty()) { - key.append(L"_"); + key.append("_"); key.append(app_name_); } @@ -41,11 +41,11 @@ class DefaultStateProvider : public WindowSizer::StateProvider { int top = 0, left = 0, bottom = 0, right = 0; bool has_prefs = wp_pref && - wp_pref->GetInteger(L"top", &top) && - wp_pref->GetInteger(L"left", &left) && - wp_pref->GetInteger(L"bottom", &bottom) && - wp_pref->GetInteger(L"right", &right) && - wp_pref->GetBoolean(L"maximized", maximized); + wp_pref->GetInteger("top", &top) && + wp_pref->GetInteger("left", &left) && + wp_pref->GetInteger("bottom", &bottom) && + wp_pref->GetInteger("right", &right) && + wp_pref->GetBoolean("maximized", maximized); bounds->SetRect(left, top, std::max(0, right - left), std::max(0, bottom - top)); @@ -54,10 +54,10 @@ class DefaultStateProvider : public WindowSizer::StateProvider { int work_area_bottom = 0; int work_area_right = 0; if (wp_pref) { - wp_pref->GetInteger(L"work_area_top", &work_area_top); - wp_pref->GetInteger(L"work_area_left", &work_area_left); - wp_pref->GetInteger(L"work_area_bottom", &work_area_bottom); - wp_pref->GetInteger(L"work_area_right", &work_area_right); + wp_pref->GetInteger("work_area_top", &work_area_top); + wp_pref->GetInteger("work_area_left", &work_area_left); + wp_pref->GetInteger("work_area_bottom", &work_area_bottom); + wp_pref->GetInteger("work_area_right", &work_area_right); } work_area->SetRect(work_area_left, work_area_top, std::max(0, work_area_right - work_area_left), @@ -99,7 +99,7 @@ class DefaultStateProvider : public WindowSizer::StateProvider { } private: - std::wstring app_name_; + std::string app_name_; // If set, is used as the reference browser for GetLastActiveWindowState. Browser* browser_; @@ -123,7 +123,7 @@ WindowSizer::~WindowSizer() { } // static -void WindowSizer::GetBrowserWindowBounds(const std::wstring& app_name, +void WindowSizer::GetBrowserWindowBounds(const std::string& app_name, const gfx::Rect& specified_bounds, Browser* browser, gfx::Rect* window_bounds, @@ -136,7 +136,7 @@ void WindowSizer::GetBrowserWindowBounds(const std::wstring& app_name, /////////////////////////////////////////////////////////////////////////////// // WindowSizer, private: -WindowSizer::WindowSizer(const std::wstring& app_name) { +WindowSizer::WindowSizer(const std::string& app_name) { Init(new DefaultStateProvider(app_name, NULL), CreateDefaultMonitorInfoProvider()); } diff --git a/chrome/browser/window_sizer.h b/chrome/browser/window_sizer.h index d1928c6..16958e2 100644 --- a/chrome/browser/window_sizer.h +++ b/chrome/browser/window_sizer.h @@ -118,7 +118,7 @@ class WindowSizer { // |window_bounds| is calculated by calling GetLastActiveWindowState(). To // explicitly specify a particular window to base the bounds on, pass in a // non-NULL value for |browser|. - static void GetBrowserWindowBounds(const std::wstring& app_name, + static void GetBrowserWindowBounds(const std::string& app_name, const gfx::Rect& specified_bounds, Browser* browser, gfx::Rect* window_bounds, @@ -135,7 +135,7 @@ class WindowSizer { // The edge of the screen to check for out-of-bounds. enum Edge { TOP, LEFT, BOTTOM, RIGHT }; - explicit WindowSizer(const std::wstring& app_name); + explicit WindowSizer(const std::string& app_name); void Init(StateProvider* state_provider, MonitorInfoProvider* monitor_info_provider); diff --git a/chrome/common/json_pref_store_unittest.cc b/chrome/common/json_pref_store_unittest.cc index 8f05fd8..e38aba2 100644 --- a/chrome/common/json_pref_store_unittest.cc +++ b/chrome/common/json_pref_store_unittest.cc @@ -99,17 +99,17 @@ TEST_F(JsonPrefStoreTest, Basic) { // } // } - const wchar_t kNewWindowsInTabs[] = L"tabs.new_windows_in_tabs"; - const wchar_t kMaxTabs[] = L"tabs.max_tabs"; - const wchar_t kLongIntPref[] = L"long_int.pref"; + const char kNewWindowsInTabs[] = "tabs.new_windows_in_tabs"; + const char kMaxTabs[] = "tabs.max_tabs"; + const char kLongIntPref[] = "long_int.pref"; - std::wstring cnn(L"http://www.cnn.com"); + std::string cnn("http://www.cnn.com"); - std::wstring string_value; + std::string string_value; EXPECT_TRUE(prefs->GetString(prefs::kHomePage, &string_value)); EXPECT_EQ(cnn, string_value); - const wchar_t kSomeDirectory[] = L"some_directory"; + const char kSomeDirectory[] = "some_directory"; FilePath::StringType path; EXPECT_TRUE(prefs->GetString(kSomeDirectory, &path)); @@ -135,11 +135,10 @@ TEST_F(JsonPrefStoreTest, Basic) { EXPECT_TRUE(prefs->GetInteger(kMaxTabs, &integer)); EXPECT_EQ(10, integer); - prefs->SetString(kLongIntPref, - UTF8ToWide(base::Int64ToString(214748364842LL))); + prefs->SetString(kLongIntPref, base::Int64ToString(214748364842LL)); EXPECT_TRUE(prefs->GetString(kLongIntPref, &string_value)); int64 value; - base::StringToInt64(WideToUTF8(string_value), &value); + base::StringToInt64(string_value, &value); EXPECT_EQ(214748364842LL, value); // Serialize and compare to expected output. diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index a30fb27..ed8b2b2 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -683,7 +683,7 @@ class NotificationType { WEB_APP_INSTALL_CHANGED, // This is sent to a pref observer when a pref is changed. The source is the - // PrefService and the details a std::wstring of the changed path. + // PrefService and the details a std::string of the changed path. PREF_CHANGED, // Sent when a default request context has been created, so calling diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 5759678..ad8433a 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -10,15 +10,15 @@ namespace prefs { // These are attached to the user profile // A boolean specifying whether the New Tab page is the home page or not. -const wchar_t kHomePageIsNewTabPage[] = L"homepage_is_newtabpage"; +const char kHomePageIsNewTabPage[] = "homepage_is_newtabpage"; // This is the URL of the page to load when opening new tabs. -const wchar_t kHomePage[] = L"homepage"; +const char kHomePage[] = "homepage"; // Used to determine if the last session exited cleanly. Set to false when // first opened, and to true when closing. On startup if the value is false, // it means the profile didn't exit cleanly. -const wchar_t kSessionExitedCleanly[] = L"profile.exited_cleanly"; +const char kSessionExitedCleanly[] = "profile.exited_cleanly"; // An integer pref. Holds one of several values: // 0: (or empty) don't do anything special on startup. @@ -27,32 +27,31 @@ const wchar_t kSessionExitedCleanly[] = L"profile.exited_cleanly"; // no longer used, but saved to avoid conflict with old preferences. // 3: unused, previously indicated the user wants to restore a saved session. // 4: restore the URLs defined in kURLsToRestoreOnStartup. -const wchar_t kRestoreOnStartup[] = L"session.restore_on_startup"; +const char kRestoreOnStartup[] = "session.restore_on_startup"; // The URLs to restore on startup or when the home button is pressed. The URLs // are only restored on startup if kRestoreOnStartup is 4. -const wchar_t kURLsToRestoreOnStartup[] = - L"session.urls_to_restore_on_startup"; +const char kURLsToRestoreOnStartup[] = "session.urls_to_restore_on_startup"; // The application locale. -const wchar_t kApplicationLocale[] = L"intl.app_locale"; +const char kApplicationLocale[] = "intl.app_locale"; // The default character encoding to assume for a web page in the // absence of MIME charset specification -const wchar_t kDefaultCharset[] = L"intl.charset_default"; +const char kDefaultCharset[] = "intl.charset_default"; // The value to use for Accept-Languages HTTP header when making an HTTP // request. -const wchar_t kAcceptLanguages[] = L"intl.accept_languages"; +const char kAcceptLanguages[] = "intl.accept_languages"; // The value to use for showing locale-dependent encoding list for different // locale, it's initialized from the corresponding string resource that is // stored in non-translatable part of the resource bundle. -const wchar_t kStaticEncodings[] = L"intl.static_encodings"; +const char kStaticEncodings[] = "intl.static_encodings"; // OBSOLETE. The list of hostnames for which we whitelist popups (rather than // blocking). -const wchar_t kPopupWhitelistedHosts[] = L"profile.popup_whitelisted_sites"; +const char kPopupWhitelistedHosts[] = "profile.popup_whitelisted_sites"; // WebKit preferences. // A boolean flag to indicate whether WebKit standard font family is @@ -60,62 +59,56 @@ const wchar_t kPopupWhitelistedHosts[] = L"profile.popup_whitelisted_sites"; // Instead, we use this pref to map either serif or sans_serif to WebKit // standard font family. At the moment, we don't have a UI for this // flag, either. -const wchar_t kWebKitStandardFontIsSerif[] = - L"webkit.webprefs.standard_font_is_serif"; -const wchar_t kWebKitFixedFontFamily[] = L"webkit.webprefs.fixed_font_family"; -const wchar_t kWebKitSerifFontFamily[] = L"webkit.webprefs.serif_font_family"; -const wchar_t kWebKitSansSerifFontFamily[] = - L"webkit.webprefs.sansserif_font_family"; -const wchar_t kWebKitCursiveFontFamily[] = - L"webkit.webprefs.cursive_font_family"; -const wchar_t kWebKitFantasyFontFamily[] = - L"webkit.webprefs.fantasy_font_family"; -const wchar_t kWebKitDefaultFontSize[] = L"webkit.webprefs.default_font_size"; -const wchar_t kWebKitDefaultFixedFontSize[] = - L"webkit.webprefs.default_fixed_font_size"; -const wchar_t kWebKitMinimumFontSize[] = L"webkit.webprefs.minimum_font_size"; -const wchar_t kWebKitMinimumLogicalFontSize[] = - L"webkit.webprefs.minimum_logical_font_size"; -const wchar_t kWebKitJavascriptEnabled[] = - L"webkit.webprefs.javascript_enabled"; -const wchar_t kWebKitWebSecurityEnabled[] = - L"webkit.webprefs.web_security_enabled"; -const wchar_t kWebKitJavascriptCanOpenWindowsAutomatically[] = - L"webkit.webprefs.javascript_can_open_windows_automatically"; -const wchar_t kWebKitLoadsImagesAutomatically[] = - L"webkit.webprefs.loads_images_automatically"; -const wchar_t kWebKitPluginsEnabled[] = L"webkit.webprefs.plugins_enabled"; -const wchar_t kWebKitDomPasteEnabled[] = L"webkit.webprefs.dom_paste_enabled"; -const wchar_t kWebKitShrinksStandaloneImagesToFit[] = - L"webkit.webprefs.shrinks_standalone_images_to_fit"; -const wchar_t kWebKitInspectorSettings[] = - L"webkit.webprefs.inspector_settings"; -const wchar_t kWebKitUsesUniversalDetector[] = - L"webkit.webprefs.uses_universal_detector"; -const wchar_t kWebKitTextAreasAreResizable[] = - L"webkit.webprefs.text_areas_are_resizable"; -const wchar_t kWebKitJavaEnabled[] = - L"webkit.webprefs.java_enabled"; -const wchar_t kWebkitTabsToLinks[] = L"webkit.webprefs.tabs_to_links"; +const char kWebKitStandardFontIsSerif[] = + "webkit.webprefs.standard_font_is_serif"; +const char kWebKitFixedFontFamily[] = "webkit.webprefs.fixed_font_family"; +const char kWebKitSerifFontFamily[] = "webkit.webprefs.serif_font_family"; +const char kWebKitSansSerifFontFamily[] = + "webkit.webprefs.sansserif_font_family"; +const char kWebKitCursiveFontFamily[] = "webkit.webprefs.cursive_font_family"; +const char kWebKitFantasyFontFamily[] = "webkit.webprefs.fantasy_font_family"; +const char kWebKitDefaultFontSize[] = "webkit.webprefs.default_font_size"; +const char kWebKitDefaultFixedFontSize[] = + "webkit.webprefs.default_fixed_font_size"; +const char kWebKitMinimumFontSize[] = "webkit.webprefs.minimum_font_size"; +const char kWebKitMinimumLogicalFontSize[] = + "webkit.webprefs.minimum_logical_font_size"; +const char kWebKitJavascriptEnabled[] = "webkit.webprefs.javascript_enabled"; +const char kWebKitWebSecurityEnabled[] = "webkit.webprefs.web_security_enabled"; +const char kWebKitJavascriptCanOpenWindowsAutomatically[] = + "webkit.webprefs.javascript_can_open_windows_automatically"; +const char kWebKitLoadsImagesAutomatically[] = + "webkit.webprefs.loads_images_automatically"; +const char kWebKitPluginsEnabled[] = "webkit.webprefs.plugins_enabled"; +const char kWebKitDomPasteEnabled[] = "webkit.webprefs.dom_paste_enabled"; +const char kWebKitShrinksStandaloneImagesToFit[] = + "webkit.webprefs.shrinks_standalone_images_to_fit"; +const char kWebKitInspectorSettings[] = "webkit.webprefs.inspector_settings"; +const char kWebKitUsesUniversalDetector[] = + "webkit.webprefs.uses_universal_detector"; +const char kWebKitTextAreasAreResizable[] = + "webkit.webprefs.text_areas_are_resizable"; +const char kWebKitJavaEnabled[] = "webkit.webprefs.java_enabled"; +const char kWebkitTabsToLinks[] = "webkit.webprefs.tabs_to_links"; // Boolean which specifies whether the bookmark bar is visible on all tabs. -const wchar_t kShowBookmarkBar[] = L"bookmark_bar.show_on_all_tabs"; +const char kShowBookmarkBar[] = "bookmark_bar.show_on_all_tabs"; // Boolean that is true if the password manager is on (will record new // passwords and fill in known passwords). -const wchar_t kPasswordManagerEnabled[] = L"profile.password_manager_enabled"; +const char kPasswordManagerEnabled[] = "profile.password_manager_enabled"; // OBSOLETE. Boolean that is true if the form AutoFill is on (will record // values entered in text inputs in forms and shows them in a popup when user // type in a text input with the same name later on). This has been superseded // by kAutoFillEnabled. -const wchar_t kFormAutofillEnabled[] = L"profile.form_autofill_enabled"; +const char kFormAutofillEnabled[] = "profile.form_autofill_enabled"; // Boolean that is true when SafeBrowsing is enabled. -const wchar_t kSafeBrowsingEnabled[] = L"safebrowsing.enabled"; +const char kSafeBrowsingEnabled[] = "safebrowsing.enabled"; // Boolean that is true when Suggest support is enabled. -const wchar_t kSearchSuggestEnabled[] = L"search.suggest_enabled"; +const char kSearchSuggestEnabled[] = "search.suggest_enabled"; // OBSOLETE. Enum that specifies whether to enforce a third-party cookie // blocking policy. This has been superseded by kDefaultContentSettings + @@ -123,219 +116,217 @@ const wchar_t kSearchSuggestEnabled[] = L"search.suggest_enabled"; // 0 - allow all cookies. // 1 - block third-party cookies // 2 - block all cookies -const wchar_t kCookieBehavior[] = L"security.cookie_behavior"; +const char kCookieBehavior[] = "security.cookie_behavior"; // The URL (as understood by TemplateURLRef) the default search provider uses // for searches. -const wchar_t kDefaultSearchProviderSearchURL[] = - L"default_search_provider.search_url"; +const char kDefaultSearchProviderSearchURL[] = + "default_search_provider.search_url"; // The URL (as understood by TemplateURLRef) the default search provider uses // for suggestions. -const wchar_t kDefaultSearchProviderSuggestURL[] = - L"default_search_provider.suggest_url"; +const char kDefaultSearchProviderSuggestURL[] = + "default_search_provider.suggest_url"; // The name of the default search provider. -const wchar_t kDefaultSearchProviderName[] = L"default_search_provider.name"; +const char kDefaultSearchProviderName[] = "default_search_provider.name"; // The id of the default search provider. -const wchar_t kDefaultSearchProviderID[] = L"default_search_provider.id"; +const char kDefaultSearchProviderID[] = "default_search_provider.id"; // The prepopulate id of the default search provider. -const wchar_t kDefaultSearchProviderPrepopulateID[] = - L"default_search_provider.prepopulate_id"; +const char kDefaultSearchProviderPrepopulateID[] = + "default_search_provider.prepopulate_id"; // The dictionary key used when the default search providers are given // in the preferences file. Normally they are copied from the master // preferences file. -const wchar_t kSearchProviderOverrides[] = - L"search_provider_overrides"; +const char kSearchProviderOverrides[] = "search_provider_overrides"; // The format version for the dictionary above. -const wchar_t kSearchProviderOverridesVersion[] = - L"search_provider_overrides_version"; +const char kSearchProviderOverridesVersion[] = + "search_provider_overrides_version"; // Boolean which specifies whether we should ask the user if we should download // a file (true) or just download it automatically. -const wchar_t kPromptForDownload[] = L"download.prompt_for_download"; +const char kPromptForDownload[] = "download.prompt_for_download"; // A boolean pref set to true if we're using Link Doctor error pages. -const wchar_t kAlternateErrorPagesEnabled[] = L"alternate_error_pages.enabled"; +const char kAlternateErrorPagesEnabled[] = "alternate_error_pages.enabled"; // A boolean pref set to true if DNS pre-fetching is being done in browser. -const wchar_t kDnsPrefetchingEnabled[] = L"dns_prefetching.enabled"; +const char kDnsPrefetchingEnabled[] = "dns_prefetching.enabled"; // An adaptively identified list of domain names to be pre-fetched during the // next startup, based on what was actually needed during this startup. -const wchar_t kDnsStartupPrefetchList[] = L"StartupDNSPrefetchList"; +const char kDnsStartupPrefetchList[] = "StartupDNSPrefetchList"; // A list of host names used to fetch web pages, and their commonly used // sub-resource hostnames (and expected latency benefits from pre-resolving, or // preconnecting to, such sub-resource hostnames). // This list is adaptively grown and pruned. -const wchar_t kDnsHostReferralList[] = L"HostReferralList"; +const char kDnsHostReferralList[] = "HostReferralList"; // Is the cookie prompt expanded? -const wchar_t kCookiePromptExpanded[] = L"cookieprompt.expanded"; +const char kCookiePromptExpanded[] = "cookieprompt.expanded"; #if defined(USE_NSS) // Prefs for SSLConfigServicePref. Currently, these are only present on // and used by NSS-using OSes. -const wchar_t kCertRevocationCheckingEnabled[] = L"ssl.rev_checking.enabled"; -const wchar_t kSSL2Enabled[] = L"ssl.ssl2.enabled"; -const wchar_t kSSL3Enabled[] = L"ssl.ssl3.enabled"; -const wchar_t kTLS1Enabled[] = L"ssl.tls1.enabled"; +const char kCertRevocationCheckingEnabled[] = "ssl.rev_checking.enabled"; +const char kSSL2Enabled[] = "ssl.ssl2.enabled"; +const char kSSL3Enabled[] = "ssl.ssl3.enabled"; +const char kTLS1Enabled[] = "ssl.tls1.enabled"; #endif #if defined(OS_CHROMEOS) // A boolean pref set to true if TapToClick is being done in browser. -const wchar_t kTapToClickEnabled[] = L"settings.touchpad.enable_tap_to_click"; +const char kTapToClickEnabled[] = "settings.touchpad.enable_tap_to_click"; // A boolean pref set to true if VertEdgeScroll is being done in browser. -const wchar_t kVertEdgeScrollEnabled[] = - L"settings.touchpad.enable_vert_edge_scroll"; +const char kVertEdgeScrollEnabled[] = + "settings.touchpad.enable_vert_edge_scroll"; // A integer pref for the touchpad speed factor. -const wchar_t kTouchpadSpeedFactor[] = L"settings.touchpad.speed_factor"; +const char kTouchpadSpeedFactor[] = "settings.touchpad.speed_factor"; // A integer pref for the touchpad sensitivity. -const wchar_t kTouchpadSensitivity[] = L"settings.touchpad.sensitivity"; +const char kTouchpadSensitivity[] = "settings.touchpad.sensitivity"; // A string pref set to the current input method. -const wchar_t kLanguageCurrentInputMethod[] = - L"settings.language.current_input_method"; +const char kLanguageCurrentInputMethod[] = + "settings.language.current_input_method"; // A string pref set to the previous input method. -const wchar_t kLanguagePreviousInputMethod[] = - L"settings.language.previous_input_method"; +const char kLanguagePreviousInputMethod[] = + "settings.language.previous_input_method"; // A string pref (comma-separated list) set to the "next engine in menu" // hot-key lists. -const wchar_t kLanguageHotkeyNextEngineInMenu[] = - L"settings.language.hotkey_next_engine_in_menu"; +const char kLanguageHotkeyNextEngineInMenu[] = + "settings.language.hotkey_next_engine_in_menu"; // A string pref (comma-separated list) set to the "previous engine" // hot-key lists. -const wchar_t kLanguageHotkeyPreviousEngine[] = - L"settings.language.hotkey_previous_engine"; +const char kLanguageHotkeyPreviousEngine[] = + "settings.language.hotkey_previous_engine"; // A string pref (comma-separated list) set to the preferred language IDs // (ex. "en-US,fr,ko"). -const wchar_t kLanguagePreferredLanguages[] = - L"settings.language.preferred_languages"; +const char kLanguagePreferredLanguages[] = + "settings.language.preferred_languages"; // A string pref (comma-separated list) set to the preloaded (active) input // method IDs (ex. "pinyin,mozc"). -const wchar_t kLanguagePreloadEngines[] = L"settings.language.preload_engines"; +const char kLanguagePreloadEngines[] = "settings.language.preload_engines"; // Boolean prefs for ibus-chewing Chinese input method. -const wchar_t kLanguageChewingAutoShiftCur[] = - L"settings.language.chewing_auto_shift_cur"; -const wchar_t kLanguageChewingAddPhraseDirection[] = - L"settings.language.chewing_add_phrase_direction"; -const wchar_t kLanguageChewingEasySymbolInput[] = - L"settings.language.chewing_easy_symbol_input"; -const wchar_t kLanguageChewingEscCleanAllBuf[] = - L"settings.language.chewing_esc_clean_all_buf"; -const wchar_t kLanguageChewingForceLowercaseEnglish[] = - L"settings.language.chewing_force_lowercase_english"; -const wchar_t kLanguageChewingPlainZhuyin[] = - L"settings.language.chewing_plain_zhuyin"; -const wchar_t kLanguageChewingPhraseChoiceRearward[] = - L"settings.language.chewing_phrase_choice_rearward"; -const wchar_t kLanguageChewingSpaceAsSelection[] = - L"settings.language.chewing_space_as_selection"; +const char kLanguageChewingAutoShiftCur[] = + "settings.language.chewing_auto_shift_cur"; +const char kLanguageChewingAddPhraseDirection[] = + "settings.language.chewing_add_phrase_direction"; +const char kLanguageChewingEasySymbolInput[] = + "settings.language.chewing_easy_symbol_input"; +const char kLanguageChewingEscCleanAllBuf[] = + "settings.language.chewing_esc_clean_all_buf"; +const char kLanguageChewingForceLowercaseEnglish[] = + "settings.language.chewing_force_lowercase_english"; +const char kLanguageChewingPlainZhuyin[] = + "settings.language.chewing_plain_zhuyin"; +const char kLanguageChewingPhraseChoiceRearward[] = + "settings.language.chewing_phrase_choice_rearward"; +const char kLanguageChewingSpaceAsSelection[] = + "settings.language.chewing_space_as_selection"; // Integer prefs for ibus-chewing Chinese input method. -const wchar_t kLanguageChewingMaxChiSymbolLen[] = - L"settings.language.chewing_max_chi_symbol_len"; -const wchar_t kLanguageChewingCandPerPage[] = - L"settings.language.chewing_cand_per_page"; +const char kLanguageChewingMaxChiSymbolLen[] = + "settings.language.chewing_max_chi_symbol_len"; +const char kLanguageChewingCandPerPage[] = + "settings.language.chewing_cand_per_page"; // String prefs for ibus-chewing Chinese input method. -const wchar_t kLanguageChewingKeyboardType[] = - L"settings.language.chewing_keyboard_type"; -const wchar_t kLanguageChewingSelKeys[] = - L"settings.language.chewing_sel_keys"; +const char kLanguageChewingKeyboardType[] = + "settings.language.chewing_keyboard_type"; +const char kLanguageChewingSelKeys[] = + "settings.language.chewing_sel_keys"; -const wchar_t kLanguageChewingHsuSelKeyType[] = - L"settings.language.chewing_hsu_sel_key_type"; +const char kLanguageChewingHsuSelKeyType[] = + "settings.language.chewing_hsu_sel_key_type"; // A string pref which determines the keyboard layout for Hangul input method. -const wchar_t kLanguageHangulKeyboard[] = L"settings.language.hangul_keyboard"; -const wchar_t kLanguageHangulHanjaKeys[] = - L"settings.language.hangul_hanja_keys"; +const char kLanguageHangulKeyboard[] = "settings.language.hangul_keyboard"; +const char kLanguageHangulHanjaKeys[] = "settings.language.hangul_hanja_keys"; // A boolean prefs for ibus-pinyin Chinese input method. -const wchar_t kLanguagePinyinCorrectPinyin[] = - L"settings.language.pinyin_correct_pinyin"; -const wchar_t kLanguagePinyinFuzzyPinyin[] = - L"settings.language.pinyin_fuzzy_pinyin"; -const wchar_t kLanguagePinyinShiftSelectCandidate[] = - L"settings.language.pinyin_shift_select_candidate"; -const wchar_t kLanguagePinyinMinusEqualPage[] = - L"settings.language.pinyin_minus_equal_page"; -const wchar_t kLanguagePinyinCommaPeriodPage[] = - L"settings.language.pinyin_comma_period_page"; -const wchar_t kLanguagePinyinAutoCommit[] = - L"settings.language.pinyin_auto_commit"; -const wchar_t kLanguagePinyinDoublePinyin[] = - L"settings.language.pinyin_double_pinyin"; -const wchar_t kLanguagePinyinInitChinese[] = - L"settings.language.pinyin_init_chinese"; -const wchar_t kLanguagePinyinInitFull[] = - L"settings.language.pinyin_init_full"; -const wchar_t kLanguagePinyinInitFullPunct[] = - L"settings.language.pinyin_init_full_punct"; -const wchar_t kLanguagePinyinInitSimplifiedChinese[] = - L"settings.language.pinyin_init_simplified_chinese"; -const wchar_t kLanguagePinyinTradCandidate[] = - L"settings.language.pinyin_trad_candidate"; +const char kLanguagePinyinCorrectPinyin[] = + "settings.language.pinyin_correct_pinyin"; +const char kLanguagePinyinFuzzyPinyin[] = + "settings.language.pinyin_fuzzy_pinyin"; +const char kLanguagePinyinShiftSelectCandidate[] = + "settings.language.pinyin_shift_select_candidate"; +const char kLanguagePinyinMinusEqualPage[] = + "settings.language.pinyin_minus_equal_page"; +const char kLanguagePinyinCommaPeriodPage[] = + "settings.language.pinyin_comma_period_page"; +const char kLanguagePinyinAutoCommit[] = + "settings.language.pinyin_auto_commit"; +const char kLanguagePinyinDoublePinyin[] = + "settings.language.pinyin_double_pinyin"; +const char kLanguagePinyinInitChinese[] = + "settings.language.pinyin_init_chinese"; +const char kLanguagePinyinInitFull[] = + "settings.language.pinyin_init_full"; +const char kLanguagePinyinInitFullPunct[] = + "settings.language.pinyin_init_full_punct"; +const char kLanguagePinyinInitSimplifiedChinese[] = + "settings.language.pinyin_init_simplified_chinese"; +const char kLanguagePinyinTradCandidate[] = + "settings.language.pinyin_trad_candidate"; // A integer prefs for ibus-pinyin Chinese input method. -const wchar_t kLanguagePinyinDoublePinyinSchema[] = - L"settings.language.pinyin_double_pinyin_schema"; -const wchar_t kLanguagePinyinLookupTablePageSize[] = - L"settings.language.pinyin_lookup_table_page_size"; +const char kLanguagePinyinDoublePinyinSchema[] = + "settings.language.pinyin_double_pinyin_schema"; +const char kLanguagePinyinLookupTablePageSize[] = + "settings.language.pinyin_lookup_table_page_size"; // A string prefs for ibus-mozc Japanese input method. // ibus-mozc converts the string values to protobuf enum values defined in // third_party/ibus-mozc/files/src/session/config.proto. -const wchar_t kLanguageMozcPreeditMethod[] = - L"settings.language.mozc_preedit_method"; -const wchar_t kLanguageMozcSessionKeymap[] = - L"settings.language.mozc_session_keymap"; -const wchar_t kLanguageMozcPunctuationMethod[] = - L"settings.language.mozc_punctuation_method"; -const wchar_t kLanguageMozcSymbolMethod[] = - L"settings.language.mozc_symbol_method"; -const wchar_t kLanguageMozcSpaceCharacterForm[] = - L"settings.language.mozc_space_character_form"; -const wchar_t kLanguageMozcHistoryLearningLevel[] = - L"settings.language.mozc_history_learning_level"; -const wchar_t kLanguageMozcSelectionShortcut[] = - L"settings.language.mozc_selection_shortcut"; -const wchar_t kLanguageMozcShiftKeyModeSwitch[] = - L"settings.language.mozc_shift_key_mode_switch"; -const wchar_t kLanguageMozcNumpadCharacterForm[] = - L"settings.language.mozc_numpad_character_form"; -const wchar_t kLanguageMozcIncognitoMode[] = - L"settings.language.mozc_incognito_mode"; -const wchar_t kLanguageMozcUseAutoImeTurnOff[] = - L"settings.language.mozc_use_auto_ime_turn_off"; -const wchar_t kLanguageMozcUseDateConversion[] = - L"settings.language.mozc_use_date_conversion"; -const wchar_t kLanguageMozcUseSingleKanjiConversion[] = - L"settings.language.mozc_use_single_kanji_conversion"; -const wchar_t kLanguageMozcUseSymbolConversion[] = - L"settings.language.mozc_use_symbol_conversion"; -const wchar_t kLanguageMozcUseNumberConversion[] = - L"settings.language.mozc_use_number_conversion"; -const wchar_t kLanguageMozcUseHistorySuggest[] = - L"settings.language.mozc_use_history_suggest"; -const wchar_t kLanguageMozcUseDictionarySuggest[] = - L"settings.language.mozc_use_dictionary_suggest"; -const wchar_t kLanguageMozcSuggestionsSize[] = - L"settings.language.mozc_suggestions_size"; +const char kLanguageMozcPreeditMethod[] = + "settings.language.mozc_preedit_method"; +const char kLanguageMozcSessionKeymap[] = + "settings.language.mozc_session_keymap"; +const char kLanguageMozcPunctuationMethod[] = + "settings.language.mozc_punctuation_method"; +const char kLanguageMozcSymbolMethod[] = + "settings.language.mozc_symbol_method"; +const char kLanguageMozcSpaceCharacterForm[] = + "settings.language.mozc_space_character_form"; +const char kLanguageMozcHistoryLearningLevel[] = + "settings.language.mozc_history_learning_level"; +const char kLanguageMozcSelectionShortcut[] = + "settings.language.mozc_selection_shortcut"; +const char kLanguageMozcShiftKeyModeSwitch[] = + "settings.language.mozc_shift_key_mode_switch"; +const char kLanguageMozcNumpadCharacterForm[] = + "settings.language.mozc_numpad_character_form"; +const char kLanguageMozcIncognitoMode[] = + "settings.language.mozc_incognito_mode"; +const char kLanguageMozcUseAutoImeTurnOff[] = + "settings.language.mozc_use_auto_ime_turn_off"; +const char kLanguageMozcUseDateConversion[] = + "settings.language.mozc_use_date_conversion"; +const char kLanguageMozcUseSingleKanjiConversion[] = + "settings.language.mozc_use_single_kanji_conversion"; +const char kLanguageMozcUseSymbolConversion[] = + "settings.language.mozc_use_symbol_conversion"; +const char kLanguageMozcUseNumberConversion[] = + "settings.language.mozc_use_number_conversion"; +const char kLanguageMozcUseHistorySuggest[] = + "settings.language.mozc_use_history_suggest"; +const char kLanguageMozcUseDictionarySuggest[] = + "settings.language.mozc_use_dictionary_suggest"; +const char kLanguageMozcSuggestionsSize[] = + "settings.language.mozc_suggestions_size"; // A integer pref which determines how we remap the XKB modifier keys. // 0: Do not remap. @@ -343,512 +334,499 @@ const wchar_t kLanguageMozcSuggestionsSize[] = // 2: Swap Left Win (i.e. Search) and Left Control. // TODO(yusukes): Delete this pref when the final configration dialog (using // DOM UI) is implemented. See crosbug.com/2636. -const wchar_t kLanguageXkbModifierRemap[] = - L"settings.language.xkb_modifier_remap"; +const char kLanguageXkbModifierRemap[] = "settings.language.xkb_modifier_remap"; // A boolean pref which determines whether accessibility is enabled. -const wchar_t kAccessibilityEnabled[] = L"settings.accessibility"; +const char kAccessibilityEnabled[] = "settings.accessibility"; // A boolean pref which turns on Advanced Filesystem // (USB support, SD card, etc). -const wchar_t kLabsAdvancedFilesystemEnabled[] = - L"settings.labs.advanced_filesystem"; +const char kLabsAdvancedFilesystemEnabled[] = + "settings.labs.advanced_filesystem"; // A boolean pref which turns on the mediaplayer. -const wchar_t kLabsMediaplayerEnabled[] = L"settings.labs.mediaplayer"; +const char kLabsMediaplayerEnabled[] = "settings.labs.mediaplayer"; #endif // defined(OS_CHROMEOS) // The disabled messages in IPC logging. -const wchar_t kIpcDisabledMessages[] = L"ipc_log_disabled_messages"; +const char kIpcDisabledMessages[] = "ipc_log_disabled_messages"; // A boolean pref set to true if a Home button to open the Home pages should be // visible on the toolbar. -const wchar_t kShowHomeButton[] = L"browser.show_home_button"; +const char kShowHomeButton[] = "browser.show_home_button"; // A boolean pref set to true if the Page and Options menu buttons should be // visible on the toolbar. This is only used for Mac where the default is to // have these menu in the main menubar, not as buttons on the toolbar. -const wchar_t kShowPageOptionsButtons[] = L"browser.show_page_options_buttons"; +const char kShowPageOptionsButtons[] = "browser.show_page_options_buttons"; // A string value which saves short list of recently user selected encodings // separated with comma punctuation mark. -const wchar_t kRecentlySelectedEncoding[] = - L"profile.recently_selected_encodings"; +const char kRecentlySelectedEncoding[] = "profile.recently_selected_encodings"; // Clear Browsing Data dialog preferences. -const wchar_t kDeleteBrowsingHistory[] = L"browser.clear_data.browsing_history"; -const wchar_t kDeleteDownloadHistory[] = - L"browser.clear_data.download_history"; -const wchar_t kDeleteCache[] = L"browser.clear_data.cache"; -const wchar_t kDeleteCookies[] = L"browser.clear_data.cookies"; -const wchar_t kDeletePasswords[] = L"browser.clear_data.passwords"; -const wchar_t kDeleteFormData[] = L"browser.clear_data.form_data"; -const wchar_t kDeleteTimePeriod[] = L"browser.clear_data.time_period"; +const char kDeleteBrowsingHistory[] = "browser.clear_data.browsing_history"; +const char kDeleteDownloadHistory[] = "browser.clear_data.download_history"; +const char kDeleteCache[] = "browser.clear_data.cache"; +const char kDeleteCookies[] = "browser.clear_data.cookies"; +const char kDeletePasswords[] = "browser.clear_data.passwords"; +const char kDeleteFormData[] = "browser.clear_data.form_data"; +const char kDeleteTimePeriod[] = "browser.clear_data.time_period"; // Boolean pref to define the default values for using spellchecker. -const wchar_t kEnableSpellCheck[] = L"browser.enable_spellchecking"; +const char kEnableSpellCheck[] = "browser.enable_spellchecking"; // Boolean pref to define the default values for using auto spell correct. -const wchar_t kEnableAutoSpellCorrect[] = L"browser.enable_autospellcorrect"; +const char kEnableAutoSpellCorrect[] = "browser.enable_autospellcorrect"; // String pref to define the default values for print overlays. -const wchar_t kPrintingPageHeaderLeft[] = L"printing.page.header.left"; -const wchar_t kPrintingPageHeaderCenter[] = L"printing.page.header.center"; -const wchar_t kPrintingPageHeaderRight[] = L"printing.page.header.right"; -const wchar_t kPrintingPageFooterLeft[] = L"printing.page.footer.left"; -const wchar_t kPrintingPageFooterCenter[] = L"printing.page.footer.center"; -const wchar_t kPrintingPageFooterRight[] = L"printing.page.footer.right"; +const char kPrintingPageHeaderLeft[] = "printing.page.header.left"; +const char kPrintingPageHeaderCenter[] = "printing.page.header.center"; +const char kPrintingPageHeaderRight[] = "printing.page.header.right"; +const char kPrintingPageFooterLeft[] = "printing.page.footer.left"; +const char kPrintingPageFooterCenter[] = "printing.page.footer.center"; +const char kPrintingPageFooterRight[] = "printing.page.footer.right"; #if defined(TOOLKIT_USES_GTK) // GTK specific preference on whether we should match the system GTK theme. -const wchar_t kUsesSystemTheme[] = L"extensions.theme.use_system"; +const char kUsesSystemTheme[] = "extensions.theme.use_system"; #endif -const wchar_t kCurrentThemePackFilename[] = L"extensions.theme.pack"; -const wchar_t kCurrentThemeID[] = L"extensions.theme.id"; -const wchar_t kCurrentThemeImages[] = L"extensions.theme.images"; -const wchar_t kCurrentThemeColors[] = L"extensions.theme.colors"; -const wchar_t kCurrentThemeTints[] = L"extensions.theme.tints"; -const wchar_t kCurrentThemeDisplayProperties[] = - L"extensions.theme.properties"; +const char kCurrentThemePackFilename[] = "extensions.theme.pack"; +const char kCurrentThemeID[] = "extensions.theme.id"; +const char kCurrentThemeImages[] = "extensions.theme.images"; +const char kCurrentThemeColors[] = "extensions.theme.colors"; +const char kCurrentThemeTints[] = "extensions.theme.tints"; +const char kCurrentThemeDisplayProperties[] = "extensions.theme.properties"; // Boolean pref which persists whether the extensions_ui is in developer mode // (showing developer packing tools and extensions details) -const wchar_t kExtensionsUIDeveloperMode[] = L"extensions.ui.developer_mode"; +const char kExtensionsUIDeveloperMode[] = "extensions.ui.developer_mode"; // Integer pref that tracks the number of browser actions visible in the browser // actions toolbar. -const wchar_t kExtensionToolbarSize[] = L"extensions.toolbarsize"; +const char kExtensionToolbarSize[] = "extensions.toolbarsize"; // Pref containing the directory for internal plugins as written to the plugins // list (below). -const wchar_t kPluginsLastInternalDirectory[] = - L"plugins.last_internal_directory"; +const char kPluginsLastInternalDirectory[] = "plugins.last_internal_directory"; // List pref containing information (dictionaries) on plugins. -const wchar_t kPluginsPluginsList[] = L"plugins.plugins_list"; +const char kPluginsPluginsList[] = "plugins.plugins_list"; // List pref containing names of plugins that are disabled by policy. -const wchar_t kPluginsPluginsBlacklist[] = L"plugins.plugins_blacklist"; +const char kPluginsPluginsBlacklist[] = "plugins.plugins_blacklist"; // When first shipped, the pdf plugin will be disabled by default. When we // enable it by default, we'll want to do so only once. -const wchar_t kPluginsEnabledInternalPDF[] = L"plugins.enabled_internal_pdf"; +const char kPluginsEnabledInternalPDF[] = "plugins.enabled_internal_pdf"; // Boolean that indicates whether we should check if we are the default browser // on start-up. -const wchar_t kCheckDefaultBrowser[] = L"browser.check_default_browser"; +const char kCheckDefaultBrowser[] = "browser.check_default_browser"; #if defined(OS_MACOSX) // Boolean that indicates whether the application should show the info bar // asking the user to set up automatic updates when Keystone promotion is // required. -const wchar_t kShowUpdatePromotionInfoBar[] = - L"browser.show_update_promotion_info_bar"; +const char kShowUpdatePromotionInfoBar[] = + "browser.show_update_promotion_info_bar"; #endif // Boolean that is false if we should show window manager decorations. If // true, we draw a custom chrome frame (thicker title bar and blue border). -const wchar_t kUseCustomChromeFrame[] = L"browser.custom_chrome_frame"; +const char kUseCustomChromeFrame[] = "browser.custom_chrome_frame"; // Boolean that indicates whether the infobar explaining that search can be // done directly from the omnibox should be shown. -const wchar_t kShowOmniboxSearchHint[] = L"browser.show_omnibox_search_hint"; +const char kShowOmniboxSearchHint[] = "browser.show_omnibox_search_hint"; // The list of origins which are allowed|denied to show desktop notifications. -const wchar_t kDesktopNotificationDefaultContentSetting[] = - L"profile.notifications_default_content_setting"; -const wchar_t kDesktopNotificationAllowedOrigins[] = - L"profile.notification_allowed_sites"; -const wchar_t kDesktopNotificationDeniedOrigins[] = - L"profile.notification_denied_sites"; +const char kDesktopNotificationDefaultContentSetting[] = + "profile.notifications_default_content_setting"; +const char kDesktopNotificationAllowedOrigins[] = + "profile.notification_allowed_sites"; +const char kDesktopNotificationDeniedOrigins[] = + "profile.notification_denied_sites"; // Dictionary of content settings applied to all hosts by default. -const wchar_t kDefaultContentSettings[] = L"profile.default_content_settings"; +const char kDefaultContentSettings[] = "profile.default_content_settings"; // OBSOLETE. Dictionary that maps hostnames to content related settings. // Default settings will be applied to hosts not in this pref. -const wchar_t kPerHostContentSettings[] = L"profile.per_host_content_settings"; +const char kPerHostContentSettings[] = "profile.per_host_content_settings"; // Version of the pattern format used to define content settings. -const wchar_t kContentSettingsVersion[] = - L"profile.content_settings.pref_version"; +const char kContentSettingsVersion[] = "profile.content_settings.pref_version"; // Patterns for mapping hostnames to content related settings. Default settings // will be applied to hosts that don't match any of the patterns. Replaces // kPerHostContentSettings. The pattern format used is defined by // kContentSettingsVersion. -const wchar_t kContentSettingsPatterns[] = - L"profile.content_settings.patterns"; +const char kContentSettingsPatterns[] = "profile.content_settings.patterns"; // Boolean that is true if we should unconditionally block third-party cookies, // regardless of other content settings. -const wchar_t kBlockThirdPartyCookies[] = L"profile.block_third_party_cookies"; +const char kBlockThirdPartyCookies[] = "profile.block_third_party_cookies"; // Boolean that is true when all locally stored site data (e.g. cookies, local // storage, etc..) should be deleted on exit. -const wchar_t kClearSiteDataOnExit[] = L"profile.clear_site_data_on_exit"; +const char kClearSiteDataOnExit[] = "profile.clear_site_data_on_exit"; // Dictionary that maps hostnames to zoom levels. Hosts not in this pref will // be displayed at the default zoom level. -const wchar_t kPerHostZoomLevels[] = L"profile.per_host_zoom_levels"; +const char kPerHostZoomLevels[] = "profile.per_host_zoom_levels"; // Boolean that is true if AutoFill is enabled and allowed to save profile data. -const wchar_t kAutoFillEnabled[] = L"autofill.enabled"; +const char kAutoFillEnabled[] = "autofill.enabled"; // Boolean that is true when auxiliary AutoFill profiles are enabled. // Currently applies to Address Book "me" card on Mac. False on Win and Linux. -const wchar_t kAutoFillAuxiliaryProfilesEnabled[] = - L"autofill.auxiliary_profiles_enabled"; +const char kAutoFillAuxiliaryProfilesEnabled[] = + "autofill.auxiliary_profiles_enabled"; // Position and size of the AutoFill dialog. -const wchar_t kAutoFillDialogPlacement[] = L"autofill.dialog_placement"; +const char kAutoFillDialogPlacement[] = "autofill.dialog_placement"; // Double that indicates positive (for matched forms) upload rate. -const wchar_t kAutoFillPositiveUploadRate[] = L"autofill.positive_upload_rate"; +const char kAutoFillPositiveUploadRate[] = "autofill.positive_upload_rate"; // Double that indicates negative (for not matched forms) upload rate. -const wchar_t kAutoFillNegativeUploadRate[] = L"autofill.negative_upload_rate"; +const char kAutoFillNegativeUploadRate[] = "autofill.negative_upload_rate"; // Boolean that is true when the tabstrip is to be laid out vertically down the // side of the browser window. -const wchar_t kUseVerticalTabs[] = L"tabs.use_vertical_tabs"; +const char kUseVerticalTabs[] = "tabs.use_vertical_tabs"; // Boolean that is true when the translate feature is enabled. -const wchar_t kEnableTranslate[] = L"translate.enabled"; +const char kEnableTranslate[] = "translate.enabled"; -const wchar_t kPinnedTabs[] = L"pinned_tabs"; +const char kPinnedTabs[] = "pinned_tabs"; // Integer containing the default Geolocation content setting. -const wchar_t kGeolocationDefaultContentSetting[] = - L"geolocation.default_content_setting"; +const char kGeolocationDefaultContentSetting[] = + "geolocation.default_content_setting"; // Dictionary that maps [frame, toplevel] to their Geolocation content setting. -const wchar_t kGeolocationContentSettings[] = L"geolocation.content_settings"; +const char kGeolocationContentSettings[] = "geolocation.content_settings"; // *************** LOCAL STATE *************** // These are attached to the machine/installation // The metrics client GUID and session ID. -const wchar_t kMetricsClientID[] = L"user_experience_metrics.client_id"; -const wchar_t kMetricsSessionID[] = L"user_experience_metrics.session_id"; +const char kMetricsClientID[] = "user_experience_metrics.client_id"; +const char kMetricsSessionID[] = "user_experience_metrics.session_id"; // Date/time when the current metrics profile ID was created // (which hopefully corresponds to first run). -const wchar_t kMetricsClientIDTimestamp[] = - L"user_experience_metrics.client_id_timestamp"; +const char kMetricsClientIDTimestamp[] = + "user_experience_metrics.client_id_timestamp"; // Boolean that specifies whether or not crash reporting and metrics reporting // are sent over the network for analysis. -const wchar_t kMetricsReportingEnabled[] = - L"user_experience_metrics.reporting_enabled"; +const char kMetricsReportingEnabled[] = + "user_experience_metrics.reporting_enabled"; // Array of strings that are each UMA logs that were supposed to be sent in the // first minute of a browser session. These logs include things like crash count // info, etc. -const wchar_t kMetricsInitialLogs[] = - L"user_experience_metrics.initial_logs"; +const char kMetricsInitialLogs[] = + "user_experience_metrics.initial_logs"; // Array of strings that are each UMA logs that were not sent because the // browser terminated before these accumulated metrics could be sent. These // logs typically include histograms and memory reports, as well as ongoing // user activities. -const wchar_t kMetricsOngoingLogs[] = - L"user_experience_metrics.ongoing_logs"; +const char kMetricsOngoingLogs[] = + "user_experience_metrics.ongoing_logs"; // Where profile specific metrics are placed. -const wchar_t kProfileMetrics[] = L"user_experience_metrics.profiles"; +const char kProfileMetrics[] = "user_experience_metrics.profiles"; // The metrics for a profile are stored as dictionary values under the // path kProfileMetrics. The individual metrics are placed under the path // kProfileMetrics.kProfilePrefix<hashed-profile-id>. -const wchar_t kProfilePrefix[] = L"profile-"; +const char kProfilePrefix[] = "profile-"; // True if the previous run of the program exited cleanly. -const wchar_t kStabilityExitedCleanly[] = - L"user_experience_metrics.stability.exited_cleanly"; +const char kStabilityExitedCleanly[] = + "user_experience_metrics.stability.exited_cleanly"; // Version string of previous run, which is used to assure that stability // metrics reported under current version reflect stability of the same version. -const wchar_t kStabilityStatsVersion[] = - L"user_experience_metrics.stability.stats_version"; +const char kStabilityStatsVersion[] = + "user_experience_metrics.stability.stats_version"; // Build time, in seconds since an epoch, which is used to assure that stability // metrics reported reflect stability of the same build. -const wchar_t kStabilityStatsBuildTime[] = - L"user_experience_metrics.stability.stats_buildtime"; +const char kStabilityStatsBuildTime[] = + "user_experience_metrics.stability.stats_buildtime"; // False if we received a session end and either we crashed during processing // the session end or ran out of time and windows terminated us. -const wchar_t kStabilitySessionEndCompleted[] = - L"user_experience_metrics.stability.session_end_completed"; +const char kStabilitySessionEndCompleted[] = + "user_experience_metrics.stability.session_end_completed"; // Number of times the application was launched since last report. -const wchar_t kStabilityLaunchCount[] = - L"user_experience_metrics.stability.launch_count"; +const char kStabilityLaunchCount[] = + "user_experience_metrics.stability.launch_count"; // Number of times the application exited uncleanly since the last report. -const wchar_t kStabilityCrashCount[] = - L"user_experience_metrics.stability.crash_count"; +const char kStabilityCrashCount[] = + "user_experience_metrics.stability.crash_count"; // Number of times the session end did not complete. -const wchar_t kStabilityIncompleteSessionEndCount[] = - L"user_experience_metrics.stability.incomplete_session_end_count"; +const char kStabilityIncompleteSessionEndCount[] = + "user_experience_metrics.stability.incomplete_session_end_count"; // Number of times a page load event occurred since the last report. -const wchar_t kStabilityPageLoadCount[] = - L"user_experience_metrics.stability.page_load_count"; +const char kStabilityPageLoadCount[] = + "user_experience_metrics.stability.page_load_count"; // Number of times a renderer process crashed since the last report. -const wchar_t kStabilityRendererCrashCount[] = - L"user_experience_metrics.stability.renderer_crash_count"; +const char kStabilityRendererCrashCount[] = + "user_experience_metrics.stability.renderer_crash_count"; // Number of times an extension renderer process crashed since the last report. -const wchar_t kStabilityExtensionRendererCrashCount[] = - L"user_experience_metrics.stability.extension_renderer_crash_count"; +const char kStabilityExtensionRendererCrashCount[] = + "user_experience_metrics.stability.extension_renderer_crash_count"; // Time when the app was last launched, in seconds since the epoch. -const wchar_t kStabilityLaunchTimeSec[] = - L"user_experience_metrics.stability.launch_time_sec"; +const char kStabilityLaunchTimeSec[] = + "user_experience_metrics.stability.launch_time_sec"; // Time when the app was last known to be running, in seconds since // the epoch. -const wchar_t kStabilityLastTimestampSec[] = - L"user_experience_metrics.stability.last_timestamp_sec"; +const char kStabilityLastTimestampSec[] = + "user_experience_metrics.stability.last_timestamp_sec"; // This is the location of a list of dictionaries of plugin stability stats. -const wchar_t kStabilityPluginStats[] = - L"user_experience_metrics.stability.plugin_stats2"; +const char kStabilityPluginStats[] = + "user_experience_metrics.stability.plugin_stats2"; // Number of times the renderer has become non-responsive since the last // report. -const wchar_t kStabilityRendererHangCount[] = - L"user_experience_metrics.stability.renderer_hang_count"; +const char kStabilityRendererHangCount[] = + "user_experience_metrics.stability.renderer_hang_count"; // Total number of child process crashes (other than renderer / extension // renderer ones, and plugin children, which are counted separately) since the // last report. -const wchar_t kStabilityChildProcessCrashCount[] = - L"user_experience_metrics.stability.child_process_crash_count"; +const char kStabilityChildProcessCrashCount[] = + "user_experience_metrics.stability.child_process_crash_count"; // Number of times the browser has been able to register crash reporting. -const wchar_t kStabilityBreakpadRegistrationSuccess[] = - L"user_experience_metrics.stability.breakpad_registration_ok"; +const char kStabilityBreakpadRegistrationSuccess[] = + "user_experience_metrics.stability.breakpad_registration_ok"; // Number of times the browser has failed to register crash reporting. -const wchar_t kStabilityBreakpadRegistrationFail[] = - L"user_experience_metrics.stability.breakpad_registration_fail"; +const char kStabilityBreakpadRegistrationFail[] = + "user_experience_metrics.stability.breakpad_registration_fail"; // Number of times the browser has been run under a debugger. -const wchar_t kStabilityDebuggerPresent[] = - L"user_experience_metrics.stability.debugger_present"; +const char kStabilityDebuggerPresent[] = + "user_experience_metrics.stability.debugger_present"; // Number of times the browser has not been run under a debugger. -const wchar_t kStabilityDebuggerNotPresent[] = - L"user_experience_metrics.stability.debugger_not_present"; +const char kStabilityDebuggerNotPresent[] = + "user_experience_metrics.stability.debugger_not_present"; // The keys below are used for the dictionaries in the // kStabilityPluginStats list. -const wchar_t kStabilityPluginName[] = L"name"; -const wchar_t kStabilityPluginLaunches[] = L"launches"; -const wchar_t kStabilityPluginInstances[] = L"instances"; -const wchar_t kStabilityPluginCrashes[] = L"crashes"; +const char kStabilityPluginName[] = "name"; +const char kStabilityPluginLaunches[] = "launches"; +const char kStabilityPluginInstances[] = "instances"; +const char kStabilityPluginCrashes[] = "crashes"; // The keys below are strictly increasing counters over the lifetime of // a chrome installation. They are (optionally) sent up to the uninstall // survey in the event of uninstallation. -const wchar_t kUninstallMetricsPageLoadCount[] = - L"uninstall_metrics.page_load_count"; -const wchar_t kUninstallLaunchCount[] = L"uninstall_metrics.launch_count"; -const wchar_t kUninstallMetricsInstallDate[] = - L"uninstall_metrics.installation_date2"; -const wchar_t kUninstallMetricsUptimeSec[] = L"uninstall_metrics.uptime_sec"; -const wchar_t kUninstallLastLaunchTimeSec[] = - L"uninstall_metrics.last_launch_time_sec"; -const wchar_t kUninstallLastObservedRunTimeSec[] = - L"uninstall_metrics.last_observed_running_time_sec"; +const char kUninstallMetricsPageLoadCount[] = + "uninstall_metrics.page_load_count"; +const char kUninstallLaunchCount[] = "uninstall_metrics.launch_count"; +const char kUninstallMetricsInstallDate[] = + "uninstall_metrics.installation_date2"; +const char kUninstallMetricsUptimeSec[] = "uninstall_metrics.uptime_sec"; +const char kUninstallLastLaunchTimeSec[] = + "uninstall_metrics.last_launch_time_sec"; +const char kUninstallLastObservedRunTimeSec[] = + "uninstall_metrics.last_observed_running_time_sec"; // A collection of position, size, and other data relating to the browser // window to restore on startup. -const wchar_t kBrowserWindowPlacement[] = L"browser.window_placement"; +const char kBrowserWindowPlacement[] = "browser.window_placement"; // A collection of position, size, and other data relating to the task // manager window to restore on startup. -const wchar_t kTaskManagerWindowPlacement[] = L"task_manager.window_placement"; +const char kTaskManagerWindowPlacement[] = "task_manager.window_placement"; // A collection of position, size, and other data relating to the page info // window to restore on startup. -const wchar_t kPageInfoWindowPlacement[] = L"page_info.window_placement"; +const char kPageInfoWindowPlacement[] = "page_info.window_placement"; // A collection of position, size, and other data relating to the keyword // editor window to restore on startup. -const wchar_t kKeywordEditorWindowPlacement[] = - L"keyword_editor.window_placement"; +const char kKeywordEditorWindowPlacement[] = "keyword_editor.window_placement"; // A collection of position, size, and other data relating to the preferences // window to restore on startup. -const wchar_t kPreferencesWindowPlacement[] = L"preferences.window_placement"; +const char kPreferencesWindowPlacement[] = "preferences.window_placement"; // An integer specifying the total number of bytes to be used by the // renderer's in-memory cache of objects. -const wchar_t kMemoryCacheSize[] = L"renderer.memory_cache.size"; +const char kMemoryCacheSize[] = "renderer.memory_cache.size"; // String which specifies where to download files to by default. -const wchar_t kDownloadDefaultDirectory[] = L"download.default_directory"; +const char kDownloadDefaultDirectory[] = "download.default_directory"; // Boolean that records if the download directory was changed by an // upgrade a unsafe location to a safe location. -const wchar_t kDownloadDirUpgraded[] = L"download.directory_upgrade"; +const char kDownloadDirUpgraded[] = "download.directory_upgrade"; // String which specifies where to save html files to by default. -const wchar_t kSaveFileDefaultDirectory[] = L"savefile.default_directory"; +const char kSaveFileDefaultDirectory[] = "savefile.default_directory"; // String which specifies the last directory that was chosen for uploading // or opening a file. -extern const wchar_t kSelectFileLastDirectory[] = L"selectfile.last_directory"; +extern const char kSelectFileLastDirectory[] = "selectfile.last_directory"; // Extensions which should be opened upon completion. -const wchar_t kDownloadExtensionsToOpen[] = L"download.extensions_to_open"; +const char kDownloadExtensionsToOpen[] = "download.extensions_to_open"; // Integer which specifies the frequency in milliseconds for detecting whether // plugin windows are hung. -const wchar_t kHungPluginDetectFrequency[] = - L"browser.hung_plugin_detect_freq"; +const char kHungPluginDetectFrequency[] = "browser.hung_plugin_detect_freq"; // Integer which specifies the timeout value to be used for SendMessageTimeout // to detect a hung plugin window. -const wchar_t kPluginMessageResponseTimeout[] = - L"browser.plugin_message_response_timeout"; +const char kPluginMessageResponseTimeout[] = + "browser.plugin_message_response_timeout"; // String which represents the dictionary name for our spell-checker. -const wchar_t kSpellCheckDictionary[] = L"spellcheck.dictionary"; +const char kSpellCheckDictionary[] = "spellcheck.dictionary"; // Dictionary of schemes used by the external protocol handler. // The value is true if the scheme must be ignored. -const wchar_t kExcludedSchemes[] = L"protocol_handler.excluded_schemes"; +const char kExcludedSchemes[] = "protocol_handler.excluded_schemes"; // Keys used for MAC handling of SafeBrowsing requests. -const wchar_t kSafeBrowsingClientKey[] = L"safe_browsing.client_key"; -const wchar_t kSafeBrowsingWrappedKey[] = L"safe_browsing.wrapped_key"; +const char kSafeBrowsingClientKey[] = "safe_browsing.client_key"; +const char kSafeBrowsingWrappedKey[] = "safe_browsing.wrapped_key"; // Integer that specifies the index of the tab the user was on when they // last visited the options window. -const wchar_t kOptionsWindowLastTabIndex[] = L"options_window.last_tab_index"; +const char kOptionsWindowLastTabIndex[] = "options_window.last_tab_index"; // Integer that specifies the index of the tab the user was on when they // last visited the content settings window. -const wchar_t kContentSettingsWindowLastTabIndex[] = - L"content_settings_window.last_tab_index"; +const char kContentSettingsWindowLastTabIndex[] = + "content_settings_window.last_tab_index"; // Integer that specifies the index of the tab the user was on when they // last visited the Certificate Manager window. -const wchar_t kCertificateManagerWindowLastTabIndex[] = - L"certificate_manager_window.last_tab_index"; +const char kCertificateManagerWindowLastTabIndex[] = + "certificate_manager_window.last_tab_index"; // The mere fact that this pref is registered signals that we should show the // First Run Search Information bubble when the first browser window appears. // This preference is only registered by the first-run procedure. -const wchar_t kShouldShowFirstRunBubble[] = L"show-first-run-bubble"; +const char kShouldShowFirstRunBubble[] = "show-first-run-bubble"; // The mere fact that this pref is registered signals that we should show the // smaller OEM First Run Search Information bubble when the first // browser window appears. // This preference is only registered by the first-run procedure. -const wchar_t kShouldUseOEMFirstRunBubble[] = L"show-OEM-first-run-bubble"; +const char kShouldUseOEMFirstRunBubble[] = "show-OEM-first-run-bubble"; // The mere fact that this pref is registered signals that we should show the // minimal First Run omnibox information bubble when the first // browser window appears. // This preference is only registered by the first-run procedure. -const wchar_t kShouldUseMinimalFirstRunBubble[] = - L"show-minimal-first-run-bubble"; +const char kShouldUseMinimalFirstRunBubble[] = "show-minimal-first-run-bubble"; // Signal that we should show the welcome page when we launch Chrome. -const wchar_t kShouldShowWelcomePage[] = L"show-welcome-page"; +const char kShouldShowWelcomePage[] = "show-welcome-page"; // String containing the last known Google URL. We re-detect this on startup in // most cases, and use it to send traffic to the correct Google host or with the // correct Google domain/country code for whatever location the user is in. -const wchar_t kLastKnownGoogleURL[] = L"browser.last_known_google_url"; +const char kLastKnownGoogleURL[] = "browser.last_known_google_url"; // String containing the last known intranet redirect URL, if any. See // intranet_redirect_detector.h for more information. -const wchar_t kLastKnownIntranetRedirectOrigin[] = L""; +const char kLastKnownIntranetRedirectOrigin[] = ""; // Integer containing the system Country ID the first time we checked the // template URL prepopulate data. This is used to avoid adding a whole bunch of // new search engine choices if prepopulation runs when the user's Country ID // differs from their previous Country ID. This pref does not exist until // prepopulation has been run at least once. -const wchar_t kCountryIDAtInstall[] = L"countryid_at_install"; +const char kCountryIDAtInstall[] = "countryid_at_install"; // OBSOLETE. Same as above, but uses the Windows-specific GeoID value instead. // Updated if found to the above key. -const wchar_t kGeoIDAtInstall[] = L"geoid_at_install"; +const char kGeoIDAtInstall[] = "geoid_at_install"; // An enum value of how the browser was shut down (see browser_shutdown.h). -const wchar_t kShutdownType[] = L"shutdown.type"; +const char kShutdownType[] = "shutdown.type"; // Number of processes that were open when the user shut down. -const wchar_t kShutdownNumProcesses[] = L"shutdown.num_processes"; +const char kShutdownNumProcesses[] = "shutdown.num_processes"; // Number of processes that were shut down using the slow path. -const wchar_t kShutdownNumProcessesSlow[] = L"shutdown.num_processes_slow"; +const char kShutdownNumProcessesSlow[] = "shutdown.num_processes_slow"; // Whether to restart the current Chrome session automatically as the last thing // before shutting everything down. -const wchar_t kRestartLastSessionOnShutdown[] = - L"restart.last.session.on.shutdown"; +const char kRestartLastSessionOnShutdown[] = "restart.last.session.on.shutdown"; // Number of bookmarks/folders on the bookmark bar/other bookmark folder. -const wchar_t kNumBookmarksOnBookmarkBar[] = - L"user_experience_metrics.num_bookmarks_on_bookmark_bar"; -const wchar_t kNumFoldersOnBookmarkBar[] = - L"user_experience_metrics.num_folders_on_bookmark_bar"; -const wchar_t kNumBookmarksInOtherBookmarkFolder[] = - L"user_experience_metrics.num_bookmarks_in_other_bookmark_folder"; -const wchar_t kNumFoldersInOtherBookmarkFolder[] = - L"user_experience_metrics.num_folders_in_other_bookmark_folder"; +const char kNumBookmarksOnBookmarkBar[] = + "user_experience_metrics.num_bookmarks_on_bookmark_bar"; +const char kNumFoldersOnBookmarkBar[] = + "user_experience_metrics.num_folders_on_bookmark_bar"; +const char kNumBookmarksInOtherBookmarkFolder[] = + "user_experience_metrics.num_bookmarks_in_other_bookmark_folder"; +const char kNumFoldersInOtherBookmarkFolder[] = + "user_experience_metrics.num_folders_in_other_bookmark_folder"; // Number of keywords. -const wchar_t kNumKeywords[] = L"user_experience_metrics.num_keywords"; +const char kNumKeywords[] = "user_experience_metrics.num_keywords"; // Placeholder preference for disabling voice / video chat if it is ever added. // Currently, this does not change any behavior. -const wchar_t kDisableVideoAndChat[] = L"disable_video_chat"; +const char kDisableVideoAndChat[] = "disable_video_chat"; // Whether Extensions are enabled. -const wchar_t kDisableExtensions[] = L"extensions.disabled"; +const char kDisableExtensions[] = "extensions.disabled"; // Boolean which specifies whether the Extension Shelf is visible on all tabs. -const wchar_t kShowExtensionShelf[] = L"extensions.shelf.show_on_all_tabs"; +const char kShowExtensionShelf[] = "extensions.shelf.show_on_all_tabs"; // Integer boolean representing the width (in pixels) of the container for // browser actions. -const wchar_t kBrowserActionContainerWidth[] = - L"extensions.browseractions.container.width"; +const char kBrowserActionContainerWidth[] = + "extensions.browseractions.container.width"; // Time of the last, and next scheduled, extensions auto-update checks. -const wchar_t kLastExtensionsUpdateCheck[] = - L"extensions.autoupdate.last_check"; -const wchar_t kNextExtensionsUpdateCheck[] = - L"extensions.autoupdate.next_check"; +const char kLastExtensionsUpdateCheck[] = "extensions.autoupdate.last_check"; +const char kNextExtensionsUpdateCheck[] = "extensions.autoupdate.next_check"; // Version number of last blacklist check -const wchar_t kExtensionBlacklistUpdateVersion[] = - L"extensions.blacklistupdate.version"; +const char kExtensionBlacklistUpdateVersion[] = + "extensions.blacklistupdate.version"; // New Tab Page URLs that should not be shown as most visited thumbnails. -const wchar_t kNTPMostVisitedURLsBlacklist[] = L"ntp.most_visited_blacklist"; +const char kNTPMostVisitedURLsBlacklist[] = "ntp.most_visited_blacklist"; // The URLs that have been pinned to the Most Visited section of the New Tab // Page. -const wchar_t kNTPMostVisitedPinnedURLs[] = L"ntp.pinned_urls"; +const char kNTPMostVisitedPinnedURLs[] = "ntp.pinned_urls"; // Data downloaded from resource pages (JSON, RSS) to be displayed in the // recommendations portion of the NTP. -const wchar_t kNTPTipsCache[] = L"ntp.tips_cache"; +const char kNTPTipsCache[] = "ntp.tips_cache"; // Last time of update of tips_cache. -const wchar_t kNTPTipsCacheUpdate[] = L"ntp.tips_cache_update"; +const char kNTPTipsCacheUpdate[] = "ntp.tips_cache_update"; // Last server used to fill tips_cache. -const wchar_t kNTPTipsServer[] = L"ntp.tips_server"; +const char kNTPTipsServer[] = "ntp.tips_server"; // Which sections should be visible on the new tab page // 1 - Show the most visited sites in a grid @@ -856,99 +834,97 @@ const wchar_t kNTPTipsServer[] = L"ntp.tips_server"; // 4 - Show the recent section // 8 - Show tips // 16 - show sync status -const wchar_t kNTPShownSections[] = L"ntp.shown_sections"; +const char kNTPShownSections[] = "ntp.shown_sections"; // This pref is used for migrating the prefs for the NTP -const wchar_t kNTPPrefVersion[] = L"ntp.pref_version"; +const char kNTPPrefVersion[] = "ntp.pref_version"; // A boolean specifying whether dev tools window should be opened docked. -const wchar_t kDevToolsOpenDocked[] = L"devtools.open_docked"; +const char kDevToolsOpenDocked[] = "devtools.open_docked"; // Integer location of the split bar in the browser view. -const wchar_t kDevToolsSplitLocation[] = L"devtools.split_location"; +const char kDevToolsSplitLocation[] = "devtools.split_location"; // 64-bit integer serialization of the base::Time when the last sync occurred. -const wchar_t kSyncLastSyncedTime[] = L"sync.last_synced_time"; +const char kSyncLastSyncedTime[] = "sync.last_synced_time"; // Boolean specifying whether the user finished setting up sync. -const wchar_t kSyncHasSetupCompleted[] = L"sync.has_setup_completed"; +const char kSyncHasSetupCompleted[] = "sync.has_setup_completed"; // Boolean specifying whether to automatically sync all data types (including // future ones, as they're added). If this is true, the following preferences // (kSyncBookmarks, kSyncPasswords, etc.) can all be ignored. -const wchar_t kKeepEverythingSynced[] = L"sync.keep_everything_synced"; +const char kKeepEverythingSynced[] = "sync.keep_everything_synced"; // Booleans specifying whether the user has selected to sync the following // datatypes. -const wchar_t kSyncBookmarks[] = L"sync.bookmarks"; -const wchar_t kSyncPasswords[] = L"sync.passwords"; -const wchar_t kSyncPreferences[] = L"sync.preferences"; -const wchar_t kSyncApps[] = L"sync.apps"; -const wchar_t kSyncAutofill[] = L"sync.autofill"; -const wchar_t kSyncThemes[] = L"sync.themes"; -const wchar_t kSyncTypedUrls[] = L"sync.typed_urls"; -const wchar_t kSyncExtensions[] = L"sync.extensions"; +const char kSyncBookmarks[] = "sync.bookmarks"; +const char kSyncPasswords[] = "sync.passwords"; +const char kSyncPreferences[] = "sync.preferences"; +const char kSyncApps[] = "sync.apps"; +const char kSyncAutofill[] = "sync.autofill"; +const char kSyncThemes[] = "sync.themes"; +const char kSyncTypedUrls[] = "sync.typed_urls"; +const char kSyncExtensions[] = "sync.extensions"; // Boolean used by enterprise configuration management in order to lock down // sync. -const wchar_t kSyncManaged[] = L"sync.managed"; +const char kSyncManaged[] = "sync.managed"; // Boolean to prevent sync from automatically starting up. This is // used when sync is disabled by the user via the privacy dashboard. -const wchar_t kSyncSuppressStart[] = L"sync.suppress_start"; +const char kSyncSuppressStart[] = "sync.suppress_start"; // Create web application shortcut dialog preferences. -const wchar_t kWebAppCreateOnDesktop[] = L"browser.web_app.create_on_desktop"; -const wchar_t kWebAppCreateInAppsMenu[] = - L"browser.web_app.create_in_apps_menu"; -const wchar_t kWebAppCreateInQuickLaunchBar[] = - L"browser.web_app.create_in_quick_launch_bar"; +const char kWebAppCreateOnDesktop[] = "browser.web_app.create_on_desktop"; +const char kWebAppCreateInAppsMenu[] = "browser.web_app.create_in_apps_menu"; +const char kWebAppCreateInQuickLaunchBar[] = + "browser.web_app.create_in_quick_launch_bar"; // Dictionary that maps Geolocation network provider server URLs to // corresponding access token. -const wchar_t kGeolocationAccessToken[] = L"geolocation.access_token"; +const char kGeolocationAccessToken[] = "geolocation.access_token"; // Whether PasswordForms have been migrated from the WedDataService to the // LoginDatabase. -const wchar_t kLoginDatabaseMigrated[] = L"login_database.migrated"; +const char kLoginDatabaseMigrated[] = "login_database.migrated"; // The root URL of the cloud print service. -const wchar_t kCloudPrintServiceURL[] = L"cloud_print.service_url"; +const char kCloudPrintServiceURL[] = "cloud_print.service_url"; // The list of BackgroundContents that should be loaded when the browser // launches. -const wchar_t kRegisteredBackgroundContents[] = - L"background_contents.registered"; +const char kRegisteredBackgroundContents[] = "background_contents.registered"; // *************** SERVICE PREFS *************** // These are attached to the service process. // The unique id for this instance of the cloud print proxy. -const wchar_t kCloudPrintProxyId[] = L"cloud_print.proxy_id"; +const char kCloudPrintProxyId[] = "cloud_print.proxy_id"; // The GAIA auth token for Cloud Print -const wchar_t kCloudPrintAuthToken[] = L"cloud_print.auth_token"; +const char kCloudPrintAuthToken[] = "cloud_print.auth_token"; // The GAIA auth token used by Cloud Print to authenticate with the XMPP server // This should eventually go away because the above token should work for both. -const wchar_t kCloudPrintXMPPAuthToken[] = L"cloud_print.xmpp_auth_token"; +const char kCloudPrintXMPPAuthToken[] = "cloud_print.xmpp_auth_token"; // The email address of the account used to authenticate with the Cloud Print // server. -extern const wchar_t kCloudPrintEmail[] = L"cloud_print.email"; +extern const char kCloudPrintEmail[] = "cloud_print.email"; // Settings specific to underlying print system. -extern const wchar_t kCloudPrintPrintSystemSettings[] = - L"cloud_print.print_system_settings"; +extern const char kCloudPrintPrintSystemSettings[] = + "cloud_print.print_system_settings"; // Boolean to disable proxy altogether. If true, other proxy // preferences are ignored. -const wchar_t kNoProxyServer[] = L"proxy.disabled"; +const char kNoProxyServer[] = "proxy.disabled"; // Boolean specifying if proxy should be auto-detected. -const wchar_t kProxyAutoDetect[] = L"proxy.auto_detect"; +const char kProxyAutoDetect[] = "proxy.auto_detect"; // String specifying the proxy server. For a specification of the expected // syntax see net::ProxyConfig::ProxyRules::ParseFromString(). -const wchar_t kProxyServer[] = L"proxy.server"; +const char kProxyServer[] = "proxy.server"; // URL to the proxy .pac file. -const wchar_t kProxyPacUrl[] = L"proxy.pac_url"; +const char kProxyPacUrl[] = "proxy.pac_url"; // String containing proxy bypass rules. For a specification of the // expected syntax see net::ProxyBypassRules::ParseFromString(). -const wchar_t kProxyBypassList[] = L"proxy.bypass_list"; +const char kProxyBypassList[] = "proxy.bypass_list"; } // namespace prefs diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index a522c34..c77bf26 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -13,343 +13,343 @@ namespace prefs { // Profile prefs -extern const wchar_t kHomePageIsNewTabPage[]; -extern const wchar_t kHomePage[]; -extern const wchar_t kSessionExitedCleanly[]; -extern const wchar_t kRestoreOnStartup[]; -extern const wchar_t kURLsToRestoreOnStartup[]; -extern const wchar_t kApplicationLocale[]; -extern const wchar_t kDefaultCharset[]; -extern const wchar_t kAcceptLanguages[]; -extern const wchar_t kStaticEncodings[]; -extern const wchar_t kPopupWhitelistedHosts[]; -extern const wchar_t kShowBookmarkBar[]; -extern const wchar_t kWebKitStandardFontIsSerif[]; -extern const wchar_t kWebKitFixedFontFamily[]; -extern const wchar_t kWebKitSerifFontFamily[]; -extern const wchar_t kWebKitSansSerifFontFamily[]; -extern const wchar_t kWebKitCursiveFontFamily[]; -extern const wchar_t kWebKitFantasyFontFamily[]; -extern const wchar_t kWebKitDefaultFontSize[]; -extern const wchar_t kWebKitDefaultFixedFontSize[]; -extern const wchar_t kWebKitMinimumFontSize[]; -extern const wchar_t kWebKitMinimumLogicalFontSize[]; -extern const wchar_t kWebKitJavascriptEnabled[]; -extern const wchar_t kWebKitWebSecurityEnabled[]; -extern const wchar_t kWebKitJavascriptCanOpenWindowsAutomatically[]; -extern const wchar_t kWebKitLoadsImagesAutomatically[]; -extern const wchar_t kWebKitPluginsEnabled[]; -extern const wchar_t kWebKitDomPasteEnabled[]; -extern const wchar_t kWebKitShrinksStandaloneImagesToFit[]; -extern const wchar_t kWebKitInspectorSettings[]; -extern const wchar_t kWebKitUsesUniversalDetector[]; -extern const wchar_t kWebKitTextAreasAreResizable[]; -extern const wchar_t kWebKitJavaEnabled[]; -extern const wchar_t kWebkitTabsToLinks[]; -extern const wchar_t kPasswordManagerEnabled[]; -extern const wchar_t kFormAutofillEnabled[]; // OBSOLETE -extern const wchar_t kSafeBrowsingEnabled[]; -extern const wchar_t kSearchSuggestEnabled[]; -extern const wchar_t kCookieBehavior[]; // OBSOLETE -extern const wchar_t kDefaultSearchProviderSearchURL[]; -extern const wchar_t kDefaultSearchProviderSuggestURL[]; -extern const wchar_t kDefaultSearchProviderName[]; -extern const wchar_t kDefaultSearchProviderID[]; -extern const wchar_t kDefaultSearchProviderPrepopulateID[]; -extern const wchar_t kSearchProviderOverrides[]; -extern const wchar_t kSearchProviderOverridesVersion[]; -extern const wchar_t kPromptForDownload[]; -extern const wchar_t kAlternateErrorPagesEnabled[]; -extern const wchar_t kDnsPrefetchingEnabled[]; -extern const wchar_t kDnsStartupPrefetchList[]; -extern const wchar_t kDnsHostReferralList[]; -extern const wchar_t kCookiePromptExpanded[]; +extern const char kHomePageIsNewTabPage[]; +extern const char kHomePage[]; +extern const char kSessionExitedCleanly[]; +extern const char kRestoreOnStartup[]; +extern const char kURLsToRestoreOnStartup[]; +extern const char kApplicationLocale[]; +extern const char kDefaultCharset[]; +extern const char kAcceptLanguages[]; +extern const char kStaticEncodings[]; +extern const char kPopupWhitelistedHosts[]; +extern const char kShowBookmarkBar[]; +extern const char kWebKitStandardFontIsSerif[]; +extern const char kWebKitFixedFontFamily[]; +extern const char kWebKitSerifFontFamily[]; +extern const char kWebKitSansSerifFontFamily[]; +extern const char kWebKitCursiveFontFamily[]; +extern const char kWebKitFantasyFontFamily[]; +extern const char kWebKitDefaultFontSize[]; +extern const char kWebKitDefaultFixedFontSize[]; +extern const char kWebKitMinimumFontSize[]; +extern const char kWebKitMinimumLogicalFontSize[]; +extern const char kWebKitJavascriptEnabled[]; +extern const char kWebKitWebSecurityEnabled[]; +extern const char kWebKitJavascriptCanOpenWindowsAutomatically[]; +extern const char kWebKitLoadsImagesAutomatically[]; +extern const char kWebKitPluginsEnabled[]; +extern const char kWebKitDomPasteEnabled[]; +extern const char kWebKitShrinksStandaloneImagesToFit[]; +extern const char kWebKitInspectorSettings[]; +extern const char kWebKitUsesUniversalDetector[]; +extern const char kWebKitTextAreasAreResizable[]; +extern const char kWebKitJavaEnabled[]; +extern const char kWebkitTabsToLinks[]; +extern const char kPasswordManagerEnabled[]; +extern const char kFormAutofillEnabled[]; // OBSOLETE +extern const char kSafeBrowsingEnabled[]; +extern const char kSearchSuggestEnabled[]; +extern const char kCookieBehavior[]; // OBSOLETE +extern const char kDefaultSearchProviderSearchURL[]; +extern const char kDefaultSearchProviderSuggestURL[]; +extern const char kDefaultSearchProviderName[]; +extern const char kDefaultSearchProviderID[]; +extern const char kDefaultSearchProviderPrepopulateID[]; +extern const char kSearchProviderOverrides[]; +extern const char kSearchProviderOverridesVersion[]; +extern const char kPromptForDownload[]; +extern const char kAlternateErrorPagesEnabled[]; +extern const char kDnsPrefetchingEnabled[]; +extern const char kDnsStartupPrefetchList[]; +extern const char kDnsHostReferralList[]; +extern const char kCookiePromptExpanded[]; #if defined(USE_NSS) -extern const wchar_t kCertRevocationCheckingEnabled[]; -extern const wchar_t kSSL2Enabled[]; -extern const wchar_t kSSL3Enabled[]; -extern const wchar_t kTLS1Enabled[]; +extern const char kCertRevocationCheckingEnabled[]; +extern const char kSSL2Enabled[]; +extern const char kSSL3Enabled[]; +extern const char kTLS1Enabled[]; #endif #if defined(OS_CHROMEOS) -extern const wchar_t kTapToClickEnabled[]; -extern const wchar_t kVertEdgeScrollEnabled[]; -extern const wchar_t kTouchpadSpeedFactor[]; -extern const wchar_t kTouchpadSensitivity[]; -extern const wchar_t kLanguageCurrentInputMethod[]; -extern const wchar_t kLanguagePreviousInputMethod[]; -extern const wchar_t kLanguageHotkeyNextEngineInMenu[]; -extern const wchar_t kLanguageHotkeyPreviousEngine[]; -extern const wchar_t kLanguagePreferredLanguages[]; -extern const wchar_t kLanguagePreloadEngines[]; -extern const wchar_t kLanguageChewingAutoShiftCur[]; -extern const wchar_t kLanguageChewingAddPhraseDirection[]; -extern const wchar_t kLanguageChewingEasySymbolInput[]; -extern const wchar_t kLanguageChewingEscCleanAllBuf[]; -extern const wchar_t kLanguageChewingForceLowercaseEnglish[]; -extern const wchar_t kLanguageChewingPlainZhuyin[]; -extern const wchar_t kLanguageChewingPhraseChoiceRearward[]; -extern const wchar_t kLanguageChewingSpaceAsSelection[]; -extern const wchar_t kLanguageChewingMaxChiSymbolLen[]; -extern const wchar_t kLanguageChewingCandPerPage[]; -extern const wchar_t kLanguageChewingKeyboardType[]; -extern const wchar_t kLanguageChewingSelKeys[]; -extern const wchar_t kLanguageChewingHsuSelKeyType[]; -extern const wchar_t kLanguageHangulKeyboard[]; -extern const wchar_t kLanguageHangulHanjaKeys[]; -extern const wchar_t kLanguagePinyinCorrectPinyin[]; -extern const wchar_t kLanguagePinyinFuzzyPinyin[]; -extern const wchar_t kLanguagePinyinLookupTablePageSize[]; -extern const wchar_t kLanguagePinyinShiftSelectCandidate[]; -extern const wchar_t kLanguagePinyinMinusEqualPage[]; -extern const wchar_t kLanguagePinyinCommaPeriodPage[]; -extern const wchar_t kLanguagePinyinAutoCommit[]; -extern const wchar_t kLanguagePinyinDoublePinyin[]; -extern const wchar_t kLanguagePinyinDoublePinyinSchema[]; -extern const wchar_t kLanguagePinyinInitChinese[]; -extern const wchar_t kLanguagePinyinInitFull[]; -extern const wchar_t kLanguagePinyinInitFullPunct[]; -extern const wchar_t kLanguagePinyinInitSimplifiedChinese[]; -extern const wchar_t kLanguagePinyinTradCandidate[]; -extern const wchar_t kLanguageMozcPreeditMethod[]; -extern const wchar_t kLanguageMozcSessionKeymap[]; -extern const wchar_t kLanguageMozcPunctuationMethod[]; -extern const wchar_t kLanguageMozcSymbolMethod[]; -extern const wchar_t kLanguageMozcSpaceCharacterForm[]; -extern const wchar_t kLanguageMozcHistoryLearningLevel[]; -extern const wchar_t kLanguageMozcSelectionShortcut[]; -extern const wchar_t kLanguageMozcShiftKeyModeSwitch[]; -extern const wchar_t kLanguageMozcNumpadCharacterForm[]; -extern const wchar_t kLanguageMozcIncognitoMode[]; -extern const wchar_t kLanguageMozcUseAutoImeTurnOff[]; -extern const wchar_t kLanguageMozcUseDateConversion[]; -extern const wchar_t kLanguageMozcUseSingleKanjiConversion[]; -extern const wchar_t kLanguageMozcUseSymbolConversion[]; -extern const wchar_t kLanguageMozcUseNumberConversion[]; -extern const wchar_t kLanguageMozcUseHistorySuggest[]; -extern const wchar_t kLanguageMozcUseDictionarySuggest[]; -extern const wchar_t kLanguageMozcSuggestionsSize[]; -extern const wchar_t kLanguageXkbModifierRemap[]; -extern const wchar_t kAccessibilityEnabled[]; -extern const wchar_t kLabsAdvancedFilesystemEnabled[]; -extern const wchar_t kLabsMediaplayerEnabled[]; +extern const char kTapToClickEnabled[]; +extern const char kVertEdgeScrollEnabled[]; +extern const char kTouchpadSpeedFactor[]; +extern const char kTouchpadSensitivity[]; +extern const char kLanguageCurrentInputMethod[]; +extern const char kLanguagePreviousInputMethod[]; +extern const char kLanguageHotkeyNextEngineInMenu[]; +extern const char kLanguageHotkeyPreviousEngine[]; +extern const char kLanguagePreferredLanguages[]; +extern const char kLanguagePreloadEngines[]; +extern const char kLanguageChewingAutoShiftCur[]; +extern const char kLanguageChewingAddPhraseDirection[]; +extern const char kLanguageChewingEasySymbolInput[]; +extern const char kLanguageChewingEscCleanAllBuf[]; +extern const char kLanguageChewingForceLowercaseEnglish[]; +extern const char kLanguageChewingPlainZhuyin[]; +extern const char kLanguageChewingPhraseChoiceRearward[]; +extern const char kLanguageChewingSpaceAsSelection[]; +extern const char kLanguageChewingMaxChiSymbolLen[]; +extern const char kLanguageChewingCandPerPage[]; +extern const char kLanguageChewingKeyboardType[]; +extern const char kLanguageChewingSelKeys[]; +extern const char kLanguageChewingHsuSelKeyType[]; +extern const char kLanguageHangulKeyboard[]; +extern const char kLanguageHangulHanjaKeys[]; +extern const char kLanguagePinyinCorrectPinyin[]; +extern const char kLanguagePinyinFuzzyPinyin[]; +extern const char kLanguagePinyinLookupTablePageSize[]; +extern const char kLanguagePinyinShiftSelectCandidate[]; +extern const char kLanguagePinyinMinusEqualPage[]; +extern const char kLanguagePinyinCommaPeriodPage[]; +extern const char kLanguagePinyinAutoCommit[]; +extern const char kLanguagePinyinDoublePinyin[]; +extern const char kLanguagePinyinDoublePinyinSchema[]; +extern const char kLanguagePinyinInitChinese[]; +extern const char kLanguagePinyinInitFull[]; +extern const char kLanguagePinyinInitFullPunct[]; +extern const char kLanguagePinyinInitSimplifiedChinese[]; +extern const char kLanguagePinyinTradCandidate[]; +extern const char kLanguageMozcPreeditMethod[]; +extern const char kLanguageMozcSessionKeymap[]; +extern const char kLanguageMozcPunctuationMethod[]; +extern const char kLanguageMozcSymbolMethod[]; +extern const char kLanguageMozcSpaceCharacterForm[]; +extern const char kLanguageMozcHistoryLearningLevel[]; +extern const char kLanguageMozcSelectionShortcut[]; +extern const char kLanguageMozcShiftKeyModeSwitch[]; +extern const char kLanguageMozcNumpadCharacterForm[]; +extern const char kLanguageMozcIncognitoMode[]; +extern const char kLanguageMozcUseAutoImeTurnOff[]; +extern const char kLanguageMozcUseDateConversion[]; +extern const char kLanguageMozcUseSingleKanjiConversion[]; +extern const char kLanguageMozcUseSymbolConversion[]; +extern const char kLanguageMozcUseNumberConversion[]; +extern const char kLanguageMozcUseHistorySuggest[]; +extern const char kLanguageMozcUseDictionarySuggest[]; +extern const char kLanguageMozcSuggestionsSize[]; +extern const char kLanguageXkbModifierRemap[]; +extern const char kAccessibilityEnabled[]; +extern const char kLabsAdvancedFilesystemEnabled[]; +extern const char kLabsMediaplayerEnabled[]; #endif -extern const wchar_t kIpcDisabledMessages[]; -extern const wchar_t kShowHomeButton[]; -extern const wchar_t kShowPageOptionsButtons[]; -extern const wchar_t kRecentlySelectedEncoding[]; -extern const wchar_t kDeleteBrowsingHistory[]; -extern const wchar_t kDeleteDownloadHistory[]; -extern const wchar_t kDeleteCache[]; -extern const wchar_t kDeleteCookies[]; -extern const wchar_t kDeletePasswords[]; -extern const wchar_t kDeleteFormData[]; -extern const wchar_t kEnableSpellCheck[]; -extern const wchar_t kEnableAutoSpellCorrect[]; -extern const wchar_t kDeleteTimePeriod[]; -extern const wchar_t kPrintingPageHeaderLeft[]; -extern const wchar_t kPrintingPageHeaderCenter[]; -extern const wchar_t kPrintingPageHeaderRight[]; -extern const wchar_t kPrintingPageFooterLeft[]; -extern const wchar_t kPrintingPageFooterCenter[]; -extern const wchar_t kPrintingPageFooterRight[]; +extern const char kIpcDisabledMessages[]; +extern const char kShowHomeButton[]; +extern const char kShowPageOptionsButtons[]; +extern const char kRecentlySelectedEncoding[]; +extern const char kDeleteBrowsingHistory[]; +extern const char kDeleteDownloadHistory[]; +extern const char kDeleteCache[]; +extern const char kDeleteCookies[]; +extern const char kDeletePasswords[]; +extern const char kDeleteFormData[]; +extern const char kEnableSpellCheck[]; +extern const char kEnableAutoSpellCorrect[]; +extern const char kDeleteTimePeriod[]; +extern const char kPrintingPageHeaderLeft[]; +extern const char kPrintingPageHeaderCenter[]; +extern const char kPrintingPageHeaderRight[]; +extern const char kPrintingPageFooterLeft[]; +extern const char kPrintingPageFooterCenter[]; +extern const char kPrintingPageFooterRight[]; #if defined(TOOLKIT_USES_GTK) -extern const wchar_t kUsesSystemTheme[]; +extern const char kUsesSystemTheme[]; #endif -extern const wchar_t kCurrentThemePackFilename[]; -extern const wchar_t kCurrentThemeID[]; -extern const wchar_t kCurrentThemeImages[]; -extern const wchar_t kCurrentThemeColors[]; -extern const wchar_t kCurrentThemeTints[]; -extern const wchar_t kCurrentThemeDisplayProperties[]; -extern const wchar_t kExtensionsUIDeveloperMode[]; -extern const wchar_t kExtensionToolbarSize[]; -extern const wchar_t kPluginsLastInternalDirectory[]; -extern const wchar_t kPluginsPluginsList[]; -extern const wchar_t kPluginsPluginsBlacklist[]; -extern const wchar_t kPluginsEnabledInternalPDF[]; -extern const wchar_t kCheckDefaultBrowser[]; +extern const char kCurrentThemePackFilename[]; +extern const char kCurrentThemeID[]; +extern const char kCurrentThemeImages[]; +extern const char kCurrentThemeColors[]; +extern const char kCurrentThemeTints[]; +extern const char kCurrentThemeDisplayProperties[]; +extern const char kExtensionsUIDeveloperMode[]; +extern const char kExtensionToolbarSize[]; +extern const char kPluginsLastInternalDirectory[]; +extern const char kPluginsPluginsList[]; +extern const char kPluginsPluginsBlacklist[]; +extern const char kPluginsEnabledInternalPDF[]; +extern const char kCheckDefaultBrowser[]; #if defined(OS_MACOSX) -extern const wchar_t kShowUpdatePromotionInfoBar[]; +extern const char kShowUpdatePromotionInfoBar[]; #endif -extern const wchar_t kUseCustomChromeFrame[]; -extern const wchar_t kShowOmniboxSearchHint[]; -extern const wchar_t kDesktopNotificationDefaultContentSetting[]; -extern const wchar_t kDesktopNotificationAllowedOrigins[]; -extern const wchar_t kDesktopNotificationDeniedOrigins[]; -extern const wchar_t kDefaultContentSettings[]; -extern const wchar_t kPerHostContentSettings[]; // OBSOLETE -extern const wchar_t kContentSettingsVersion[]; -extern const wchar_t kContentSettingsPatterns[]; -extern const wchar_t kBlockThirdPartyCookies[]; -extern const wchar_t kClearSiteDataOnExit[]; -extern const wchar_t kPerHostZoomLevels[]; -extern const wchar_t kAutoFillEnabled[]; -extern const wchar_t kAutoFillAuxiliaryProfilesEnabled[]; -extern const wchar_t kAutoFillDialogPlacement[]; -extern const wchar_t kAutoFillPositiveUploadRate[]; -extern const wchar_t kAutoFillNegativeUploadRate[]; - -extern const wchar_t kUseVerticalTabs[]; -extern const wchar_t kEnableTranslate[]; -extern const wchar_t kPinnedTabs[]; +extern const char kUseCustomChromeFrame[]; +extern const char kShowOmniboxSearchHint[]; +extern const char kDesktopNotificationDefaultContentSetting[]; +extern const char kDesktopNotificationAllowedOrigins[]; +extern const char kDesktopNotificationDeniedOrigins[]; +extern const char kDefaultContentSettings[]; +extern const char kPerHostContentSettings[]; // OBSOLETE +extern const char kContentSettingsVersion[]; +extern const char kContentSettingsPatterns[]; +extern const char kBlockThirdPartyCookies[]; +extern const char kClearSiteDataOnExit[]; +extern const char kPerHostZoomLevels[]; +extern const char kAutoFillEnabled[]; +extern const char kAutoFillAuxiliaryProfilesEnabled[]; +extern const char kAutoFillDialogPlacement[]; +extern const char kAutoFillPositiveUploadRate[]; +extern const char kAutoFillNegativeUploadRate[]; + +extern const char kUseVerticalTabs[]; +extern const char kEnableTranslate[]; +extern const char kPinnedTabs[]; // Local state -extern const wchar_t kMetricsClientID[]; -extern const wchar_t kMetricsSessionID[]; -extern const wchar_t kMetricsClientIDTimestamp[]; -extern const wchar_t kMetricsReportingEnabled[]; -extern const wchar_t kMetricsInitialLogs[]; -extern const wchar_t kMetricsOngoingLogs[]; +extern const char kMetricsClientID[]; +extern const char kMetricsSessionID[]; +extern const char kMetricsClientIDTimestamp[]; +extern const char kMetricsReportingEnabled[]; +extern const char kMetricsInitialLogs[]; +extern const char kMetricsOngoingLogs[]; -extern const wchar_t kProfileMetrics[]; -extern const wchar_t kProfilePrefix[]; - -extern const wchar_t kStabilityExitedCleanly[]; -extern const wchar_t kStabilityStatsVersion[]; -extern const wchar_t kStabilityStatsBuildTime[]; -extern const wchar_t kStabilitySessionEndCompleted[]; -extern const wchar_t kStabilityLaunchCount[]; -extern const wchar_t kStabilityCrashCount[]; -extern const wchar_t kStabilityIncompleteSessionEndCount[]; -extern const wchar_t kStabilityPageLoadCount[]; -extern const wchar_t kStabilityRendererCrashCount[]; -extern const wchar_t kStabilityExtensionRendererCrashCount[]; -extern const wchar_t kStabilityLaunchTimeSec[]; -extern const wchar_t kStabilityLastTimestampSec[]; -extern const wchar_t kStabilityRendererHangCount[]; -extern const wchar_t kStabilityChildProcessCrashCount[]; - -extern const wchar_t kStabilityBreakpadRegistrationSuccess[]; -extern const wchar_t kStabilityBreakpadRegistrationFail[]; -extern const wchar_t kStabilityDebuggerPresent[]; -extern const wchar_t kStabilityDebuggerNotPresent[]; - -extern const wchar_t kStabilityPluginStats[]; -extern const wchar_t kStabilityPluginName[]; -extern const wchar_t kStabilityPluginLaunches[]; -extern const wchar_t kStabilityPluginInstances[]; -extern const wchar_t kStabilityPluginCrashes[]; - -extern const wchar_t kUninstallMetricsPageLoadCount[]; -extern const wchar_t kUninstallLaunchCount[]; - -extern const wchar_t kUninstallMetricsInstallDate[]; -extern const wchar_t kUninstallMetricsUptimeSec[]; -extern const wchar_t kUninstallLastLaunchTimeSec[]; -extern const wchar_t kUninstallLastObservedRunTimeSec[]; - -extern const wchar_t kBrowserWindowPlacement[]; -extern const wchar_t kTaskManagerWindowPlacement[]; -extern const wchar_t kPageInfoWindowPlacement[]; -extern const wchar_t kKeywordEditorWindowPlacement[]; -extern const wchar_t kPreferencesWindowPlacement[]; -extern const wchar_t kMemoryCacheSize[]; - -extern const wchar_t kDownloadDefaultDirectory[]; -extern const wchar_t kDownloadExtensionsToOpen[]; -extern const wchar_t kDownloadDirUpgraded[]; - -extern const wchar_t kSaveFileDefaultDirectory[]; - -extern const wchar_t kSelectFileLastDirectory[]; - -extern const wchar_t kHungPluginDetectFrequency[]; -extern const wchar_t kPluginMessageResponseTimeout[]; - -extern const wchar_t kSpellCheckDictionary[]; - -extern const wchar_t kExcludedSchemes[]; - -extern const wchar_t kSafeBrowsingClientKey[]; -extern const wchar_t kSafeBrowsingWrappedKey[]; - -extern const wchar_t kOptionsWindowLastTabIndex[]; -extern const wchar_t kContentSettingsWindowLastTabIndex[]; -extern const wchar_t kCertificateManagerWindowLastTabIndex[]; -extern const wchar_t kShouldShowFirstRunBubble[]; -extern const wchar_t kShouldUseOEMFirstRunBubble[]; -extern const wchar_t kShouldUseMinimalFirstRunBubble[]; -extern const wchar_t kShouldShowWelcomePage[]; - -extern const wchar_t kLastKnownGoogleURL[]; -extern const wchar_t kLastKnownIntranetRedirectOrigin[]; - -extern const wchar_t kCountryIDAtInstall[]; -extern const wchar_t kGeoIDAtInstall[]; // OBSOLETE - -extern const wchar_t kShutdownType[]; -extern const wchar_t kShutdownNumProcesses[]; -extern const wchar_t kShutdownNumProcessesSlow[]; - -extern const wchar_t kRestartLastSessionOnShutdown[]; - -extern const wchar_t kNumBookmarksOnBookmarkBar[]; -extern const wchar_t kNumFoldersOnBookmarkBar[]; -extern const wchar_t kNumBookmarksInOtherBookmarkFolder[]; -extern const wchar_t kNumFoldersInOtherBookmarkFolder[]; - -extern const wchar_t kNumKeywords[]; - -extern const wchar_t kDisableVideoAndChat[]; - -extern const wchar_t kDisableExtensions[]; -extern const wchar_t kShowExtensionShelf[]; -extern const wchar_t kBrowserActionContainerWidth[]; - -extern const wchar_t kLastExtensionsUpdateCheck[]; -extern const wchar_t kNextExtensionsUpdateCheck[]; - -extern const wchar_t kExtensionBlacklistUpdateVersion[]; - -extern const wchar_t kNTPMostVisitedURLsBlacklist[]; -extern const wchar_t kNTPMostVisitedPinnedURLs[]; -extern const wchar_t kNTPTipsCache[]; -extern const wchar_t kNTPTipsCacheUpdate[]; -extern const wchar_t kNTPTipsServer[]; -extern const wchar_t kNTPShownSections[]; -extern const wchar_t kNTPPrefVersion[]; - -extern const wchar_t kDevToolsOpenDocked[]; -extern const wchar_t kDevToolsSplitLocation[]; - -extern const wchar_t kSyncLastSyncedTime[]; -extern const wchar_t kSyncHasSetupCompleted[]; -extern const wchar_t kKeepEverythingSynced[]; -extern const wchar_t kSyncBookmarks[]; -extern const wchar_t kSyncPasswords[]; -extern const wchar_t kSyncPreferences[]; -extern const wchar_t kSyncApps[]; -extern const wchar_t kSyncAutofill[]; -extern const wchar_t kSyncThemes[]; -extern const wchar_t kSyncTypedUrls[]; -extern const wchar_t kSyncExtensions[]; -extern const wchar_t kSyncManaged[]; -extern const wchar_t kSyncSuppressStart[]; - -extern const wchar_t kWebAppCreateOnDesktop[]; -extern const wchar_t kWebAppCreateInAppsMenu[]; -extern const wchar_t kWebAppCreateInQuickLaunchBar[]; +extern const char kProfileMetrics[]; +extern const char kProfilePrefix[]; + +extern const char kStabilityExitedCleanly[]; +extern const char kStabilityStatsVersion[]; +extern const char kStabilityStatsBuildTime[]; +extern const char kStabilitySessionEndCompleted[]; +extern const char kStabilityLaunchCount[]; +extern const char kStabilityCrashCount[]; +extern const char kStabilityIncompleteSessionEndCount[]; +extern const char kStabilityPageLoadCount[]; +extern const char kStabilityRendererCrashCount[]; +extern const char kStabilityExtensionRendererCrashCount[]; +extern const char kStabilityLaunchTimeSec[]; +extern const char kStabilityLastTimestampSec[]; +extern const char kStabilityRendererHangCount[]; +extern const char kStabilityChildProcessCrashCount[]; + +extern const char kStabilityBreakpadRegistrationSuccess[]; +extern const char kStabilityBreakpadRegistrationFail[]; +extern const char kStabilityDebuggerPresent[]; +extern const char kStabilityDebuggerNotPresent[]; + +extern const char kStabilityPluginStats[]; +extern const char kStabilityPluginName[]; +extern const char kStabilityPluginLaunches[]; +extern const char kStabilityPluginInstances[]; +extern const char kStabilityPluginCrashes[]; + +extern const char kUninstallMetricsPageLoadCount[]; +extern const char kUninstallLaunchCount[]; + +extern const char kUninstallMetricsInstallDate[]; +extern const char kUninstallMetricsUptimeSec[]; +extern const char kUninstallLastLaunchTimeSec[]; +extern const char kUninstallLastObservedRunTimeSec[]; + +extern const char kBrowserWindowPlacement[]; +extern const char kTaskManagerWindowPlacement[]; +extern const char kPageInfoWindowPlacement[]; +extern const char kKeywordEditorWindowPlacement[]; +extern const char kPreferencesWindowPlacement[]; +extern const char kMemoryCacheSize[]; + +extern const char kDownloadDefaultDirectory[]; +extern const char kDownloadExtensionsToOpen[]; +extern const char kDownloadDirUpgraded[]; + +extern const char kSaveFileDefaultDirectory[]; + +extern const char kSelectFileLastDirectory[]; + +extern const char kHungPluginDetectFrequency[]; +extern const char kPluginMessageResponseTimeout[]; + +extern const char kSpellCheckDictionary[]; + +extern const char kExcludedSchemes[]; + +extern const char kSafeBrowsingClientKey[]; +extern const char kSafeBrowsingWrappedKey[]; + +extern const char kOptionsWindowLastTabIndex[]; +extern const char kContentSettingsWindowLastTabIndex[]; +extern const char kCertificateManagerWindowLastTabIndex[]; +extern const char kShouldShowFirstRunBubble[]; +extern const char kShouldUseOEMFirstRunBubble[]; +extern const char kShouldUseMinimalFirstRunBubble[]; +extern const char kShouldShowWelcomePage[]; + +extern const char kLastKnownGoogleURL[]; +extern const char kLastKnownIntranetRedirectOrigin[]; + +extern const char kCountryIDAtInstall[]; +extern const char kGeoIDAtInstall[]; // OBSOLETE + +extern const char kShutdownType[]; +extern const char kShutdownNumProcesses[]; +extern const char kShutdownNumProcessesSlow[]; + +extern const char kRestartLastSessionOnShutdown[]; + +extern const char kNumBookmarksOnBookmarkBar[]; +extern const char kNumFoldersOnBookmarkBar[]; +extern const char kNumBookmarksInOtherBookmarkFolder[]; +extern const char kNumFoldersInOtherBookmarkFolder[]; + +extern const char kNumKeywords[]; + +extern const char kDisableVideoAndChat[]; + +extern const char kDisableExtensions[]; +extern const char kShowExtensionShelf[]; +extern const char kBrowserActionContainerWidth[]; + +extern const char kLastExtensionsUpdateCheck[]; +extern const char kNextExtensionsUpdateCheck[]; + +extern const char kExtensionBlacklistUpdateVersion[]; + +extern const char kNTPMostVisitedURLsBlacklist[]; +extern const char kNTPMostVisitedPinnedURLs[]; +extern const char kNTPTipsCache[]; +extern const char kNTPTipsCacheUpdate[]; +extern const char kNTPTipsServer[]; +extern const char kNTPShownSections[]; +extern const char kNTPPrefVersion[]; + +extern const char kDevToolsOpenDocked[]; +extern const char kDevToolsSplitLocation[]; + +extern const char kSyncLastSyncedTime[]; +extern const char kSyncHasSetupCompleted[]; +extern const char kKeepEverythingSynced[]; +extern const char kSyncBookmarks[]; +extern const char kSyncPasswords[]; +extern const char kSyncPreferences[]; +extern const char kSyncApps[]; +extern const char kSyncAutofill[]; +extern const char kSyncThemes[]; +extern const char kSyncTypedUrls[]; +extern const char kSyncExtensions[]; +extern const char kSyncManaged[]; +extern const char kSyncSuppressStart[]; + +extern const char kWebAppCreateOnDesktop[]; +extern const char kWebAppCreateInAppsMenu[]; +extern const char kWebAppCreateInQuickLaunchBar[]; -extern const wchar_t kGeolocationAccessToken[]; -extern const wchar_t kGeolocationDefaultContentSetting[]; -extern const wchar_t kGeolocationContentSettings[]; - -extern const wchar_t kLoginDatabaseMigrated[]; +extern const char kGeolocationAccessToken[]; +extern const char kGeolocationDefaultContentSetting[]; +extern const char kGeolocationContentSettings[]; + +extern const char kLoginDatabaseMigrated[]; -extern const wchar_t kCloudPrintServiceURL[]; -extern const wchar_t kCloudPrintProxyId[]; -extern const wchar_t kCloudPrintAuthToken[]; -extern const wchar_t kCloudPrintXMPPAuthToken[]; -extern const wchar_t kCloudPrintEmail[]; -extern const wchar_t kCloudPrintPrintSystemSettings[]; +extern const char kCloudPrintServiceURL[]; +extern const char kCloudPrintProxyId[]; +extern const char kCloudPrintAuthToken[]; +extern const char kCloudPrintXMPPAuthToken[]; +extern const char kCloudPrintEmail[]; +extern const char kCloudPrintPrintSystemSettings[]; -extern const wchar_t kNoProxyServer[]; -extern const wchar_t kProxyAutoDetect[]; -extern const wchar_t kProxyServer[]; -extern const wchar_t kProxyPacUrl[]; -extern const wchar_t kProxyBypassList[]; +extern const char kNoProxyServer[]; +extern const char kProxyAutoDetect[]; +extern const char kProxyServer[]; +extern const char kProxyPacUrl[]; +extern const char kProxyBypassList[]; -extern const wchar_t kRegisteredBackgroundContents[]; +extern const char kRegisteredBackgroundContents[]; } // namespace prefs diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 65555c3..8e30bbc 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -812,7 +812,7 @@ IPC_BEGIN_MESSAGES(Automation) // This messages sets an int-value preference. IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetIntPreference, int /* browser handle */, - std::wstring /* pref name */, + std::string /* pref name */, int /* value */, bool /* success */) @@ -831,21 +831,21 @@ IPC_BEGIN_MESSAGES(Automation) // This messages sets a string-value preference. IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetStringPreference, int /* browser handle */, - std::wstring /* pref name */, + std::string /* pref name */, std::string /* pref value */, bool) // This messages gets a boolean-value preference. IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_GetBooleanPreference, int /* browser handle */, - std::wstring /* pref name */, + std::string /* pref name */, bool /* success */, bool /* pref value */) // This messages sets a boolean-value preference. IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetBooleanPreference, int /* browser handle */, - std::wstring /* pref name */, + std::string /* pref name */, bool /* pref value */, bool /* success */) diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 41795e6..df3929a 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -400,7 +400,7 @@ bool BrowserProxy::SetShelfVisible(bool is_visible) { is_visible)); } -bool BrowserProxy::SetIntPreference(const std::wstring& name, int value) { +bool BrowserProxy::SetIntPreference(const std::string& name, int value) { if (!is_valid()) return false; @@ -411,7 +411,7 @@ bool BrowserProxy::SetIntPreference(const std::wstring& name, int value) { return result; } -bool BrowserProxy::SetStringPreference(const std::wstring& name, +bool BrowserProxy::SetStringPreference(const std::string& name, const std::string& value) { if (!is_valid()) return false; @@ -423,7 +423,7 @@ bool BrowserProxy::SetStringPreference(const std::wstring& name, return result; } -bool BrowserProxy::GetBooleanPreference(const std::wstring& name, +bool BrowserProxy::GetBooleanPreference(const std::string& name, bool* value) { if (!is_valid()) return false; @@ -435,7 +435,7 @@ bool BrowserProxy::GetBooleanPreference(const std::wstring& name, return result; } -bool BrowserProxy::SetBooleanPreference(const std::wstring& name, +bool BrowserProxy::SetBooleanPreference(const std::string& name, bool value) { if (!is_valid()) return false; @@ -620,7 +620,7 @@ bool BrowserProxy::GetInitialLoadTimes(float* min_start_time, DictionaryValue* values_dict = static_cast<DictionaryValue*>(values.get()); Value* tabs_value; - if (!values_dict->Get(L"tabs", &tabs_value) || + if (!values_dict->Get("tabs", &tabs_value) || tabs_value->GetType() != Value::TYPE_LIST) return false; @@ -638,11 +638,11 @@ bool BrowserProxy::GetInitialLoadTimes(float* min_start_time, tab_dict = static_cast<DictionaryValue*>(tab_value); double temp; - if (!tab_dict->GetReal(L"load_start_ms", &temp)) + if (!tab_dict->GetReal("load_start_ms", &temp)) return false; start_ms = static_cast<float>(temp); // load_stop_ms can only be null if WaitForInitialLoads did not run. - if (!tab_dict->GetReal(L"load_stop_ms", &temp)) + if (!tab_dict->GetReal("load_stop_ms", &temp)) return false; stop_ms = static_cast<float>(temp); diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index 70fd140..7dd2671 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -181,18 +181,18 @@ class BrowserProxy : public AutomationResourceProxy { bool SetShelfVisible(bool is_visible) WARN_UNUSED_RESULT; // Sets the int value of the specified preference. - bool SetIntPreference(const std::wstring& name, int value) WARN_UNUSED_RESULT; + bool SetIntPreference(const std::string& name, int value) WARN_UNUSED_RESULT; // Sets the string value of the specified preference. - bool SetStringPreference(const std::wstring& name, + bool SetStringPreference(const std::string& name, const std::string& value) WARN_UNUSED_RESULT; // Gets the boolean value of the specified preference. - bool GetBooleanPreference(const std::wstring& name, + bool GetBooleanPreference(const std::string& name, bool* value) WARN_UNUSED_RESULT; // Sets the boolean value of the specified preference. - bool SetBooleanPreference(const std::wstring& name, + bool SetBooleanPreference(const std::string& name, bool value) WARN_UNUSED_RESULT; // Sets default content settings. diff --git a/chrome/test/testing_pref_service.cc b/chrome/test/testing_pref_service.cc index 067b8b9..81d04e8 100644 --- a/chrome/test/testing_pref_service.cc +++ b/chrome/test/testing_pref_service.cc @@ -28,45 +28,45 @@ TestingPrefService::TestingPrefService() NULL)) { } -const Value* TestingPrefService::GetManagedPref(const wchar_t* path) { +const Value* TestingPrefService::GetManagedPref(const char* path) { return GetPref(managed_prefs_, path); } -void TestingPrefService::SetManagedPref(const wchar_t* path, Value* value) { +void TestingPrefService::SetManagedPref(const char* path, Value* value) { SetPref(managed_prefs_, path, value); } -void TestingPrefService::RemoveManagedPref(const wchar_t* path) { +void TestingPrefService::RemoveManagedPref(const char* path) { RemovePref(managed_prefs_, path); } -const Value* TestingPrefService::GetUserPref(const wchar_t* path) { +const Value* TestingPrefService::GetUserPref(const char* path) { return GetPref(user_prefs_, path); } -void TestingPrefService::SetUserPref(const wchar_t* path, Value* value) { +void TestingPrefService::SetUserPref(const char* path, Value* value) { SetPref(user_prefs_, path, value); } -void TestingPrefService::RemoveUserPref(const wchar_t* path) { +void TestingPrefService::RemoveUserPref(const char* path) { RemovePref(user_prefs_, path); } const Value* TestingPrefService::GetPref(PrefStore* pref_store, - const wchar_t* path) { + const char* path) { Value* result; return pref_store->prefs()->Get(path, &result) ? result : NULL; } void TestingPrefService::SetPref(PrefStore* pref_store, - const wchar_t* path, + const char* path, Value* value) { pref_store->prefs()->Set(path, value); FireObservers(path); } void TestingPrefService::RemovePref(PrefStore* pref_store, - const wchar_t* path) { + const char* path) { pref_store->prefs()->Remove(path, NULL); FireObservers(path); } diff --git a/chrome/test/testing_pref_service.h b/chrome/test/testing_pref_service.h index d407ad2..b719c91 100644 --- a/chrome/test/testing_pref_service.h +++ b/chrome/test/testing_pref_service.h @@ -30,31 +30,31 @@ class TestingPrefService : public PrefService { // Read the value of a preference from the managed layer. Returns NULL if the // preference is not defined at the managed layer. - const Value* GetManagedPref(const wchar_t* path); + const Value* GetManagedPref(const char* path); // Set a preference on the managed layer and fire observers if the preference // changed. Assumes ownership of |value|. - void SetManagedPref(const wchar_t* path, Value* value); + void SetManagedPref(const char* path, Value* value); // Clear the preference on the managed layer and fire observers if the // preference has been defined previously. - void RemoveManagedPref(const wchar_t* path); + void RemoveManagedPref(const char* path); // Similar to the above, but for user preferences. - const Value* GetUserPref(const wchar_t* path); - void SetUserPref(const wchar_t* path, Value* value); - void RemoveUserPref(const wchar_t* path); + const Value* GetUserPref(const char* path); + void SetUserPref(const char* path, Value* value); + void RemoveUserPref(const char* path); private: // Reads the value of the preference indicated by |path| from |pref_store|. // Returns NULL if the preference was not found. - const Value* GetPref(PrefStore* pref_store, const wchar_t* path); + const Value* GetPref(PrefStore* pref_store, const char* path); // Sets the value for |path| in |pref_store|. - void SetPref(PrefStore* pref_store, const wchar_t* path, Value* value); + void SetPref(PrefStore* pref_store, const char* path, Value* value); // Removes the preference identified by |path| from |pref_store|. - void RemovePref(PrefStore* pref_store, const wchar_t* path); + void RemovePref(PrefStore* pref_store, const char* path); // Pointers to the pref stores our value store uses. PrefStore* managed_prefs_; |