OLD | NEW |
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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 weak_ptr_factory_.GetWeakPtr())); | 490 weak_ptr_factory_.GetWeakPtr())); |
491 #if defined(OS_WIN) | 491 #if defined(OS_WIN) |
492 plugin_parent_window_ = NULL; | 492 plugin_parent_window_ = NULL; |
493 #endif | 493 #endif |
494 ImageTransportFactory::GetInstance()->AddObserver(this); | 494 ImageTransportFactory::GetInstance()->AddObserver(this); |
495 } | 495 } |
496 | 496 |
497 //////////////////////////////////////////////////////////////////////////////// | 497 //////////////////////////////////////////////////////////////////////////////// |
498 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 498 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
499 | 499 |
| 500 bool RenderWidgetHostViewAura::OnMessageReceived( |
| 501 const IPC::Message& message) { |
| 502 bool handled = true; |
| 503 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) |
| 504 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC |
| 505 // messages for TextInput<State|Type>Changed. Corresponding code in |
| 506 // RenderWidgetHostViewAndroid should also be moved at the same time. |
| 507 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
| 508 OnTextInputStateChanged) |
| 509 IPC_MESSAGE_UNHANDLED(handled = false) |
| 510 IPC_END_MESSAGE_MAP() |
| 511 return handled; |
| 512 } |
| 513 |
500 void RenderWidgetHostViewAura::InitAsChild( | 514 void RenderWidgetHostViewAura::InitAsChild( |
501 gfx::NativeView parent_view) { | 515 gfx::NativeView parent_view) { |
502 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 516 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
503 window_->Init(aura::WINDOW_LAYER_TEXTURED); | 517 window_->Init(aura::WINDOW_LAYER_TEXTURED); |
504 window_->SetName("RenderWidgetHostViewAura"); | 518 window_->SetName("RenderWidgetHostViewAura"); |
505 } | 519 } |
506 | 520 |
507 void RenderWidgetHostViewAura::InitAsPopup( | 521 void RenderWidgetHostViewAura::InitAsPopup( |
508 RenderWidgetHostView* parent_host_view, | 522 RenderWidgetHostView* parent_host_view, |
509 const gfx::Rect& bounds_in_screen) { | 523 const gfx::Rect& bounds_in_screen) { |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 text_input_type_ = type; | 920 text_input_type_ = type; |
907 text_input_mode_ = input_mode; | 921 text_input_mode_ = input_mode; |
908 can_compose_inline_ = can_compose_inline; | 922 can_compose_inline_ = can_compose_inline; |
909 if (GetInputMethod()) | 923 if (GetInputMethod()) |
910 GetInputMethod()->OnTextInputTypeChanged(this); | 924 GetInputMethod()->OnTextInputTypeChanged(this); |
911 if (touch_editing_client_) | 925 if (touch_editing_client_) |
912 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); | 926 touch_editing_client_->OnTextInputTypeChanged(text_input_type_); |
913 } | 927 } |
914 } | 928 } |
915 | 929 |
| 930 void RenderWidgetHostViewAura::OnTextInputStateChanged( |
| 931 const ViewHostMsg_TextInputState_Params& params) { |
| 932 if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { |
| 933 if (GetInputMethod()) |
| 934 GetInputMethod()->ShowImeIfNeeded(); |
| 935 } |
| 936 } |
| 937 |
916 void RenderWidgetHostViewAura::ImeCancelComposition() { | 938 void RenderWidgetHostViewAura::ImeCancelComposition() { |
917 if (GetInputMethod()) | 939 if (GetInputMethod()) |
918 GetInputMethod()->CancelComposition(this); | 940 GetInputMethod()->CancelComposition(this); |
919 has_composition_text_ = false; | 941 has_composition_text_ = false; |
920 } | 942 } |
921 | 943 |
922 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( | 944 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( |
923 const gfx::Range& range, | 945 const gfx::Range& range, |
924 const std::vector<gfx::Rect>& character_bounds) { | 946 const std::vector<gfx::Rect>& character_bounds) { |
925 composition_character_bounds_ = character_bounds; | 947 composition_character_bounds_ = character_bounds; |
(...skipping 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3529 RenderWidgetHost* widget) { | 3551 RenderWidgetHost* widget) { |
3530 return new RenderWidgetHostViewAura(widget); | 3552 return new RenderWidgetHostViewAura(widget); |
3531 } | 3553 } |
3532 | 3554 |
3533 // static | 3555 // static |
3534 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3556 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3535 GetScreenInfoForWindow(results, NULL); | 3557 GetScreenInfoForWindow(results, NULL); |
3536 } | 3558 } |
3537 | 3559 |
3538 } // namespace content | 3560 } // namespace content |
OLD | NEW |