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

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

Issue 326403002: Merge ViewHostMsg_TextInputTypeChanged and ViewHostMsg_TextInputStateChanged into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed. Created 6 years, 6 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 (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/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 442 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
443 443
444 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> 444 bool overscroll_enabled = CommandLine::ForCurrentProcess()->
445 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 445 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
446 SetOverscrollControllerEnabled(overscroll_enabled); 446 SetOverscrollControllerEnabled(overscroll_enabled);
447 } 447 }
448 448
449 //////////////////////////////////////////////////////////////////////////////// 449 ////////////////////////////////////////////////////////////////////////////////
450 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 450 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
451 451
452 bool RenderWidgetHostViewAura::OnMessageReceived(
453 const IPC::Message& message) {
454 bool handled = true;
455 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message)
456 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC
457 // messages for TextInput<State|Type>Changed. Corresponding code in
458 // RenderWidgetHostViewAndroid should also be moved at the same time.
459 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
460 OnTextInputStateChanged)
461 IPC_MESSAGE_UNHANDLED(handled = false)
462 IPC_END_MESSAGE_MAP()
463 return handled;
464 }
465
466 void RenderWidgetHostViewAura::InitAsChild( 452 void RenderWidgetHostViewAura::InitAsChild(
467 gfx::NativeView parent_view) { 453 gfx::NativeView parent_view) {
468 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); 454 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL);
469 window_->Init(aura::WINDOW_LAYER_TEXTURED); 455 window_->Init(aura::WINDOW_LAYER_TEXTURED);
470 window_->SetName("RenderWidgetHostViewAura"); 456 window_->SetName("RenderWidgetHostViewAura");
471 } 457 }
472 458
473 void RenderWidgetHostViewAura::InitAsPopup( 459 void RenderWidgetHostViewAura::InitAsPopup(
474 RenderWidgetHostView* parent_host_view, 460 RenderWidgetHostView* parent_host_view,
475 const gfx::Rect& bounds_in_screen) { 461 const gfx::Rect& bounds_in_screen) {
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 GetDisplayNearestWindow(window_); 792 GetDisplayNearestWindow(window_);
807 current_cursor_.SetDisplayInfo(display); 793 current_cursor_.SetDisplayInfo(display);
808 UpdateCursorIfOverSelf(); 794 UpdateCursorIfOverSelf();
809 } 795 }
810 796
811 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { 797 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) {
812 is_loading_ = is_loading; 798 is_loading_ = is_loading;
813 UpdateCursorIfOverSelf(); 799 UpdateCursorIfOverSelf();
814 } 800 }
815 801
816 void RenderWidgetHostViewAura::TextInputTypeChanged( 802 void RenderWidgetHostViewAura::TextInputStateChanged(
817 ui::TextInputType type, 803 const ViewHostMsg_TextInputState_Params& params) {
818 ui::TextInputMode input_mode, 804 if (text_input_type_ != params.type ||
819 bool can_compose_inline) { 805 text_input_mode_ != params.mode ||
820 if (text_input_type_ != type || 806 can_compose_inline_ != params.can_compose_inline) {
821 text_input_mode_ != input_mode || 807 text_input_type_ = params.type;
822 can_compose_inline_ != can_compose_inline) { 808 text_input_mode_ = params.mode;
823 text_input_type_ = type; 809 can_compose_inline_ = params.can_compose_inline;
824 text_input_mode_ = input_mode;
825 can_compose_inline_ = can_compose_inline;
826 if (GetInputMethod()) 810 if (GetInputMethod())
827 GetInputMethod()->OnTextInputTypeChanged(this); 811 GetInputMethod()->OnTextInputTypeChanged(this);
828 if (touch_editing_client_) 812 if (touch_editing_client_)
829 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); 813 touch_editing_client_->OnTextInputTypeChanged(text_input_type_);
830 } 814 }
831 }
832
833 void RenderWidgetHostViewAura::OnTextInputStateChanged(
834 const ViewHostMsg_TextInputState_Params& params) {
835 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { 815 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) {
836 if (GetInputMethod()) 816 if (GetInputMethod())
837 GetInputMethod()->ShowImeIfNeeded(); 817 GetInputMethod()->ShowImeIfNeeded();
838 } 818 }
839 } 819 }
840 820
841 void RenderWidgetHostViewAura::ImeCancelComposition() { 821 void RenderWidgetHostViewAura::ImeCancelComposition() {
842 if (GetInputMethod()) 822 if (GetInputMethod())
843 GetInputMethod()->CancelComposition(this); 823 GetInputMethod()->CancelComposition(this);
844 has_composition_text_ = false; 824 has_composition_text_ = false;
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 2436
2457 //////////////////////////////////////////////////////////////////////////////// 2437 ////////////////////////////////////////////////////////////////////////////////
2458 // RenderWidgetHostViewBase, public: 2438 // RenderWidgetHostViewBase, public:
2459 2439
2460 // static 2440 // static
2461 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2441 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2462 GetScreenInfoForWindow(results, NULL); 2442 GetScreenInfoForWindow(results, NULL);
2463 } 2443 }
2464 2444
2465 } // namespace content 2445 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698