Chromium Code Reviews| Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| index 042362fdf29fca21fb60765b78f38897b0ba0535..72d9fdc628965bc522bfe76f16f37d193b33624d 100644 |
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| @@ -50,6 +50,11 @@ |
| #include "ui/views/widget/widget.h" |
| #include "url/gurl.h" |
| +#if defined(OS_WIN) |
| +#include "base/win/metro.h" |
| +#include "chrome/browser/browser_process.h" |
| +#endif |
| + |
| #if defined(USE_AURA) |
| #include "ui/aura/focus_manager.h" |
| #include "ui/aura/root_window.h" |
| @@ -88,6 +93,30 @@ void DoCopyURL(const GURL& url, const string16& text) { |
| data.WriteToClipboard(); |
| } |
| +// The IME's input mode automatically falls into the Latin character mode if |
| +// ui::TEXT_INPUT_TYPE_URL is specified on Windows TSF environment, and that is |
| +// bad experience for IME users. However, software keyboards provide special |
| +// layout when ui::TEXT_INPUT_TYPE_URL is specified, for example ".com" and "/" |
| +// keys appear on English software keyboard. So we set |
| +// ui::TEXT_INPUT_TYPE_SEARCH for those who are likely IME users, and |
| +// ui::TEXT_INPUT_TYPE_URL for the rest who are likely non-IME users. |
|
Peter Kasting
2013/09/13 17:16:37
Nit: This comment is pretty good, here's my attemp
Yuki
2013/09/17 08:33:39
Done.
|
| +ui::TextInputType DetermineTextInputType() { |
| +#if defined(OS_WIN) |
| + if (base::win::IsTSFAwareRequired()) { |
| + DCHECK(g_browser_process); |
| + const std::string& locale = g_browser_process->GetApplicationLocale(); |
| + const std::string& language = locale.substr(0, 2); |
| + // Suppose CJK + Thai users are using an IME. |
|
Peter Kasting
2013/09/13 17:16:37
Nit: Suppose -> Assume
Yuki
2013/09/17 08:33:39
Done.
|
| + if (language == "ja" || |
| + language == "ko" || |
| + language == "th" || |
| + language == "zh") |
| + return ui::TEXT_INPUT_TYPE_SEARCH; |
| + } |
| +#endif |
| + return ui::TEXT_INPUT_TYPE_URL; |
| +} |
| + |
| bool IsOmniboxAutoCompletionForImeEnabled() { |
| return !CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kDisableOmniboxAutoCompletionForIme); |
| @@ -137,7 +166,7 @@ OmniboxViewViews::~OmniboxViewViews() { |
| void OmniboxViewViews::Init() { |
| SetController(this); |
| - SetTextInputType(ui::TEXT_INPUT_TYPE_URL); |
| + SetTextInputType(DetermineTextInputType()); |
| SetBackgroundColor(location_bar_view_->GetColor( |
| ToolbarModel::NONE, LocationBarView::BACKGROUND)); |