summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/language_library.cc28
-rw-r--r--chrome/browser/chromeos/language_library.h21
2 files changed, 46 insertions, 3 deletions
diff --git a/chrome/browser/chromeos/language_library.cc b/chrome/browser/chromeos/language_library.cc
index 7db0a2b..fcb0604 100644
--- a/chrome/browser/chromeos/language_library.cc
+++ b/chrome/browser/chromeos/language_library.cc
@@ -60,6 +60,14 @@ chromeos::InputLanguageList* LanguageLibrary::GetLanguages() {
return result ? result : CreateFallbackInputLanguageList();
}
+chromeos::InputLanguageList* LanguageLibrary::GetSupportedLanguages() {
+ chromeos::InputLanguageList* result = NULL;
+ if (EnsureLoaded()) {
+ result = chromeos::GetSupportedLanguages(language_status_connection_);
+ }
+ return result ? result : CreateFallbackInputLanguageList();
+}
+
void LanguageLibrary::ChangeLanguage(
LanguageCategory category, const std::string& id) {
if (EnsureLoaded()) {
@@ -67,6 +75,26 @@ void LanguageLibrary::ChangeLanguage(
}
}
+bool LanguageLibrary::ActivateLanguage(
+ LanguageCategory category, const std::string& id) {
+ bool success = false;
+ if (EnsureLoaded()) {
+ success = chromeos::ActivateLanguage(language_status_connection_,
+ category, id.c_str());
+ }
+ return success;
+}
+
+bool LanguageLibrary::DeactivateLanguage(
+ LanguageCategory category, const std::string& id) {
+ bool success = false;
+ if (EnsureLoaded()) {
+ success = chromeos::DeactivateLanguage(language_status_connection_,
+ category, id.c_str());
+ }
+ return success;
+}
+
// static
void LanguageLibrary::LanguageChangedHandler(
void* object, const chromeos::InputLanguage& current_language) {
diff --git a/chrome/browser/chromeos/language_library.h b/chrome/browser/chromeos/language_library.h
index e79d159..88c197c 100644
--- a/chrome/browser/chromeos/language_library.h
+++ b/chrome/browser/chromeos/language_library.h
@@ -35,11 +35,18 @@ class LanguageLibrary {
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
- // Returns the list of IMEs and keyboard layouts we can select. If the cros
- // library is not found or IBus/DBus daemon is not alive, this function
- // returns a fallback language list (and never returns NULL).
+ // Returns the list of IMEs and keyboard layouts we can select
+ // (i.e. active). If the cros library is not found or IBus/DBus daemon
+ // is not alive, this function returns a fallback language list (and
+ // never returns NULL).
InputLanguageList* GetLanguages();
+ // Returns the list of IMEs and keyboard layouts we support, including
+ // ones not active. If the cros library is not found or IBus/DBus
+ // daemon is not alive, this function returns a fallback language list
+ // (and never returns NULL).
+ InputLanguageList* GetSupportedLanguages();
+
// Changes the current IME engine to |id| and enable IME (when |category|
// is LANGUAGE_CATEGORY_IME). Changes the current XKB layout to |id| and
// disable IME (when |category| is LANGUAGE_CATEGORY_XKB). |id| is a unique
@@ -47,6 +54,14 @@ class LanguageLibrary {
// in src third_party/cros/ for details.
void ChangeLanguage(LanguageCategory category, const std::string& id);
+ // Activates the language specified by |category| and |id|. Returns true
+ // on success.
+ bool ActivateLanguage(LanguageCategory category, const std::string& id);
+
+ // Dectivates the language specified by |category| and |id|. Returns
+ // true on success.
+ bool DeactivateLanguage(LanguageCategory category, const std::string& id);
+
const InputLanguage& current_language() const {
return current_language_;
}