| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // OptionsPageView overrides. | 67 // OptionsPageView overrides. |
| 68 virtual void InitControlLayout(); | 68 virtual void InitControlLayout(); |
| 69 | 69 |
| 70 // NotificationObserver overrides. | 70 // NotificationObserver overrides. |
| 71 virtual void Observe(NotificationType type, | 71 virtual void Observe(NotificationType type, |
| 72 const NotificationSource& source, | 72 const NotificationSource& source, |
| 73 const NotificationDetails& details); | 73 const NotificationDetails& details); |
| 74 | 74 |
| 75 // Gets the list of supported language codes like "en" and "ja". | 75 // Gets the list of supported language codes like "en" and "ja". |
| 76 void GetSupportedLangageCodes( | 76 void GetSupportedLanguageCodes( |
| 77 std::vector<std::string>* out_language_codes) const; | 77 std::vector<std::string>* out_language_codes) const; |
| 78 | 78 |
| 79 // Rewrites the language name and returns the modified version if | 79 // Rewrites the language name and returns the modified version if |
| 80 // necessary. Otherwise, returns the given language name as is. | 80 // necessary. Otherwise, returns the given language name as is. |
| 81 // In particular, this rewrites the special language name used for input | 81 // In particular, this rewrites the special language name used for input |
| 82 // methods that don't fall under any other languages. | 82 // methods that don't fall under any other languages. |
| 83 static std::wstring MaybeRewriteLanguageName( | 83 static std::wstring MaybeRewriteLanguageName( |
| 84 const std::wstring& language_name); | 84 const std::wstring& language_name); |
| 85 | 85 |
| 86 // Normalizes the language code and returns the normalized version. |
| 87 // The function concverts a two-letter language code to its |
| 88 // corresponding three-letter code like "ja" => "jpn". Otherwise, |
| 89 // returns the given language code as-is. |
| 90 static std::string NormalizeLanguageCode( |
| 91 const std::string& language_code); |
| 92 |
| 86 private: | 93 private: |
| 87 // Initializes the input method config view. | 94 // Initializes the input method config view. |
| 88 void InitInputMethodConfigViewMap(); | 95 void InitInputMethodConfigViewMap(); |
| 89 | 96 |
| 90 // Initialize id_to_{code,display_name}_map_ member variables. | 97 // Initialize id_to_{code,display_name}_map_ member variables. |
| 91 void InitLanguageIdMaps(); | 98 void InitLanguageIdMaps(); |
| 92 | 99 |
| 93 // Creates the contents on the left, including the language table. | 100 // Creates the contents on the left, including the language table. |
| 94 views::View* CreateContentsOnLeft(); | 101 views::View* CreateContentsOnLeft(); |
| 95 | 102 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 107 // Activates or deactivates an IME whose ID is |language_id|. | 114 // Activates or deactivates an IME whose ID is |language_id|. |
| 108 void SetLanguageActivated(const std::string& language_id, bool activated); | 115 void SetLanguageActivated(const std::string& language_id, bool activated); |
| 109 | 116 |
| 110 // Returns true if an IME of |language_id| is activated. | 117 // Returns true if an IME of |language_id| is activated. |
| 111 bool LanguageIsActivated(const std::string& language_id); | 118 bool LanguageIsActivated(const std::string& language_id); |
| 112 | 119 |
| 113 // Gets the list of active IME IDs like "pinyin" and "m17n:ar:kbd". | 120 // Gets the list of active IME IDs like "pinyin" and "m17n:ar:kbd". |
| 114 void GetActiveLanguageIDs(std::vector<std::string>* out_language_ids); | 121 void GetActiveLanguageIDs(std::vector<std::string>* out_language_ids); |
| 115 | 122 |
| 116 // Gets the list of supported IME IDs like "pinyin" and "m17n:ar:kbd". | 123 // Gets the list of supported IME IDs like "pinyin" and "m17n:ar:kbd". |
| 117 void GetSupportedLangageIDs(std::vector<std::string>* out_language_ids) const; | 124 void GetSupportedLanguageIDs( |
| 125 std::vector<std::string>* out_language_ids) const; |
| 118 | 126 |
| 119 // Converts a language ID to a language code of the IME. Returns "" when | 127 // Converts a language ID to a language code of the IME. Returns "" when |
| 120 // |language_id| is unknown. | 128 // |language_id| is unknown. |
| 121 // Example: "hangul" => "ko" | 129 // Example: "hangul" => "ko" |
| 122 std::string GetLanguageCodeFromID(const std::string& language_id) const; | 130 std::string GetLanguageCodeFromID(const std::string& language_id) const; |
| 123 | 131 |
| 124 // Converts a language ID to a display name of the IME. Returns "" when | 132 // Converts a language ID to a display name of the IME. Returns "" when |
| 125 // |language_id| is unknown. | 133 // |language_id| is unknown. |
| 126 // Examples: "pinyin" => "Pinyin" | 134 // Examples: "pinyin" => "Pinyin" |
| 127 // "m17n:ar:kbd" => "kbd (m17n)" | 135 // "m17n:ar:kbd" => "kbd (m17n)" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 154 StringPrefMember preload_engines_; | 162 StringPrefMember preload_engines_; |
| 155 std::map<std::string, std::string> id_to_language_code_map_; | 163 std::map<std::string, std::string> id_to_language_code_map_; |
| 156 std::map<std::string, std::string> id_to_display_name_map_; | 164 std::map<std::string, std::string> id_to_display_name_map_; |
| 157 | 165 |
| 158 DISALLOW_COPY_AND_ASSIGN(LanguageConfigView); | 166 DISALLOW_COPY_AND_ASSIGN(LanguageConfigView); |
| 159 }; | 167 }; |
| 160 | 168 |
| 161 } // namespace chromeos | 169 } // namespace chromeos |
| 162 | 170 |
| 163 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ | 171 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ |
| OLD | NEW |