diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 03:02:51 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 03:02:51 +0000 |
commit | 57ecc4bf4069cb869e5fb0a7d922eec2384bac25 (patch) | |
tree | 1b4668fa59d6b6a072144b4ddab8d5f6faba3fa4 /chrome/browser/chromeos | |
parent | 1af19cfd7b1ef9924516dbe811db495315feaefe (diff) | |
download | chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.zip chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.tar.gz chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.tar.bz2 |
Make prefs use std::string for keys rather than wstrings.
Much remains to be converted.
BUG=23581
TEST=builds and passes tests
Review URL: http://codereview.chromium.org/3076037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r-- | chrome/browser/chromeos/cros_settings.cc | 26 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros_settings.h | 24 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros_settings_names.cc | 12 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros_settings_names.h | 10 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros_settings_provider.h | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros_settings_provider_user.cc | 8 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros_settings_provider_user.h | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/language_preferences.h | 10 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/system_page_view.cc | 14 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.cc | 4 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.h | 2 |
13 files changed, 67 insertions, 67 deletions
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. |