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

Side by Side Diff: content/renderer/input/render_widget_input_handler.cc

Issue 2596193002: Clean up names and remove unnecessary parameter (Closed)
Patch Set: rebase Created 3 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/renderer/input/render_widget_input_handler.h" 5 #include "content/renderer/input/render_widget_input_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // behavior is to just show the IME and don't propagate the key. 272 // behavior is to just show the IME and don't propagate the key.
273 // A typical use case is a web form: the DPAD_CENTER should bring up the IME 273 // A typical use case is a web form: the DPAD_CENTER should bring up the IME
274 // when clicked on an input text field and cause the form submit if clicked 274 // when clicked on an input text field and cause the form submit if clicked
275 // when the submit button is focused, but not vice-versa. 275 // when the submit button is focused, but not vice-versa.
276 // The UI layer takes care of translating DPAD_CENTER into a RETURN key, 276 // The UI layer takes care of translating DPAD_CENTER into a RETURN key,
277 // but at this point we have to swallow the event for the scenario (2). 277 // but at this point we have to swallow the event for the scenario (2).
278 const WebKeyboardEvent& key_event = 278 const WebKeyboardEvent& key_event =
279 static_cast<const WebKeyboardEvent&>(input_event); 279 static_cast<const WebKeyboardEvent&>(input_event);
280 if (key_event.nativeKeyCode == AKEYCODE_DPAD_CENTER && 280 if (key_event.nativeKeyCode == AKEYCODE_DPAD_CENTER &&
281 widget_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE) { 281 widget_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE) {
282 widget_->showImeIfNeeded(); 282 widget_->showVirtualKeyboard();
283 prevent_default = true; 283 prevent_default = true;
284 } 284 }
285 #endif 285 #endif
286 } 286 }
287 287
288 if (WebInputEvent::isGestureEventType(input_event.type())) { 288 if (WebInputEvent::isGestureEventType(input_event.type())) {
289 const WebGestureEvent& gesture_event = 289 const WebGestureEvent& gesture_event =
290 static_cast<const WebGestureEvent&>(input_event); 290 static_cast<const WebGestureEvent&>(input_event);
291 if (input_event.type() == WebInputEvent::GestureLongPress) { 291 if (input_event.type() == WebInputEvent::GestureLongPress) {
292 context_menu_source_type_ = ui::MENU_SOURCE_LONG_PRESS; 292 context_menu_source_type_ = ui::MENU_SOURCE_LONG_PRESS;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 RenderThreadImpl::current() 408 RenderThreadImpl::current()
409 ->GetRendererScheduler() 409 ->GetRendererScheduler()
410 ->DidHandleInputEventOnMainThread(input_event); 410 ->DidHandleInputEventOnMainThread(input_event);
411 } 411 }
412 412
413 #if defined(OS_ANDROID) 413 #if defined(OS_ANDROID)
414 // Allow the IME to be shown when the focus changes as a consequence 414 // Allow the IME to be shown when the focus changes as a consequence
415 // of a processed touch end event. 415 // of a processed touch end event.
416 if (input_event.type() == WebInputEvent::TouchEnd && 416 if (input_event.type() == WebInputEvent::TouchEnd &&
417 processed != WebInputEventResult::NotHandled) { 417 processed != WebInputEventResult::NotHandled) {
418 delegate_->UpdateTextInputState(ShowIme::IF_NEEDED, 418 delegate_->ShowVirtualKeyboard();
419 ChangeSource::FROM_NON_IME);
420 } 419 }
421 #elif defined(USE_AURA) 420 #elif defined(USE_AURA)
422 // Show the virtual keyboard if enabled and a user gesture triggers a focus 421 // Show the virtual keyboard if enabled and a user gesture triggers a focus
423 // change. 422 // change.
424 if (processed != WebInputEventResult::NotHandled && 423 if (processed != WebInputEventResult::NotHandled &&
425 (input_event.type() == WebInputEvent::TouchEnd || 424 (input_event.type() == WebInputEvent::TouchEnd ||
426 input_event.type() == WebInputEvent::MouseUp)) { 425 input_event.type() == WebInputEvent::MouseUp)) {
427 delegate_->UpdateTextInputState(ShowIme::IF_NEEDED, ChangeSource::FROM_IME); 426 delegate_->ShowVirtualKeyboard();
428 } 427 }
429 #endif 428 #endif
430 429
431 if (!prevent_default && 430 if (!prevent_default &&
432 WebInputEvent::isKeyboardEventType(input_event.type())) 431 WebInputEvent::isKeyboardEventType(input_event.type()))
433 delegate_->OnDidHandleKeyEvent(); 432 delegate_->OnDidHandleKeyEvent();
434 433
435 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with 434 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with
436 // virtual keyboard. 435 // virtual keyboard.
437 #if !defined(OS_ANDROID) 436 #if !defined(OS_ANDROID)
(...skipping 24 matching lines...) Expand all
462 // it can be bundled in the event ack. 461 // it can be bundled in the event ack.
463 if (handling_event_overscroll_) { 462 if (handling_event_overscroll_) {
464 *handling_event_overscroll_ = std::move(params); 463 *handling_event_overscroll_ = std::move(params);
465 return; 464 return;
466 } 465 }
467 466
468 delegate_->OnDidOverscroll(*params); 467 delegate_->OnDidOverscroll(*params);
469 } 468 }
470 469
471 } // namespace content 470 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/ime_event_guard.cc ('k') | content/renderer/input/render_widget_input_handler_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698