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 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 647 |
648 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { | 648 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { |
649 // Do nothing. The UI notification is handled through ContentViewClient which | 649 // Do nothing. The UI notification is handled through ContentViewClient which |
650 // is TabContentsDelegate. | 650 // is TabContentsDelegate. |
651 } | 651 } |
652 | 652 |
653 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { | 653 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { |
654 return reinterpret_cast<intptr_t>(&ime_adapter_android_); | 654 return reinterpret_cast<intptr_t>(&ime_adapter_android_); |
655 } | 655 } |
656 | 656 |
657 void RenderWidgetHostViewAndroid::UpdateInputMethodIfNecessary( | 657 void RenderWidgetHostViewAndroid::TextInputStateChanged( |
658 bool text_input_state_changed) { | 658 const ViewHostMsg_TextInputState_Params& params) { |
659 DCHECK(text_input_state_changed); | 659 if (params.is_non_ime_change) { |
| 660 // Sends an acknowledgement to the renderer of a processed IME event. |
| 661 host_->Send(new InputMsg_ImeEventAck(host_->GetRoutingID())); |
| 662 } |
| 663 |
660 if (!content_view_core_) | 664 if (!content_view_core_) |
661 return; | 665 return; |
662 | 666 |
663 const TextInputState* state = host_->delegate()->GetTextInputState(); | |
664 | |
665 content_view_core_->UpdateImeAdapter( | 667 content_view_core_->UpdateImeAdapter( |
666 GetNativeImeAdapter(), static_cast<int>(state->type), state->flags, | 668 GetNativeImeAdapter(), |
667 state->value, state->selection_start, state->selection_end, | 669 static_cast<int>(params.type), params.flags, |
668 state->composition_start, state->composition_end, | 670 params.value, params.selection_start, params.selection_end, |
669 state->show_ime_if_needed, state->is_non_ime_change); | 671 params.composition_start, params.composition_end, |
| 672 params.show_ime_if_needed, params.is_non_ime_change); |
670 } | 673 } |
671 | 674 |
672 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { | 675 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { |
673 if (cached_background_color_ == color) | 676 if (cached_background_color_ == color) |
674 return; | 677 return; |
675 | 678 |
676 cached_background_color_ = color; | 679 cached_background_color_ = color; |
677 if (content_view_core_) | 680 if (content_view_core_) |
678 content_view_core_->OnBackgroundColorChanged(color); | 681 content_view_core_->OnBackgroundColorChanged(color); |
679 } | 682 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 RemoveLayers(); | 808 RemoveLayers(); |
806 SetContentViewCore(NULL); | 809 SetContentViewCore(NULL); |
807 | 810 |
808 if (!surface_id_.is_null()) { | 811 if (!surface_id_.is_null()) { |
809 DCHECK(surface_factory_.get()); | 812 DCHECK(surface_factory_.get()); |
810 surface_factory_->Destroy(surface_id_); | 813 surface_factory_->Destroy(surface_id_); |
811 surface_id_ = cc::SurfaceId(); | 814 surface_id_ = cc::SurfaceId(); |
812 } | 815 } |
813 surface_factory_.reset(); | 816 surface_factory_.reset(); |
814 | 817 |
815 // The WebContentsImpl should be notified about us so that it will not hold | |
816 // an invalid text input state which was due to active text on this view. | |
817 NotifyHostDelegateAboutShutdown(); | |
818 | |
819 // The RenderWidgetHost's destruction led here, so don't call it. | 818 // The RenderWidgetHost's destruction led here, so don't call it. |
820 host_ = NULL; | 819 host_ = NULL; |
821 | 820 |
822 delete this; | 821 delete this; |
823 } | 822 } |
824 | 823 |
825 void RenderWidgetHostViewAndroid::SetTooltipText( | 824 void RenderWidgetHostViewAndroid::SetTooltipText( |
826 const base::string16& tooltip_text) { | 825 const base::string16& tooltip_text) { |
827 // Tooltips don't makes sense on Android. | 826 // Tooltips don't makes sense on Android. |
828 } | 827 } |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 results->orientationAngle = display.RotationAsDegree(); | 2018 results->orientationAngle = display.RotationAsDegree(); |
2020 results->orientationType = | 2019 results->orientationType = |
2021 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2020 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2022 gfx::DeviceDisplayInfo info; | 2021 gfx::DeviceDisplayInfo info; |
2023 results->depth = info.GetBitsPerPixel(); | 2022 results->depth = info.GetBitsPerPixel(); |
2024 results->depthPerComponent = info.GetBitsPerComponent(); | 2023 results->depthPerComponent = info.GetBitsPerComponent(); |
2025 results->isMonochrome = (results->depthPerComponent == 0); | 2024 results->isMonochrome = (results->depthPerComponent == 0); |
2026 } | 2025 } |
2027 | 2026 |
2028 } // namespace content | 2027 } // namespace content |
OLD | NEW |