diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 15:33:47 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 15:33:47 +0000 |
commit | 28e9e9a8bd3c8b312c154415d6320584690765b8 (patch) | |
tree | aab8fb0108a9235210c5acf641271d0077723890 /chrome | |
parent | 94cc41988303b41d2bfff0042a07697225e7b4d9 (diff) | |
download | chromium_src-28e9e9a8bd3c8b312c154415d6320584690765b8.zip chromium_src-28e9e9a8bd3c8b312c154415d6320584690765b8.tar.gz chromium_src-28e9e9a8bd3c8b312c154415d6320584690765b8.tar.bz2 |
Deprecate Activate/DeactivateImeProperty and Activate/DeactivateLanguage.
This is just code cleanup.
BUG=crosbug.com/2356.
TEST=manually confirmed the ime stuff works with chrome
Review URL: http://codereview.chromium.org/1570012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
4 files changed, 24 insertions, 34 deletions
diff --git a/chrome/browser/chromeos/cros/language_library.cc b/chrome/browser/chromeos/cros/language_library.cc index 232ac56..bc6d413 100644 --- a/chrome/browser/chromeos/cros/language_library.cc +++ b/chrome/browser/chromeos/cros/language_library.cc @@ -84,19 +84,12 @@ void LanguageLibraryImpl::ChangeLanguage( } } -void LanguageLibraryImpl::ActivateImeProperty(const std::string& key) { +void LanguageLibraryImpl::SetImePropertyActivated(const std::string& key, + bool activated) { DCHECK(!key.empty()); if (EnsureLoadedAndStarted()) { - chromeos::ActivateImeProperty( - language_status_connection_, key.c_str()); - } -} - -void LanguageLibraryImpl::DeactivateImeProperty(const std::string& key) { - DCHECK(!key.empty()); - if (EnsureLoadedAndStarted()) { - chromeos::DeactivateImeProperty( - language_status_connection_, key.c_str()); + chromeos::SetImePropertyActivated( + language_status_connection_, key.c_str(), activated); } } @@ -104,14 +97,8 @@ bool LanguageLibraryImpl::SetLanguageActivated( LanguageCategory category, const std::string& id, bool activated) { bool success = false; if (EnsureLoadedAndStarted()) { - // TODO(satorux): Add chromeos::SetLanguageActivated(). - if (activated) { - success = chromeos::ActivateLanguage(language_status_connection_, - category, id.c_str()); - } else { - success = chromeos::DeactivateLanguage(language_status_connection_, - category, id.c_str()); - } + success = chromeos::SetLanguageActivated(language_status_connection_, + category, id.c_str(), activated); } return success; } diff --git a/chrome/browser/chromeos/cros/language_library.h b/chrome/browser/chromeos/cros/language_library.h index 17340b7..0feb16b 100644 --- a/chrome/browser/chromeos/cros/language_library.h +++ b/chrome/browser/chromeos/cros/language_library.h @@ -49,13 +49,15 @@ class LanguageLibrary { virtual void ChangeLanguage(LanguageCategory category, const std::string& id) = 0; - // Activates an IME property identified by |key|. Examples of keys are: - // "InputMode.Katakana", "InputMode.HalfWidthKatakana", "TypingMode.Romaji", - // and "TypingMode.Kana." - virtual void ActivateImeProperty(const std::string& key) = 0; - - // Deactivates an IME property identified by |key|. - virtual void DeactivateImeProperty(const std::string& key) = 0; + // Sets whether the IME property specified by |key| is activated. If + // |activated| is true, activates the property. If |activate| is false, + // deactivates the property. Examples of keys: + // - "InputMode.Katakana" + // - "InputMode.HalfWidthKatakana" + // - "TypingMode.Romaji" + // - "TypingMode.Kana" + virtual void SetImePropertyActivated(const std::string& key, + bool activated) = 0; // Sets whether the language specified by |category| and |id| is // activated. If |activated| is true, activates the language. If @@ -104,8 +106,8 @@ class LanguageLibraryImpl : public LanguageLibrary { virtual InputLanguageList* GetActiveLanguages(); virtual InputLanguageList* GetSupportedLanguages(); virtual void ChangeLanguage(LanguageCategory category, const std::string& id); - virtual void ActivateImeProperty(const std::string& key); - virtual void DeactivateImeProperty(const std::string& key); + virtual void SetImePropertyActivated(const std::string& key, + bool activated); virtual bool SetLanguageActivated(LanguageCategory category, const std::string& id, bool activated); diff --git a/chrome/browser/chromeos/cros/mock_language_library.h b/chrome/browser/chromeos/cros/mock_language_library.h index b5d6cfc..bcc5f61 100644 --- a/chrome/browser/chromeos/cros/mock_language_library.h +++ b/chrome/browser/chromeos/cros/mock_language_library.h @@ -23,8 +23,7 @@ class MockLanguageLibrary : public LanguageLibrary { MOCK_METHOD0(GetActiveLanguages, InputLanguageList*(void)); MOCK_METHOD0(GetSupportedLanguages, InputLanguageList*(void)); MOCK_METHOD2(ChangeLanguage, void(LanguageCategory, const std::string&)); - MOCK_METHOD1(ActivateImeProperty, void(const std::string&)); - MOCK_METHOD1(DeactivateImeProperty, void(const std::string&)); + MOCK_METHOD2(SetImePropertyActivated, void(const std::string&, bool)); MOCK_METHOD3(SetLanguageActivated, bool(LanguageCategory, const std::string&, bool)); MOCK_METHOD2(LanguageIsActivated, diff --git a/chrome/browser/chromeos/status/language_menu_button.cc b/chrome/browser/chromeos/status/language_menu_button.cc index b7d70f1..85b3d9a 100644 --- a/chrome/browser/chromeos/status/language_menu_button.cc +++ b/chrome/browser/chromeos/status/language_menu_button.cc @@ -310,16 +310,18 @@ void LanguageMenuButton::ActivatedAt(int index) { // First, deactivate all other properties in the same radio group. for (int i = 0; i < static_cast<int>(property_list.size()); ++i) { if (i != index && id == property_list.at(i).selection_item_id) { - CrosLibrary::Get()->GetLanguageLibrary()->DeactivateImeProperty( - property_list.at(i).key); + CrosLibrary::Get()->GetLanguageLibrary()->SetImePropertyActivated( + property_list.at(i).key, false); } } // Then, activate the property clicked. - CrosLibrary::Get()->GetLanguageLibrary()->ActivateImeProperty(key); + CrosLibrary::Get()->GetLanguageLibrary()->SetImePropertyActivated(key, + true); } else { // Command button like "Switch to half punctuation mode" is clicked. // We can always use "Deactivate" for command buttons. - CrosLibrary::Get()->GetLanguageLibrary()->DeactivateImeProperty(key); + CrosLibrary::Get()->GetLanguageLibrary()->SetImePropertyActivated(key, + false); } return; } |