| 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_view.h" | 5 #include "chrome/browser/chromeos/options/language_config_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // Get the list of input method ids associated with the language code. | 377 // Get the list of input method ids associated with the language code. |
| 378 std::vector<std::string> input_method_ids; | 378 std::vector<std::string> input_method_ids; |
| 379 GetInputMethodIdsFromLanguageCode(language_code, &input_method_ids); | 379 GetInputMethodIdsFromLanguageCode(language_code, &input_method_ids); |
| 380 | 380 |
| 381 for (size_t i = 0; i < input_method_ids.size(); ++i) { | 381 for (size_t i = 0; i < input_method_ids.size(); ++i) { |
| 382 const std::string& input_method_id = input_method_ids[i]; | 382 const std::string& input_method_id = input_method_ids[i]; |
| 383 const std::string display_name = GetInputMethodDisplayNameFromId( | 383 const std::string display_name = GetInputMethodDisplayNameFromId( |
| 384 input_method_id); | 384 input_method_id); |
| 385 layout->StartRow(0, kPerLanguageDoubleColumnSetId); | 385 layout->StartRow(0, kPerLanguageDoubleColumnSetId); |
| 386 InputMethodCheckbox* checkbox | 386 InputMethodCheckbox* checkbox |
| 387 = new InputMethodCheckbox(UTF8ToWide(display_name).substr(0, 4), | 387 = new InputMethodCheckbox(UTF8ToWide(display_name), |
| 388 input_method_id); | 388 input_method_id); |
| 389 checkbox->set_listener(this); | 389 checkbox->set_listener(this); |
| 390 checkbox->set_tag(kSelectInputMethodButton); | 390 checkbox->set_tag(kSelectInputMethodButton); |
| 391 if (InputMethodIsActivated(input_method_id)) { | 391 if (InputMethodIsActivated(input_method_id)) { |
| 392 checkbox->SetChecked(true); | 392 checkbox->SetChecked(true); |
| 393 } | 393 } |
| 394 | 394 |
| 395 layout->AddView(checkbox); | 395 layout->AddView(checkbox); |
| 396 input_method_checkboxes_.insert(checkbox); | 396 input_method_checkboxes_.insert(checkbox); |
| 397 // Add "configure" button for the input method if we have a | 397 // Add "configure" button for the input method if we have a |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 538 } |
| 539 } | 539 } |
| 540 | 540 |
| 541 void LanguageConfigView::InitInputMethodConfigViewMap() { | 541 void LanguageConfigView::InitInputMethodConfigViewMap() { |
| 542 input_method_config_view_map_["chewing"] = CreateLanguageChewingConfigView; | 542 input_method_config_view_map_["chewing"] = CreateLanguageChewingConfigView; |
| 543 input_method_config_view_map_["hangul"] = CreateLanguageHangulConfigView; | 543 input_method_config_view_map_["hangul"] = CreateLanguageHangulConfigView; |
| 544 input_method_config_view_map_["pinyin"] = CreateLanguagePinyinConfigView; | 544 input_method_config_view_map_["pinyin"] = CreateLanguagePinyinConfigView; |
| 545 | 545 |
| 546 // TODO(yusukes): Enable the following two mappings when ibus-mozc starts | 546 // TODO(yusukes): Enable the following two mappings when ibus-mozc starts |
| 547 // supporting IBus style configs. | 547 // supporting IBus style configs. |
| 548 input_method_config_view_map_["mozc"] = CreateLanguageMozcConfigView; | 548 // input_method_config_view_map_["mozc"] = CreateLanguageMozcConfigView; |
| 549 input_method_config_view_map_["mozc-jp"] = CreateLanguageMozcConfigView; | 549 // input_method_config_view_map_["mozc-jp"] = CreateLanguageMozcConfigView; |
| 550 } | 550 } |
| 551 | 551 |
| 552 void LanguageConfigView::InitInputMethodIdMapsAndVectors() { | 552 void LanguageConfigView::InitInputMethodIdMapsAndVectors() { |
| 553 // The two sets are used to build lists without duplication. | 553 // The two sets are used to build lists without duplication. |
| 554 std::set<std::string> supported_language_code_set; | 554 std::set<std::string> supported_language_code_set; |
| 555 std::set<std::string> supported_input_method_id_set; | 555 std::set<std::string> supported_input_method_id_set; |
| 556 // Build the id to descriptor map for handling kExtraLanguages later. | 556 // Build the id to descriptor map for handling kExtraLanguages later. |
| 557 std::map<std::string, const InputMethodDescriptor*> id_to_descriptor_map; | 557 std::map<std::string, const InputMethodDescriptor*> id_to_descriptor_map; |
| 558 | 558 |
| 559 // GetSupportedLanguages() never return NULL. | 559 // GetSupportedLanguages() never return NULL. |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 if (iter != input_method_ids->end() && | 1042 if (iter != input_method_ids->end() && |
| 1043 iter != input_method_ids->begin()) { | 1043 iter != input_method_ids->begin()) { |
| 1044 std::swap(*input_method_ids->begin(), *iter); | 1044 std::swap(*input_method_ids->begin(), *iter); |
| 1045 } | 1045 } |
| 1046 break; // Don't have to check other language codes. | 1046 break; // Don't have to check other language codes. |
| 1047 } | 1047 } |
| 1048 } | 1048 } |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 } // namespace chromeos | 1051 } // namespace chromeos |
| OLD | NEW |