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