OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/base/ime/chromeos/component_extension_ime_manager.h" | 5 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "chromeos/chromeos_switches.h" | 10 #include "chromeos/chromeos_switches.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 "us(dvorak)", | 58 "us(dvorak)", |
59 "us(dvp)", | 59 "us(dvp)", |
60 "us(intl)" | 60 "us(intl)" |
61 }; | 61 }; |
62 | 62 |
63 // Gets the input method category according to the given input method id. | 63 // Gets the input method category according to the given input method id. |
64 // This is used for sorting a list of input methods. | 64 // This is used for sorting a list of input methods. |
65 int GetInputMethodCategory(const std::string& id) { | 65 int GetInputMethodCategory(const std::string& id) { |
66 const std::string engine_id = | 66 const std::string engine_id = |
67 chromeos::extension_ime_util::GetComponentIDByInputMethodID(id); | 67 chromeos::extension_ime_util::GetComponentIDByInputMethodID(id); |
68 if (StartsWithASCII(engine_id, "xkb:", true)) | 68 if (base::StartsWithASCII(engine_id, "xkb:", true)) |
69 return 0; | 69 return 0; |
70 if (StartsWithASCII(engine_id, "vkd_", true)) | 70 if (base::StartsWithASCII(engine_id, "vkd_", true)) |
71 return 1; | 71 return 1; |
72 if (engine_id.find("-t-i0-") != std::string::npos && | 72 if (engine_id.find("-t-i0-") != std::string::npos && |
73 !StartsWithASCII(engine_id, "zh-", true)) { | 73 !base::StartsWithASCII(engine_id, "zh-", true)) { |
74 return 2; | 74 return 2; |
75 } | 75 } |
76 return 3; | 76 return 3; |
77 } | 77 } |
78 | 78 |
79 bool InputMethodCompare(const input_method::InputMethodDescriptor& im1, | 79 bool InputMethodCompare(const input_method::InputMethodDescriptor& im1, |
80 const input_method::InputMethodDescriptor& im2) { | 80 const input_method::InputMethodDescriptor& im2) { |
81 return GetInputMethodCategory(im1.id()) < GetInputMethodCategory(im2.id()); | 81 return GetInputMethodCategory(im1.id()) < GetInputMethodCategory(im2.id()); |
82 } | 82 } |
83 | 83 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( | 233 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( |
234 const std::vector<std::string>& layouts) { | 234 const std::vector<std::string>& layouts) { |
235 for (size_t i = 0; i < layouts.size(); ++i) { | 235 for (size_t i = 0; i < layouts.size(); ++i) { |
236 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) | 236 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) |
237 return true; | 237 return true; |
238 } | 238 } |
239 return false; | 239 return false; |
240 } | 240 } |
241 | 241 |
242 } // namespace chromeos | 242 } // namespace chromeos |
OLD | NEW |