summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-17 22:48:46 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-17 22:48:46 +0000
commit830f8334d4e6d3878de3db28eeb3787291f40e7e (patch)
tree8b36cc4b6b1bf83608ecc8da18ef153552ec69df /content
parent6f2b1c9acf28ad49bc1dfa3c48d546aeb17b5f5c (diff)
downloadchromium_src-830f8334d4e6d3878de3db28eeb3787291f40e7e.zip
chromium_src-830f8334d4e6d3878de3db28eeb3787291f40e7e.tar.gz
chromium_src-830f8334d4e6d3878de3db28eeb3787291f40e7e.tar.bz2
Dismiss the OSK on Windows AURA in the ViewHostMsg_FocusedNodeChanged notification if the node being focused is not editable.
This is needed because there are cases when an editable node being tapped is deleted which causes the OSK to show up and then the focus changes. We dismiss the OSK in a delayed task to ensure that we allow the OSK to be displayed in response to the tap notification. Fixes bug https://code.google.com/p/chromium/issues/detail?id=327985 BUG=327985 R=jam@chromium.org Review URL: https://codereview.chromium.org/115533004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241395 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc38
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h3
2 files changed, 39 insertions, 2 deletions
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 491944e..b19331f 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -118,6 +118,29 @@ base::i18n::TextDirection WebTextDirectionToChromeTextDirection(
}
}
+#if defined(OS_WIN) && defined(USE_AURA)
+
+const int kVirtualKeyboardDisplayWaitTimeoutMs = 100;
+const int kMaxVirtualKeyboardDisplayRetries = 5;
+
+void DismissVirtualKeyboardTask() {
+ static int virtual_keyboard_display_retries = 0;
+ // If the virtual keyboard is not yet visible, then we execute the task again
+ // waiting for it to show up.
+ if (!base::win::DismissVirtualKeyboard()) {
+ if (virtual_keyboard_display_retries < kMaxVirtualKeyboardDisplayRetries) {
+ BrowserThread::PostDelayedTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)),
+ TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs));
+ ++virtual_keyboard_display_retries;
+ } else {
+ virtual_keyboard_display_retries = 0;
+ }
+ }
+}
+#endif
+
} // namespace
///////////////////////////////////////////////////////////////////////////////
@@ -186,7 +209,8 @@ RenderViewHostImpl::RenderViewHostImpl(
unload_ack_is_for_cross_site_transition_(false),
are_javascript_messages_suppressed_(false),
sudden_termination_allowed_(false),
- render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) {
+ render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
+ virtual_keyboard_requested_(false) {
DCHECK(instance_.get());
CHECK(delegate_); // http://crbug.com/82827
@@ -1789,6 +1813,15 @@ void RenderViewHostImpl::OnTakeFocus(bool reverse) {
}
void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) {
+#if defined(OS_WIN) && defined(USE_AURA)
+ if (!is_editable_node && virtual_keyboard_requested_) {
+ virtual_keyboard_requested_ = false;
+ BrowserThread::PostDelayedTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)),
+ TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs));
+ }
+#endif
NotificationService::current()->Notify(
NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
Source<RenderViewHost>(this),
@@ -2241,8 +2274,9 @@ void RenderViewHostImpl::OnDomOperationResponse(
void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) {
#if defined(OS_WIN) && defined(USE_AURA)
if (editable) {
- base::win::DisplayVirtualKeyboard();
+ virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard();
} else {
+ virtual_keyboard_requested_ = false;
base::win::DismissVirtualKeyboard();
}
#endif
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index 44851ee..13ff167 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -739,6 +739,9 @@ class CONTENT_EXPORT RenderViewHostImpl
// When the last ShouldClose message was sent.
base::TimeTicks send_should_close_start_time_;
+ // Set to true if we requested the on screen keyboard to be displayed.
+ bool virtual_keyboard_requested_;
+
#if defined(OS_ANDROID)
// Manages all the android mediaplayer objects and handling IPCs for video.
scoped_ptr<BrowserMediaPlayerManager> media_player_manager_;