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 #include "chrome/browser/chromeos/options/language_config_model.h" | 5 #include "chrome/browser/chromeos/options/language_config_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // here and compare the result and preload_engines_.GetValue(). If there's | 85 // here and compare the result and preload_engines_.GetValue(). If there's |
86 // a discrepancy between IBus setting and Chrome prefs, we can resolve it | 86 // a discrepancy between IBus setting and Chrome prefs, we can resolve it |
87 // by calling preload_engines_SetValue() here. | 87 // by calling preload_engines_SetValue() here. |
88 } | 88 } |
89 | 89 |
90 size_t LanguageConfigModel::CountNumActiveInputMethods( | 90 size_t LanguageConfigModel::CountNumActiveInputMethods( |
91 const std::string& language_code) { | 91 const std::string& language_code) { |
92 int num_selected_active_input_methods = 0; | 92 int num_selected_active_input_methods = 0; |
93 std::vector<std::string> input_method_ids; | 93 std::vector<std::string> input_method_ids; |
94 input_method::GetInputMethodIdsFromLanguageCode( | 94 input_method::GetInputMethodIdsFromLanguageCode( |
95 language_code, false /* keyboard_layout_only */, &input_method_ids); | 95 language_code, input_method::kKeyboardLayoutsOnly, &input_method_ids); |
96 for (size_t i = 0; i < input_method_ids.size(); ++i) { | 96 for (size_t i = 0; i < input_method_ids.size(); ++i) { |
97 if (InputMethodIsActivated(input_method_ids[i])) { | 97 if (InputMethodIsActivated(input_method_ids[i])) { |
98 ++num_selected_active_input_methods; | 98 ++num_selected_active_input_methods; |
99 } | 99 } |
100 } | 100 } |
101 return num_selected_active_input_methods; | 101 return num_selected_active_input_methods; |
102 } | 102 } |
103 | 103 |
104 bool LanguageConfigModel::HasLanguageCode( | 104 bool LanguageConfigModel::HasLanguageCode( |
105 const std::string& language_code) const { | 105 const std::string& language_code) const { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 if (!value.empty()) | 191 if (!value.empty()) |
192 SplitString(value, ',', out_input_method_ids); | 192 SplitString(value, ',', out_input_method_ids); |
193 } | 193 } |
194 | 194 |
195 void LanguageConfigModel::GetInputMethodIdsFromLanguageCode( | 195 void LanguageConfigModel::GetInputMethodIdsFromLanguageCode( |
196 const std::string& language_code, | 196 const std::string& language_code, |
197 std::vector<std::string>* input_method_ids) const { | 197 std::vector<std::string>* input_method_ids) const { |
198 DCHECK(input_method_ids); | 198 DCHECK(input_method_ids); |
199 input_method_ids->clear(); | 199 input_method_ids->clear(); |
200 input_method::GetInputMethodIdsFromLanguageCode( | 200 input_method::GetInputMethodIdsFromLanguageCode( |
201 language_code, false /* keyboard_layout_only */, input_method_ids); | 201 language_code, input_method::kAllInputMethods, input_method_ids); |
202 | 202 |
203 // Reorder the input methods. | 203 // Reorder the input methods. |
204 input_method::ReorderInputMethodIdsForLanguageCode( | 204 input_method::ReorderInputMethodIdsForLanguageCode( |
205 language_code, input_method_ids); | 205 language_code, input_method_ids); |
206 } | 206 } |
207 | 207 |
208 void LanguageConfigModel::NotifyPrefChanged() { | 208 void LanguageConfigModel::NotifyPrefChanged() { |
209 std::vector<std::string> input_method_ids; | 209 std::vector<std::string> input_method_ids; |
210 GetActiveInputMethodIds(&input_method_ids); | 210 GetActiveInputMethodIds(&input_method_ids); |
211 | 211 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 | 271 |
272 // Build the vectors from the sets. | 272 // Build the vectors from the sets. |
273 supported_language_codes_.assign(supported_language_code_set.begin(), | 273 supported_language_codes_.assign(supported_language_code_set.begin(), |
274 supported_language_code_set.end()); | 274 supported_language_code_set.end()); |
275 supported_input_method_ids_.assign(supported_input_method_id_set.begin(), | 275 supported_input_method_ids_.assign(supported_input_method_id_set.begin(), |
276 supported_input_method_id_set.end()); | 276 supported_input_method_id_set.end()); |
277 } | 277 } |
278 | 278 |
279 } // namespace chromeos | 279 } // namespace chromeos |
OLD | NEW |