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

Side by Side Diff: content/browser/renderer_host/ime_adapter_android.cc

Issue 1378583003: Unstrangle unhandled key event callback for webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/renderer_host/ime_adapter_android.h" 5 #include "content/browser/renderer_host/ime_adapter_android.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <android/input.h> 8 #include <android/input.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 int scan_code, bool is_system_key, 144 int scan_code, bool is_system_key,
145 int unicode_char) { 145 int unicode_char) {
146 NativeWebKeyboardEvent event = NativeWebKeyboardEventFromKeyEvent( 146 NativeWebKeyboardEvent event = NativeWebKeyboardEventFromKeyEvent(
147 env, original_key_event, action, modifiers, 147 env, original_key_event, action, modifiers,
148 time_ms, key_code, scan_code, is_system_key, unicode_char); 148 time_ms, key_code, scan_code, is_system_key, unicode_char);
149 bool key_down_text_insertion = 149 bool key_down_text_insertion =
150 event.type == blink::WebInputEvent::RawKeyDown && event.text[0]; 150 event.type == blink::WebInputEvent::RawKeyDown && event.text[0];
151 // If we are going to follow up with a synthetic Char event, then that's the 151 // If we are going to follow up with a synthetic Char event, then that's the
152 // one we expect to test if it's handled or unhandled, so skip handling the 152 // one we expect to test if it's handled or unhandled, so skip handling the
153 // "real" event in the browser. 153 // "real" event in the browser.
154 event.skip_in_browser = key_down_text_insertion; 154 event.skip_in_browser = true;
aelias_OOO_until_Jul13 2015/10/02 20:11:51 "true" seems unnecessarily broad. That will suppr
155 rwhva_->SendKeyEvent(event); 155 rwhva_->SendKeyEvent(event);
156 if (key_down_text_insertion) { 156 if (key_down_text_insertion) {
157 // Send a Char event, but without an os_event since we don't want to 157 // Send a Char event, but without an os_event since we don't want to
158 // roundtrip back to java such synthetic event. 158 // roundtrip back to java such synthetic event.
159 NativeWebKeyboardEvent char_event(blink::WebInputEvent::Char, modifiers, 159 NativeWebKeyboardEvent char_event(blink::WebInputEvent::Char, modifiers,
160 time_ms / 1000.0, key_code, scan_code, 160 time_ms / 1000.0, key_code, scan_code,
161 unicode_char, 161 unicode_char,
162 is_system_key); 162 is_system_key);
163 char_event.skip_in_browser = key_down_text_insertion; 163 char_event.skip_in_browser = key_down_text_insertion;
164 rwhva_->SendKeyEvent(char_event); 164 rwhva_->SendKeyEvent(char_event);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 WebContents* ImeAdapterAndroid::GetWebContents() { 304 WebContents* ImeAdapterAndroid::GetWebContents() {
305 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); 305 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl();
306 if (!rwh) 306 if (!rwh)
307 return NULL; 307 return NULL;
308 if (!rwh->IsRenderView()) 308 if (!rwh->IsRenderView())
309 return NULL; 309 return NULL;
310 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); 310 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh));
311 } 311 }
312 312
313 } // namespace content 313 } // namespace content
OLDNEW
« 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