Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/input_method/input_method_manager_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> // std::find | 9 #include <algorithm> // std::find |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <sstream> | 12 #include <sstream> |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "ash/ime/ime_controller.h" | 15 #include "ash/ime/ime_controller.h" |
| 16 #include "ash/public/interfaces/ime_info.mojom.h" | 16 #include "ash/public/interfaces/ime_info.mojom.h" |
| 17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "base/bind.h" | 18 #include "base/bind.h" |
| 19 #include "base/feature_list.h" | 19 #include "base/feature_list.h" |
| 20 #include "base/hash.h" | 20 #include "base/hash.h" |
| 21 #include "base/location.h" | 21 #include "base/location.h" |
| 22 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
| 23 #include "base/metrics/histogram_macros.h" | 23 #include "base/metrics/histogram_macros.h" |
| 24 #include "base/metrics/sparse_histogram.h" | 24 #include "base/metrics/sparse_histogram.h" |
| 25 #include "base/stl_util.h" | |
| 25 #include "base/strings/string_split.h" | 26 #include "base/strings/string_split.h" |
| 26 #include "base/strings/string_util.h" | 27 #include "base/strings/string_util.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 28 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 30 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 30 #include "chrome/browser/chromeos/ash_config.h" | 31 #include "chrome/browser/chromeos/ash_config.h" |
| 31 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" | 32 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" |
| 32 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i mpl.h" | 33 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i mpl.h" |
| 33 #include "chrome/browser/chromeos/language_preferences.h" | 34 #include "chrome/browser/chromeos/language_preferences.h" |
| 34 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 35 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 const InputMethodUtil& util) { | 68 const InputMethodUtil& util) { |
| 68 ash::mojom::ImeInfo info; | 69 ash::mojom::ImeInfo info; |
| 69 info.id = ime.id(); | 70 info.id = ime.id(); |
| 70 info.name = util.GetInputMethodLongName(ime); | 71 info.name = util.GetInputMethodLongName(ime); |
| 71 info.medium_name = util.GetInputMethodMediumName(ime); | 72 info.medium_name = util.GetInputMethodMediumName(ime); |
| 72 info.short_name = util.GetInputMethodShortName(ime); | 73 info.short_name = util.GetInputMethodShortName(ime); |
| 73 info.third_party = extension_ime_util::IsExtensionIME(ime.id()); | 74 info.third_party = extension_ime_util::IsExtensionIME(ime.id()); |
| 74 return info; | 75 return info; |
| 75 } | 76 } |
| 76 | 77 |
| 77 bool Contains(const std::vector<std::string>& container, | 78 bool Contains(const std::vector<std::string>& container, |
|
achuithb
2017/06/13 20:58:23
nit: We can eliminate this function as well by inl
Tripta
2017/06/14 07:36:17
Done.
| |
| 78 const std::string& value) { | 79 const std::string& value) { |
| 79 return std::find(container.begin(), container.end(), value) != | 80 return base::ContainsValue(container, value); |
| 80 container.end(); | |
| 81 } | 81 } |
| 82 | 82 |
| 83 enum InputMethodCategory { | 83 enum InputMethodCategory { |
| 84 INPUT_METHOD_CATEGORY_UNKNOWN = 0, | 84 INPUT_METHOD_CATEGORY_UNKNOWN = 0, |
| 85 INPUT_METHOD_CATEGORY_XKB, // XKB input methods | 85 INPUT_METHOD_CATEGORY_XKB, // XKB input methods |
| 86 INPUT_METHOD_CATEGORY_ZH, // Chinese input methods | 86 INPUT_METHOD_CATEGORY_ZH, // Chinese input methods |
| 87 INPUT_METHOD_CATEGORY_JA, // Japanese input methods | 87 INPUT_METHOD_CATEGORY_JA, // Japanese input methods |
| 88 INPUT_METHOD_CATEGORY_KO, // Korean input methods | 88 INPUT_METHOD_CATEGORY_KO, // Korean input methods |
| 89 INPUT_METHOD_CATEGORY_M17N, // Multilingualization input methods | 89 INPUT_METHOD_CATEGORY_M17N, // Multilingualization input methods |
| 90 INPUT_METHOD_CATEGORY_T13N, // Transliteration input methods | 90 INPUT_METHOD_CATEGORY_T13N, // Transliteration input methods |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 property.key = menu_list[i].key; | 1416 property.key = menu_list[i].key; |
| 1417 property.label = base::UTF8ToUTF16(menu_list[i].label); | 1417 property.label = base::UTF8ToUTF16(menu_list[i].label); |
| 1418 property.checked = menu_list[i].is_selection_item_checked; | 1418 property.checked = menu_list[i].is_selection_item_checked; |
| 1419 items.push_back(property); | 1419 items.push_back(property); |
| 1420 } | 1420 } |
| 1421 return items; | 1421 return items; |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 } // namespace input_method | 1424 } // namespace input_method |
| 1425 } // namespace chromeos | 1425 } // namespace chromeos |
| OLD | NEW |