diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 15:48:12 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 15:48:12 +0000 |
commit | 76525924c371057161ee6ca4990ea8879a5bae2c (patch) | |
tree | 67d4b8f545b803239bf141ec5a1802fcfdd843b3 /chrome/browser | |
parent | caa36c602fbfc9347f2f0efe94220a836b588d5c (diff) | |
download | chromium_src-76525924c371057161ee6ca4990ea8879a5bae2c.zip chromium_src-76525924c371057161ee6ca4990ea8879a5bae2c.tar.gz chromium_src-76525924c371057161ee6ca4990ea8879a5bae2c.tar.bz2 |
Revert 43475 - Adding "preload_engines" and "use_global_engine" preferences to Chrome side.
BUG=crosbug.com/488
TEST=none
Review URL: http://codereview.chromium.org/1546010
TBR=yusukes@chromium.org
Review URL: http://codereview.chromium.org/1520012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43481 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/chromeos/language_preferences.h | 3 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.cc | 49 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.h | 19 |
3 files changed, 2 insertions, 69 deletions
diff --git a/chrome/browser/chromeos/language_preferences.h b/chrome/browser/chromeos/language_preferences.h index a98986b..3fee2e3 100644 --- a/chrome/browser/chromeos/language_preferences.h +++ b/chrome/browser/chromeos/language_preferences.h @@ -22,9 +22,6 @@ const struct HangulKeyboardNameIDPair { }; // For ibus-daemon -// TODO(yusukes): replace "USA" with "xkb:..." when ibus-xkb-layout gets ready. -const wchar_t kDefaultPreloadEngine[] = L"USA"; - // For Simplified Chinese IME (ibus-pinyin) // For Traditional Chinese IME (ibus-chewing) // For Japanese IME (ibus-google-japanese-input) diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 6009748..043e6c3 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -19,8 +19,6 @@ namespace { // Section and config names for the IBus configuration daemon. -const char kGeneralSectionName[] = "general"; -const char kUseGlobalEngineConfigName[] = "use_global_engine"; const char kHangulSectionName[] = "engine/Hangul"; const char kHangulKeyboardConfigName[] = "HangulKeyboard"; @@ -35,9 +33,6 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kVertEdgeScrollEnabled, false); prefs->RegisterIntegerPref(prefs::kTouchpadSpeedFactor, 5); prefs->RegisterIntegerPref(prefs::kTouchpadSensitivity, 5); - prefs->RegisterBooleanPref(prefs::kLanguageUseGlobalEngine, true); - prefs->RegisterStringPref(prefs::kLanguagePreloadEngines, - kDefaultPreloadEngine); prefs->RegisterStringPref(prefs::kLanguageHangulKeyboard, kHangulKeyboardNameIDPairs[0].keyboard_id); } @@ -48,9 +43,6 @@ void Preferences::Init(PrefService* prefs) { vert_edge_scroll_enabled_.Init(prefs::kVertEdgeScrollEnabled, prefs, this); speed_factor_.Init(prefs::kTouchpadSpeedFactor, prefs, this); sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); - language_use_global_engine_.Init( - prefs::kLanguageUseGlobalEngine, prefs, this); - language_preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, this); language_hangul_keyboard_.Init(prefs::kLanguageHangulKeyboard, prefs, this); // Initialize touchpad settings to what's saved in user preferences. @@ -83,11 +75,6 @@ void Preferences::NotifyPrefChanged(const std::wstring* pref_name) { CrosLibrary::Get()->GetSynapticsLibrary()->SetRangeParameter( PARAM_RANGE_TOUCH_SENSITIVITY, sensitivity_.GetValue()); - if (!pref_name || *pref_name == prefs::kLanguageUseGlobalEngine) - SetLanguageConfigBoolean(kGeneralSectionName, kUseGlobalEngineConfigName, - language_use_global_engine_.GetValue()); - if (!pref_name || *pref_name == prefs::kLanguagePreloadEngines) - SetPreloadEngines(language_preload_engines_.GetValue()); if (!pref_name || *pref_name == prefs::kLanguageHangulKeyboard) SetLanguageConfigString(kHangulSectionName, kHangulKeyboardConfigName, language_hangul_keyboard_.GetValue()); @@ -99,15 +86,6 @@ void Preferences::SetTimeZone(const std::wstring& id) { icu::TimeZone::adoptDefault(timezone); } -void Preferences::SetLanguageConfigBoolean(const char* section, - const char* name, - bool value) { - ImeConfigValue config; - config.type = ImeConfigValue::kValueTypeBool; - config.bool_value = value; - CrosLibrary::Get()->GetLanguageLibrary()->SetImeConfig(section, name, config); -} - void Preferences::SetLanguageConfigString(const char* section, const char* name, const std::wstring& value) { @@ -117,31 +95,4 @@ void Preferences::SetLanguageConfigString(const char* section, CrosLibrary::Get()->GetLanguageLibrary()->SetImeConfig(section, name, config); } -void Preferences::SetPreloadEngines(const std::wstring& value) { - // TODO(yusukes): might be better to change the cros API signature so it - // could accept the comma separated |value| as-is. - - LanguageLibrary* library = CrosLibrary::Get()->GetLanguageLibrary(); - std::vector<std::wstring> engine_ids; - SplitString(value, L',', &engine_ids); - LOG(INFO) << "Setting preload_engines to '" << value << "'"; - - // Activate languages in |value|. - for (size_t i = 0; i < engine_ids.size(); ++i) { - library->SetLanguageActivated( - LANGUAGE_CATEGORY_IME, WideToUTF8(engine_ids[i]), true); - } - - // Deactivate languages that are currently active, but are not in |value|. - const std::set<std::wstring> id_set(engine_ids.begin(), engine_ids.end()); - scoped_ptr<InputLanguageList> active_engines(library->GetActiveLanguages()); - for (size_t i = 0; i < active_engines->size(); ++i) { - const InputLanguage& active_engine = active_engines->at(i); - if (id_set.count(UTF8ToWide(active_engine.id)) == 0) { - library->SetLanguageActivated( - active_engine.category, active_engine.id, false); - } - } -} - } // namespace chromeos diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h index d324e09..f4cb2e3 100644 --- a/chrome/browser/chromeos/preferences.h +++ b/chrome/browser/chromeos/preferences.h @@ -43,32 +43,17 @@ class Preferences : public NotificationObserver { private: void SetTimeZone(const std::wstring& id); - // Writes boolean |value| to the IME (IBus) configuration daemon. |section| - // (e.g. "general") and |name| (e.g. "use_global_engine") should not be NULL. - void SetLanguageConfigBoolean(const char* section, - const char* name, - bool value); - - // Writes stromg |value| to the IME (IBus) configuration daemon. |section| - // and |name| should not be NULL. + // Writes |value| to the IME (IBus) configuration daemon. |section| (e.g. + // "engine/Hangul") and |name| (e.g. "HangulKeyboard") should not be NULL. void SetLanguageConfigString(const char* section, const char* name, const std::wstring& value); - // Activates IMEs that are on |value|, which is a comma separated list of IME - // IDs (e.g. "xkb:en,pinyin,hangul,m17n:ar:kbd"), and deactivates all other - // IMEs that are currently active. |value| could be empty. In that case, this - // function deactivates all active IMEs. - void SetPreloadEngines(const std::wstring& value); - StringPrefMember timezone_; BooleanPrefMember tap_to_click_enabled_; BooleanPrefMember vert_edge_scroll_enabled_; IntegerPrefMember speed_factor_; IntegerPrefMember sensitivity_; - // Language (IME) preferences. - BooleanPrefMember language_use_global_engine_; - StringPrefMember language_preload_engines_; StringPrefMember language_hangul_keyboard_; DISALLOW_COPY_AND_ASSIGN(Preferences); |