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

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

Issue 29943002: Limit display of the virtual keyboard to state changes triggered from a user gesture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } else if (skip_frame) { 381 } else if (skip_frame) {
382 ack.mailbox_name = received_mailbox; 382 ack.mailbox_name = received_mailbox;
383 ack.sync_point = 0; 383 ack.sync_point = 0;
384 } 384 }
385 385
386 ack.sync_point = sync_point; 386 ack.sync_point = sync_point;
387 RenderWidgetHostImpl::AcknowledgeBufferPresent( 387 RenderWidgetHostImpl::AcknowledgeBufferPresent(
388 route_id, gpu_host_id, ack); 388 route_id, gpu_host_id, ack);
389 } 389 }
390 390
391 // Sends an acknowledgement to the renderer of a processed IME event.
392 void SendImeEventAck(RenderWidgetHostImpl* host) {
393 host->Send(new ViewMsg_ImeEventAck(host->GetRoutingID()));
394 }
395
391 } // namespace 396 } // namespace
392 397
393 // We need to watch for mouse events outside a Web Popup or its parent 398 // We need to watch for mouse events outside a Web Popup or its parent
394 // and dismiss the popup for certain events. 399 // and dismiss the popup for certain events.
395 class RenderWidgetHostViewAura::EventFilterForPopupExit : 400 class RenderWidgetHostViewAura::EventFilterForPopupExit :
396 public ui::EventHandler { 401 public ui::EventHandler {
397 public: 402 public:
398 explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva) 403 explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva)
399 : rwhva_(rwhva) { 404 : rwhva_(rwhva) {
400 DCHECK(rwhva_); 405 DCHECK(rwhva_);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 aura::client::SetFocusChangeObserver(window_, this); 617 aura::client::SetFocusChangeObserver(window_, this);
613 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 618 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
614 #if defined(OS_WIN) 619 #if defined(OS_WIN)
615 transient_observer_.reset(new TransientWindowObserver(this)); 620 transient_observer_.reset(new TransientWindowObserver(this));
616 #endif 621 #endif
617 } 622 }
618 623
619 //////////////////////////////////////////////////////////////////////////////// 624 ////////////////////////////////////////////////////////////////////////////////
620 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 625 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
621 626
627
628 bool RenderWidgetHostViewAura::OnMessageReceived(
629 const IPC::Message& message) {
630 bool handled = true;
631 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message)
632 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
633 OnTextInputStateChanged)
634 IPC_MESSAGE_UNHANDLED(handled = false)
635 IPC_END_MESSAGE_MAP()
636 return handled;
637 }
638
622 void RenderWidgetHostViewAura::InitAsChild( 639 void RenderWidgetHostViewAura::InitAsChild(
623 gfx::NativeView parent_view) { 640 gfx::NativeView parent_view) {
624 window_->Init(ui::LAYER_TEXTURED); 641 window_->Init(ui::LAYER_TEXTURED);
625 window_->SetName("RenderWidgetHostViewAura"); 642 window_->SetName("RenderWidgetHostViewAura");
626 } 643 }
627 644
628 void RenderWidgetHostViewAura::InitAsPopup( 645 void RenderWidgetHostViewAura::InitAsPopup(
629 RenderWidgetHostView* parent_host_view, 646 RenderWidgetHostView* parent_host_view,
630 const gfx::Rect& bounds_in_screen) { 647 const gfx::Rect& bounds_in_screen) {
631 popup_parent_host_view_ = 648 popup_parent_host_view_ =
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 UpdateCursorIfOverSelf(); 1025 UpdateCursorIfOverSelf();
1009 } 1026 }
1010 1027
1011 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { 1028 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) {
1012 if (is_loading_ && !is_loading && paint_observer_) 1029 if (is_loading_ && !is_loading && paint_observer_)
1013 paint_observer_->OnPageLoadComplete(); 1030 paint_observer_->OnPageLoadComplete();
1014 is_loading_ = is_loading; 1031 is_loading_ = is_loading;
1015 UpdateCursorIfOverSelf(); 1032 UpdateCursorIfOverSelf();
1016 } 1033 }
1017 1034
1035 void RenderWidgetHostViewAura::OnTextInputStateChanged(
1036 const ViewHostMsg_TextInputState_Params& params) {
1037 // If an acknowledgement is required for this event, regardless of how we exit
1038 // from this method, we must acknowledge that we processed the input state
1039 // change.
1040 base::ScopedClosureRunner ack_caller;
1041 if (params.require_ack)
1042 ack_caller.Reset(base::Bind(&SendImeEventAck, host_));
1043
1044 ui::TextInputType new_type = params.type;
1045 ui::TextInputMode new_mode = params.mode;
1046 bool new_can_compose_inline = params.can_compose_inline;
1047 if (text_input_type_ != new_type ||
1048 text_input_mode_ != new_mode ||
1049 can_compose_inline_ != new_can_compose_inline) {
1050 text_input_type_ = new_type;
1051 text_input_mode_ = new_mode;
1052 can_compose_inline_ = new_can_compose_inline;
1053 if (GetInputMethod())
1054 GetInputMethod()->OnTextInputTypeChanged(this);
1055 if (touch_editing_client_)
1056 touch_editing_client_->OnTextInputTypeChanged(text_input_type_);
1057 }
1058
1059 if (params.show_ime_if_needed && new_type != ui::TEXT_INPUT_TYPE_NONE) {
1060 if (GetInputMethod())
1061 GetInputMethod()->ShowVirtualKeyboard();
1062 }
1063 }
1064
1018 void RenderWidgetHostViewAura::TextInputTypeChanged( 1065 void RenderWidgetHostViewAura::TextInputTypeChanged(
1019 ui::TextInputType type, 1066 ui::TextInputType type,
1020 ui::TextInputMode input_mode, 1067 ui::TextInputMode input_mode,
1021 bool can_compose_inline) { 1068 bool can_compose_inline) {
1022 if (text_input_type_ != type || 1069 // Aura uses TextInputStateChanged instead of TextInputTypeChanged.
Seigo Nonaka 2013/10/21 16:35:03 This means we have duplicated IPCs for text input
kevers 2013/10/22 19:01:42 Added TODOs to complete the task of consolidating
1023 text_input_mode_ != input_mode ||
1024 can_compose_inline_ != can_compose_inline) {
1025 text_input_type_ = type;
1026 text_input_mode_ = input_mode;
1027 can_compose_inline_ = can_compose_inline;
1028 if (GetInputMethod())
1029 GetInputMethod()->OnTextInputTypeChanged(this);
1030 if (touch_editing_client_)
1031 touch_editing_client_->OnTextInputTypeChanged(text_input_type_);
1032 }
1033 } 1070 }
1034 1071
1035 void RenderWidgetHostViewAura::ImeCancelComposition() { 1072 void RenderWidgetHostViewAura::ImeCancelComposition() {
1036 if (GetInputMethod()) 1073 if (GetInputMethod())
1037 GetInputMethod()->CancelComposition(this); 1074 GetInputMethod()->CancelComposition(this);
1038 has_composition_text_ = false; 1075 has_composition_text_ = false;
1039 } 1076 }
1040 1077
1041 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( 1078 void RenderWidgetHostViewAura::ImeCompositionRangeChanged(
1042 const gfx::Range& range, 1079 const gfx::Range& range,
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 RenderWidgetHost* widget) { 3481 RenderWidgetHost* widget) {
3445 return new RenderWidgetHostViewAura(widget); 3482 return new RenderWidgetHostViewAura(widget);
3446 } 3483 }
3447 3484
3448 // static 3485 // static
3449 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3486 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3450 GetScreenInfoForWindow(results, NULL); 3487 GetScreenInfoForWindow(results, NULL);
3451 } 3488 }
3452 3489
3453 } // namespace content 3490 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698