| 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 <algorithm> // std::find | 7 #include <algorithm> // std::find |
| 8 | 8 |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 INPUT_METHOD_CATEGORY_T13N, // Transliteration input methods | 63 INPUT_METHOD_CATEGORY_T13N, // Transliteration input methods |
| 64 INPUT_METHOD_CATEGORY_MAX | 64 INPUT_METHOD_CATEGORY_MAX |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 InputMethodCategory GetInputMethodCategory(const std::string& input_method_id, | 67 InputMethodCategory GetInputMethodCategory(const std::string& input_method_id, |
| 68 char* first_char = NULL) { | 68 char* first_char = NULL) { |
| 69 const std::string component_id = | 69 const std::string component_id = |
| 70 extension_ime_util::GetComponentIDByInputMethodID(input_method_id); | 70 extension_ime_util::GetComponentIDByInputMethodID(input_method_id); |
| 71 InputMethodCategory category = INPUT_METHOD_CATEGORY_UNKNOWN; | 71 InputMethodCategory category = INPUT_METHOD_CATEGORY_UNKNOWN; |
| 72 char ch = 0; | 72 char ch = 0; |
| 73 if (base::StartsWithASCII(component_id, "xkb:", true)) { | 73 if (base::StartsWith(component_id, "xkb:", base::CompareCase::SENSITIVE)) { |
| 74 ch = component_id[4]; | 74 ch = component_id[4]; |
| 75 category = INPUT_METHOD_CATEGORY_XKB; | 75 category = INPUT_METHOD_CATEGORY_XKB; |
| 76 } else if (base::StartsWithASCII(component_id, "zh-", true)) { | 76 } else if (base::StartsWith(component_id, "zh-", |
| 77 base::CompareCase::SENSITIVE)) { |
| 77 size_t pos = component_id.find("-t-i0-"); | 78 size_t pos = component_id.find("-t-i0-"); |
| 78 if (pos > 0) | 79 if (pos > 0) |
| 79 pos += 6; | 80 pos += 6; |
| 80 ch = component_id[pos]; | 81 ch = component_id[pos]; |
| 81 category = INPUT_METHOD_CATEGORY_ZH; | 82 category = INPUT_METHOD_CATEGORY_ZH; |
| 82 } else if (base::StartsWithASCII(component_id, "nacl_mozc_", true)) { | 83 } else if (base::StartsWith(component_id, "nacl_mozc_", |
| 84 base::CompareCase::SENSITIVE)) { |
| 83 ch = component_id[10]; | 85 ch = component_id[10]; |
| 84 category = INPUT_METHOD_CATEGORY_JA; | 86 category = INPUT_METHOD_CATEGORY_JA; |
| 85 } else if (base::StartsWithASCII(component_id, "hangul_", true)) { | 87 } else if (base::StartsWith(component_id, "hangul_", |
| 88 base::CompareCase::SENSITIVE)) { |
| 86 ch = component_id[7]; | 89 ch = component_id[7]; |
| 87 category = INPUT_METHOD_CATEGORY_KO; | 90 category = INPUT_METHOD_CATEGORY_KO; |
| 88 } else if (base::StartsWithASCII(component_id, "vkd_", true)) { | 91 } else if (base::StartsWith(component_id, "vkd_", |
| 92 base::CompareCase::SENSITIVE)) { |
| 89 ch = component_id[4]; | 93 ch = component_id[4]; |
| 90 category = INPUT_METHOD_CATEGORY_M17N; | 94 category = INPUT_METHOD_CATEGORY_M17N; |
| 91 } else if (component_id.find("-t-i0-") > 0) { | 95 } else if (component_id.find("-t-i0-") > 0) { |
| 92 ch = component_id[0]; | 96 ch = component_id[0]; |
| 93 category = INPUT_METHOD_CATEGORY_T13N; | 97 category = INPUT_METHOD_CATEGORY_T13N; |
| 94 } | 98 } |
| 95 | 99 |
| 96 if (first_char) | 100 if (first_char) |
| 97 *first_char = ch; | 101 *first_char = ch; |
| 98 return category; | 102 return category; |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 if (candidate_window_controller_.get()) | 1166 if (candidate_window_controller_.get()) |
| 1163 return; | 1167 return; |
| 1164 | 1168 |
| 1165 candidate_window_controller_.reset( | 1169 candidate_window_controller_.reset( |
| 1166 CandidateWindowController::CreateCandidateWindowController()); | 1170 CandidateWindowController::CreateCandidateWindowController()); |
| 1167 candidate_window_controller_->AddObserver(this); | 1171 candidate_window_controller_->AddObserver(this); |
| 1168 } | 1172 } |
| 1169 | 1173 |
| 1170 } // namespace input_method | 1174 } // namespace input_method |
| 1171 } // namespace chromeos | 1175 } // namespace chromeos |
| OLD | NEW |