Chromium Code Reviews| Index: chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
| diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
| index 834bb1e9c63b4a72bf17aeae2f70317a3a6ab22b..50bac7cbe100a6080ebbf87f97ceda3c38ace648 100644 |
| --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
| +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
| @@ -12,7 +12,9 @@ |
| #include <sstream> |
| #include <utility> |
| +#include "ash/shell.h" |
| #include "base/bind.h" |
| +#include "base/feature_list.h" |
| #include "base/hash.h" |
| #include "base/location.h" |
| #include "base/metrics/histogram_macros.h" |
| @@ -30,6 +32,7 @@ |
| #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/ui/ash/ash_util.h" |
| +#include "chrome/common/chrome_features.h" |
| #include "chrome/common/pref_names.h" |
| #include "components/prefs/pref_service.h" |
| #include "components/user_manager/user_manager.h" |
| @@ -1213,5 +1216,34 @@ void InputMethodManagerImpl::MaybeNotifyImeMenuActivationChanged() { |
| is_ime_menu_activated_); |
| } |
| +void InputMethodManagerImpl::OverrideKeyboardRef(const std::string& keyset) { |
|
James Cook
2016/09/14 21:14:28
nit: maybe OverrideKeyboardUrlRef? Or UpdateKeyboa
Azure Wei
2016/09/15 03:44:51
Done.
|
| + GURL url = keyboard::GetOverrideContentUrl(); |
| + |
| + // If fails to find ref or tag "id" in the ref, it means the current IME is |
| + // not system IME, and we don't support show e/v/h input for such IME |
|
James Cook
2016/09/14 21:14:28
nit: spell out emoji, voice, ...
Azure Wei
2016/09/15 03:44:51
Done.
|
| + // extension. |
| + if (!url.has_ref()) |
| + return; |
| + std::string overridden_ref = url.ref(); |
| + auto i = overridden_ref.find("id"); |
| + if (i == std::string::npos) |
| + return; |
| + |
| + // For system IME extension, the input view url is overridden as: |
| + // chrome-extension://${extension_id}/inputview.html#id=us.compact.qwerty |
| + // &language=en-US&passwordLayout=us.compact.qwerty&name=keyboard_us |
| + // We should replace the id=${keyset} part with desired keyset. |
| + auto j = overridden_ref.find("&", i + 1); |
| + overridden_ref.replace(i, j - i, "id=" + keyset); |
| + |
| + GURL::Replacements replacements; |
| + replacements.SetRefStr(overridden_ref); |
| + keyboard::SetOverrideContentUrl(url.ReplaceComponents(replacements)); |
| +} |
| + |
| +bool InputMethodManagerImpl::IsEmojiHandwritingVoiceOnImeMenuEnabled() { |
| + return base::FeatureList::IsEnabled(features::kEHVInputOnImeMenu); |
| +} |
| + |
| } // namespace input_method |
| } // namespace chromeos |