| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PREFERENCES_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <stddef.h> // For size_t | 9 #include <stddef.h> // For size_t |
| 10 | 10 |
| 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 |
| 11 // This file defines types and declare variables used in "Languages and | 13 // This file defines types and declare variables used in "Languages and |
| 12 // Input" settings in Chromium OS. | 14 // Input" settings in Chromium OS. |
| 13 namespace chromeos { | 15 namespace chromeos { |
| 14 namespace language_prefs { | 16 namespace language_prefs { |
| 15 | 17 |
| 16 // The struct is used for preferences consisting of multiple choices, like | 18 // The struct is used for preferences consisting of multiple choices, like |
| 17 // punctuation types used in Japanese input method. | 19 // punctuation types used in Japanese input method. |
| 18 template <typename DataType> | 20 template <typename DataType> |
| 19 struct LanguageMultipleChoicePreference { | 21 struct LanguageMultipleChoicePreference { |
| 20 const char* pref_name; // Chrome preference name. | 22 const char* pref_name; // Chrome preference name. |
| 21 DataType default_pref_value; | 23 DataType default_pref_value; |
| 22 const char* ibus_config_name; | 24 const char* ibus_config_name; |
| 23 // Currently we have 10 combobox items at most. | 25 // Currently we have 10 combobox items at most. |
| 24 static const size_t kMaxItems = 11; | 26 static const size_t kMaxItems = 11; |
| 25 struct { | 27 struct { |
| 26 DataType ibus_config_value; | 28 DataType ibus_config_value; |
| 27 int item_message_id; // Resource grd ID for the combobox item. | 29 int item_message_id; // Resource grd ID for the combobox item. |
| 28 } values_and_ids[kMaxItems]; | 30 } values_and_ids[kMaxItems]; |
| 29 int label_message_id; // Resource grd ID for the label. | 31 int label_message_id; // Resource grd ID for the label. |
| 32 PrefService::PrefSyncStatus sync_status; |
| 30 }; | 33 }; |
| 31 | 34 |
| 32 // The struct is used for preferences of boolean values, like switches to | 35 // The struct is used for preferences of boolean values, like switches to |
| 33 // enable or disable particular features. | 36 // enable or disable particular features. |
| 34 struct LanguageBooleanPrefs { | 37 struct LanguageBooleanPrefs { |
| 35 const char* pref_name; // Chrome preference name. | 38 const char* pref_name; // Chrome preference name. |
| 36 bool default_pref_value; | 39 bool default_pref_value; |
| 37 const char* ibus_config_name; | 40 const char* ibus_config_name; |
| 38 int message_id; | 41 int message_id; |
| 42 PrefService::PrefSyncStatus sync_status; |
| 39 }; | 43 }; |
| 40 | 44 |
| 41 // The struct is used for preferences of integer range values, like the | 45 // The struct is used for preferences of integer range values, like the |
| 42 // key repeat rate. | 46 // key repeat rate. |
| 43 struct LanguageIntegerRangePreference { | 47 struct LanguageIntegerRangePreference { |
| 44 const char* pref_name; // Chrome preference name. | 48 const char* pref_name; // Chrome preference name. |
| 45 int default_pref_value; | 49 int default_pref_value; |
| 46 int min_pref_value; | 50 int min_pref_value; |
| 47 int max_pref_value; | 51 int max_pref_value; |
| 48 const char* ibus_config_name; | 52 const char* ibus_config_name; |
| 49 int message_id; | 53 int message_id; |
| 54 PrefService::PrefSyncStatus sync_status; |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 // --------------------------------------------------------------------------- | 57 // --------------------------------------------------------------------------- |
| 53 // For ibus-daemon | 58 // For ibus-daemon |
| 54 // --------------------------------------------------------------------------- | 59 // --------------------------------------------------------------------------- |
| 55 extern const char kGeneralSectionName[]; | 60 extern const char kGeneralSectionName[]; |
| 56 extern const char kHotKeySectionName[]; | 61 extern const char kHotKeySectionName[]; |
| 57 extern const char kPreloadEnginesConfigName[]; | 62 extern const char kPreloadEnginesConfigName[]; |
| 58 extern const char kNextEngineInMenuConfigName[]; | 63 extern const char kNextEngineInMenuConfigName[]; |
| 59 extern const char kPreviousEngineConfigName[]; | 64 extern const char kPreviousEngineConfigName[]; |
| 60 extern const char kHotkeyNextEngineInMenu[]; | 65 extern const char kHotkeyNextEngineInMenu[]; |
| 61 extern const char kHotkeyPreviousEngine[]; | 66 extern const char kHotkeyPreviousEngine[]; |
| 62 | 67 |
| 63 // --------------------------------------------------------------------------- | 68 // --------------------------------------------------------------------------- |
| 64 // For Traditional Chinese input method (ibus-chewing) | 69 // For Traditional Chinese input method (ibus-mozc-chewing) |
| 65 // --------------------------------------------------------------------------- | 70 // --------------------------------------------------------------------------- |
| 66 extern const char kChewingSectionName[]; | 71 extern const char kChewingSectionName[]; |
| 67 | 72 |
| 68 extern const LanguageBooleanPrefs kChewingBooleanPrefs[]; | 73 extern const LanguageBooleanPrefs kChewingBooleanPrefs[]; |
| 69 // This is not ideal, but we should hard-code the number here as the value | 74 // This is not ideal, but we should hard-code the number here as the value |
| 70 // is referenced in other header files as array sizes. We have a | 75 // is referenced in other header files as array sizes. We have a |
| 71 // COMPILE_ASSERT in .cc to ensure that the number is correct. | 76 // COMPILE_ASSERT in .cc to ensure that the number is correct. |
| 72 const size_t kNumChewingBooleanPrefs = 8 - 2; // -2 is for crosbug.com/14185 | 77 const size_t kNumChewingBooleanPrefs = 8 - 2; // -2 is for crosbug.com/14185 |
| 73 | 78 |
| 74 extern const LanguageIntegerRangePreference kChewingIntegerPrefs[]; | 79 extern const LanguageIntegerRangePreference kChewingIntegerPrefs[]; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 extern const LanguageBooleanPrefs kPinyinBooleanPrefs[]; | 114 extern const LanguageBooleanPrefs kPinyinBooleanPrefs[]; |
| 110 // See comments at kNumChewingBooleanPrefs for why we hard-code this here. | 115 // See comments at kNumChewingBooleanPrefs for why we hard-code this here. |
| 111 const size_t kNumPinyinBooleanPrefs = 11; | 116 const size_t kNumPinyinBooleanPrefs = 11; |
| 112 | 117 |
| 113 extern const LanguageMultipleChoicePreference<int> kPinyinDoublePinyinSchema; | 118 extern const LanguageMultipleChoicePreference<int> kPinyinDoublePinyinSchema; |
| 114 | 119 |
| 115 struct PinyinIntegerPref { | 120 struct PinyinIntegerPref { |
| 116 const char* pref_name; // Chrome preference name. | 121 const char* pref_name; // Chrome preference name. |
| 117 int default_pref_value; | 122 int default_pref_value; |
| 118 const char* ibus_config_name; | 123 const char* ibus_config_name; |
| 124 PrefService::PrefSyncStatus sync_status; |
| 119 // TODO(yusukes): Add message_id if needed. | 125 // TODO(yusukes): Add message_id if needed. |
| 120 }; | 126 }; |
| 121 | 127 |
| 122 extern const PinyinIntegerPref kPinyinIntegerPrefs[]; | 128 extern const PinyinIntegerPref kPinyinIntegerPrefs[]; |
| 123 const size_t kNumPinyinIntegerPrefs = 1; | 129 const size_t kNumPinyinIntegerPrefs = 1; |
| 124 | 130 |
| 125 // --------------------------------------------------------------------------- | 131 // --------------------------------------------------------------------------- |
| 126 // For Japanese input method (ibus-mozc) | 132 // For Japanese input method (ibus-mozc) |
| 127 // --------------------------------------------------------------------------- | 133 // --------------------------------------------------------------------------- |
| 128 extern const char kMozcSectionName[]; | 134 extern const char kMozcSectionName[]; |
| 129 | 135 |
| 130 extern const LanguageBooleanPrefs kMozcBooleanPrefs[]; | 136 extern const LanguageBooleanPrefs kMozcBooleanPrefs[]; |
| 131 // See comments at kNumChewingBooleanPrefs for why we hard-code this here. | 137 // See comments at kNumChewingBooleanPrefs for why we hard-code this here. |
| 132 const size_t kNumMozcBooleanPrefs = 8; | 138 const size_t kNumMozcBooleanPrefs = 8; |
| 133 | 139 |
| 134 extern const LanguageMultipleChoicePreference<const char*> | 140 extern const LanguageMultipleChoicePreference<const char*> |
| 135 kMozcMultipleChoicePrefs[]; | 141 kMozcMultipleChoicePrefs[]; |
| 136 // See comments at kNumChewingBooleanPrefs for why we hard-code this here. | 142 // See comments at kNumChewingBooleanPrefs for why we hard-code this here. |
| 137 const size_t kNumMozcMultipleChoicePrefs = 8; | 143 const size_t kNumMozcMultipleChoicePrefs = 8; |
| 138 | 144 |
| 139 extern const LanguageIntegerRangePreference kMozcIntegerPrefs[]; | 145 extern const LanguageIntegerRangePreference kMozcIntegerPrefs[]; |
| 140 // See comments at kNumChewingBooleanPrefs for why we hard-code this here. | 146 // See comments at kNumChewingBooleanPrefs for why we hard-code this here. |
| 141 const size_t kNumMozcIntegerPrefs = 1; | 147 const size_t kNumMozcIntegerPrefs = 1; |
| 142 | 148 |
| 143 // --------------------------------------------------------------------------- | 149 // --------------------------------------------------------------------------- |
| 144 // For keyboard stuff | 150 // For keyboard stuff |
| 145 // --------------------------------------------------------------------------- | 151 // --------------------------------------------------------------------------- |
| 146 // TODO(yusukes): Temporary solution for View version of modifier key remapper. | |
| 147 // Remove RemapType and kXkbModifierMultipleChoicePrefs when we finish to | |
| 148 // migrate to WebUI. | |
| 149 enum RemapType { | |
| 150 kNoRemap = 0, | |
| 151 kSwapCtrlAndAlt = 1, | |
| 152 kSwapSearchAndCtrl = 2, | |
| 153 }; | |
| 154 extern const LanguageMultipleChoicePreference<int> | |
| 155 kXkbModifierMultipleChoicePrefs; | |
| 156 | |
| 157 // A delay between the first and the start of the rest. | 152 // A delay between the first and the start of the rest. |
| 158 extern const int kXkbAutoRepeatDelayInMs; | 153 extern const int kXkbAutoRepeatDelayInMs; |
| 159 // An interval between the repeated keys. | 154 // An interval between the repeated keys. |
| 160 extern const int kXkbAutoRepeatIntervalInMs; | 155 extern const int kXkbAutoRepeatIntervalInMs; |
| 161 | 156 |
| 162 // A string Chrome preference (Local State) of the preferred keyboard layout in | 157 // A string Chrome preference (Local State) of the preferred keyboard layout in |
| 163 // the login screen. | 158 // the login screen. |
| 164 extern const char kPreferredKeyboardLayout[]; | 159 extern const char kPreferredKeyboardLayout[]; |
| 165 | 160 |
| 166 } // language_prefs | 161 } // language_prefs |
| 167 } // chromeos | 162 } // chromeos |
| 168 | 163 |
| 169 #endif // CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_ | 164 #endif // CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_ |
| OLD | NEW |