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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 | 632 |
633 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { | 633 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { |
634 // Do nothing. The UI notification is handled through ContentViewClient which | 634 // Do nothing. The UI notification is handled through ContentViewClient which |
635 // is TabContentsDelegate. | 635 // is TabContentsDelegate. |
636 } | 636 } |
637 | 637 |
638 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { | 638 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { |
639 return reinterpret_cast<intptr_t>(&ime_adapter_android_); | 639 return reinterpret_cast<intptr_t>(&ime_adapter_android_); |
640 } | 640 } |
641 | 641 |
642 void RenderWidgetHostViewAndroid::TextInputStateChanged( | 642 void RenderWidgetHostViewAndroid::UpdateInputMethodIfNecessary( |
643 const ViewHostMsg_TextInputState_Params& params) { | 643 bool text_input_state_changed) { |
644 if (params.is_non_ime_change) { | 644 DCHECK(text_input_state_changed); |
645 // Sends an acknowledgement to the renderer of a processed IME event. | |
646 host_->Send(new InputMsg_ImeEventAck(host_->GetRoutingID())); | |
647 } | |
648 | |
649 if (!content_view_core_) | 645 if (!content_view_core_) |
650 return; | 646 return; |
651 | 647 |
| 648 TextInputState state = host_->delegate()->GetTextInputState(); |
| 649 |
652 content_view_core_->UpdateImeAdapter( | 650 content_view_core_->UpdateImeAdapter( |
653 GetNativeImeAdapter(), | 651 GetNativeImeAdapter(), static_cast<int>(state.type), state.flags, |
654 static_cast<int>(params.type), params.flags, | 652 state.value, state.selection_start, state.selection_end, |
655 params.value, params.selection_start, params.selection_end, | 653 state.composition_start, state.composition_end, state.show_ime_if_needed, |
656 params.composition_start, params.composition_end, | 654 state.is_non_ime_change); |
657 params.show_ime_if_needed, params.is_non_ime_change); | |
658 } | 655 } |
659 | 656 |
660 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { | 657 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { |
661 if (cached_background_color_ == color) | 658 if (cached_background_color_ == color) |
662 return; | 659 return; |
663 | 660 |
664 cached_background_color_ = color; | 661 cached_background_color_ = color; |
665 if (content_view_core_) | 662 if (content_view_core_) |
666 content_view_core_->OnBackgroundColorChanged(color); | 663 content_view_core_->OnBackgroundColorChanged(color); |
667 } | 664 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 RemoveLayers(); | 790 RemoveLayers(); |
794 SetContentViewCore(NULL); | 791 SetContentViewCore(NULL); |
795 | 792 |
796 if (!surface_id_.is_null()) { | 793 if (!surface_id_.is_null()) { |
797 DCHECK(surface_factory_.get()); | 794 DCHECK(surface_factory_.get()); |
798 surface_factory_->Destroy(surface_id_); | 795 surface_factory_->Destroy(surface_id_); |
799 surface_id_ = cc::SurfaceId(); | 796 surface_id_ = cc::SurfaceId(); |
800 } | 797 } |
801 surface_factory_.reset(); | 798 surface_factory_.reset(); |
802 | 799 |
| 800 // The WebContentsImpl should be notified about us so that it will not hold |
| 801 // an invalid text input state which was due to active text on this view. |
| 802 NotifyHostDelegateAboutShutdown(); |
| 803 |
803 // The RenderWidgetHost's destruction led here, so don't call it. | 804 // The RenderWidgetHost's destruction led here, so don't call it. |
804 host_ = NULL; | 805 host_ = NULL; |
805 | 806 |
806 delete this; | 807 delete this; |
807 } | 808 } |
808 | 809 |
809 void RenderWidgetHostViewAndroid::SetTooltipText( | 810 void RenderWidgetHostViewAndroid::SetTooltipText( |
810 const base::string16& tooltip_text) { | 811 const base::string16& tooltip_text) { |
811 // Tooltips don't makes sense on Android. | 812 // Tooltips don't makes sense on Android. |
812 } | 813 } |
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 results->orientationAngle = display.RotationAsDegree(); | 2005 results->orientationAngle = display.RotationAsDegree(); |
2005 results->orientationType = | 2006 results->orientationType = |
2006 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2007 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2007 gfx::DeviceDisplayInfo info; | 2008 gfx::DeviceDisplayInfo info; |
2008 results->depth = info.GetBitsPerPixel(); | 2009 results->depth = info.GetBitsPerPixel(); |
2009 results->depthPerComponent = info.GetBitsPerComponent(); | 2010 results->depthPerComponent = info.GetBitsPerComponent(); |
2010 results->isMonochrome = (results->depthPerComponent == 0); | 2011 results->isMonochrome = (results->depthPerComponent == 0); |
2011 } | 2012 } |
2012 | 2013 |
2013 } // namespace content | 2014 } // namespace content |
OLD | NEW |