Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 23159008: Changes the Omnibox input type to SEARCH. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applies the change only to CJK + Thai. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698