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> |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1221 // not system IME, and we don't support show emoji, handwriting or voice | 1221 // not system IME, and we don't support show emoji, handwriting or voice |
| 1222 // input for such IME extension. | 1222 // input for such IME extension. |
| 1223 if (!url.has_ref()) | 1223 if (!url.has_ref()) |
| 1224 return; | 1224 return; |
| 1225 std::string overridden_ref = url.ref(); | 1225 std::string overridden_ref = url.ref(); |
| 1226 auto i = overridden_ref.find("id"); | 1226 auto i = overridden_ref.find("id"); |
| 1227 if (i == std::string::npos) | 1227 if (i == std::string::npos) |
| 1228 return; | 1228 return; |
| 1229 | 1229 |
| 1230 if (keyset.empty()) { | 1230 if (keyset.empty()) { |
| 1231 // Resets the url as the input method default url and notify the hash | |
| 1232 // changed to VK. | |
| 1231 keyboard::SetOverrideContentUrl( | 1233 keyboard::SetOverrideContentUrl( |
| 1232 GetActiveIMEState()->GetCurrentInputMethod().input_view_url()); | 1234 GetActiveIMEState()->GetCurrentInputMethod().input_view_url()); |
| 1235 keyboard::KeyboardController* keyboard_controller = | |
| 1236 keyboard::KeyboardController::GetInstance(); | |
| 1237 if (keyboard_controller) | |
| 1238 keyboard_controller->Reload(); | |
| 1233 return; | 1239 return; |
| 1234 } | 1240 } |
| 1235 | 1241 |
| 1236 // For system IME extension, the input view url is overridden as: | 1242 // For system IME extension, the input view url is overridden as: |
| 1237 // chrome-extension://${extension_id}/inputview.html#id=us.compact.qwerty | 1243 // chrome-extension://${extension_id}/inputview.html#id=us.compact.qwerty |
| 1238 // &language=en-US&passwordLayout=us.compact.qwerty&name=keyboard_us | 1244 // &language=en-US&passwordLayout=us.compact.qwerty&name=keyboard_us |
| 1239 // Fow emoji and handwriting input, we replace the id=${keyset} part with | 1245 // Fow emoji, handwriting and voice input, we append the keyset to the end of |
| 1240 // desired keyset like: id=emoji; For voice, we append ".voice" to the end of | 1246 // id like: id=${keyset}.emoji/hwt/voice. |
| 1241 // id like: id=${keyset}.voice. | |
| 1242 auto j = overridden_ref.find("&", i + 1); | 1247 auto j = overridden_ref.find("&", i + 1); |
| 1243 if (keyset == "voice") { | 1248 overridden_ref.replace(j, 0, "." + keyset); |
|
Shu Chen
2016/10/24 01:30:47
To reduce the risk of potential breakage, can you
Azure Wei
2016/10/24 08:11:09
Done.
| |
| 1244 overridden_ref.replace(j, 0, "." + keyset); | |
| 1245 } else { | |
| 1246 overridden_ref.replace(i, j - i, "id=" + keyset); | |
| 1247 } | |
| 1248 | 1249 |
| 1249 GURL::Replacements replacements; | 1250 GURL::Replacements replacements; |
| 1250 replacements.SetRefStr(overridden_ref); | 1251 replacements.SetRefStr(overridden_ref); |
| 1251 keyboard::SetOverrideContentUrl(url.ReplaceComponents(replacements)); | 1252 keyboard::SetOverrideContentUrl(url.ReplaceComponents(replacements)); |
| 1252 } | 1253 } |
| 1253 | 1254 |
| 1254 bool InputMethodManagerImpl::IsEmojiHandwritingVoiceOnImeMenuEnabled() { | 1255 bool InputMethodManagerImpl::IsEmojiHandwritingVoiceOnImeMenuEnabled() { |
| 1255 return base::FeatureList::IsEnabled(features::kEHVInputOnImeMenu); | 1256 return base::FeatureList::IsEnabled(features::kEHVInputOnImeMenu); |
| 1256 } | 1257 } |
| 1257 | 1258 |
| 1258 } // namespace input_method | 1259 } // namespace input_method |
| 1259 } // namespace chromeos | 1260 } // namespace chromeos |
| OLD | NEW |