OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_LANGUAGE_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LANGUAGE_LIBRARY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LANGUAGE_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LANGUAGE_LIBRARY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // This gets the singleton LanguageLibrary | 28 // This gets the singleton LanguageLibrary |
29 static LanguageLibrary* Get(); | 29 static LanguageLibrary* Get(); |
30 | 30 |
31 // Makes sure the library is loaded, loading it if necessary. Returns true if | 31 // Makes sure the library is loaded, loading it if necessary. Returns true if |
32 // the library has been successfully loaded. | 32 // the library has been successfully loaded. |
33 static bool EnsureLoaded(); | 33 static bool EnsureLoaded(); |
34 | 34 |
35 void AddObserver(Observer* observer); | 35 void AddObserver(Observer* observer); |
36 void RemoveObserver(Observer* observer); | 36 void RemoveObserver(Observer* observer); |
37 | 37 |
38 // Returns the list of IMEs and keyboard layouts we can select. If the cros | 38 // Returns the list of IMEs and keyboard layouts we can select |
39 // library is not found or IBus/DBus daemon is not alive, this function | 39 // (i.e. active). If the cros library is not found or IBus/DBus daemon |
40 // returns a fallback language list (and never returns NULL). | 40 // is not alive, this function returns a fallback language list (and |
| 41 // never returns NULL). |
41 InputLanguageList* GetLanguages(); | 42 InputLanguageList* GetLanguages(); |
42 | 43 |
| 44 // Returns the list of IMEs and keyboard layouts we support, including |
| 45 // ones not active. If the cros library is not found or IBus/DBus |
| 46 // daemon is not alive, this function returns a fallback language list |
| 47 // (and never returns NULL). |
| 48 InputLanguageList* GetSupportedLanguages(); |
| 49 |
43 // Changes the current IME engine to |id| and enable IME (when |category| | 50 // Changes the current IME engine to |id| and enable IME (when |category| |
44 // is LANGUAGE_CATEGORY_IME). Changes the current XKB layout to |id| and | 51 // is LANGUAGE_CATEGORY_IME). Changes the current XKB layout to |id| and |
45 // disable IME (when |category| is LANGUAGE_CATEGORY_XKB). |id| is a unique | 52 // disable IME (when |category| is LANGUAGE_CATEGORY_XKB). |id| is a unique |
46 // identifier of a IME engine or XKB layout. Please check chromeos_language.h | 53 // identifier of a IME engine or XKB layout. Please check chromeos_language.h |
47 // in src third_party/cros/ for details. | 54 // in src third_party/cros/ for details. |
48 void ChangeLanguage(LanguageCategory category, const std::string& id); | 55 void ChangeLanguage(LanguageCategory category, const std::string& id); |
49 | 56 |
| 57 // Activates the language specified by |category| and |id|. Returns true |
| 58 // on success. |
| 59 bool ActivateLanguage(LanguageCategory category, const std::string& id); |
| 60 |
| 61 // Dectivates the language specified by |category| and |id|. Returns |
| 62 // true on success. |
| 63 bool DeactivateLanguage(LanguageCategory category, const std::string& id); |
| 64 |
50 const InputLanguage& current_language() const { | 65 const InputLanguage& current_language() const { |
51 return current_language_; | 66 return current_language_; |
52 } | 67 } |
53 | 68 |
54 private: | 69 private: |
55 friend struct DefaultSingletonTraits<LanguageLibrary>; | 70 friend struct DefaultSingletonTraits<LanguageLibrary>; |
56 | 71 |
57 LanguageLibrary(); | 72 LanguageLibrary(); |
58 ~LanguageLibrary(); | 73 ~LanguageLibrary(); |
59 | 74 |
(...skipping 17 matching lines...) Expand all Loading... |
77 // The language (IME or XKB layout) which currently selected. | 92 // The language (IME or XKB layout) which currently selected. |
78 InputLanguage current_language_; | 93 InputLanguage current_language_; |
79 | 94 |
80 DISALLOW_COPY_AND_ASSIGN(LanguageLibrary); | 95 DISALLOW_COPY_AND_ASSIGN(LanguageLibrary); |
81 }; | 96 }; |
82 | 97 |
83 } // namespace chromeos | 98 } // namespace chromeos |
84 | 99 |
85 #endif // CHROME_BROWSER_CHROMEOS_LANGUAGE_LIBRARY_H_ | 100 #endif // CHROME_BROWSER_CHROMEOS_LANGUAGE_LIBRARY_H_ |
86 | 101 |
OLD | NEW |